input_schema to validate dictionaries automatically.
Input Format Types
| Use Case | Input Format |
|---|---|
| You're building the input in code | Use Pydantic Model instance |
| Input comes from external sources (APIs, files, user input) | Use input_schema |
Using Pydantic Models
Pass a Pydantic model instance toinput:
ValidationError before the agent runs.
Using input_schema
Set input_schema on the agent to validate dictionaries automatically:
Handling Input ValidationError
Invalid input raises a Pydantic ValidationError:
Common Patterns
API Request Handler
Configuration-Driven Tasks
Nested Models
Related
- Team Structured Input: Configure structured input for teams
- Structured Output: Get validated output from agents