Skip to main content
Return structured data from an agent by passing an output_schema.
1

Create the agent

agent_structured.py
2

Install dependencies

3

Export your API key

4

Run

The agent returns a validated MovieReview Pydantic model.
Use output_schema=, not response_model=. The response_model parameter does not exist.