output_schema on a team to constrain its final response to a Pydantic model. The team leader synthesizes member outputs into a validated object.
Basic Usage
How It Works
When a team hasoutput_schema set:
- The team leader delegates tasks to members
- Members execute and return their results
- The leader synthesizes all member outputs
- The final response is structured according to your schema
output_schema.
Control output_schema Per-Run
Override or set the schema at run time:
Control output_schema Per Member/Team
You can set output_schema on both individual members and the team:
Schema Design Tips
Aggregate Multiple Perspectives
Design schemas that capture synthesized insights:Include Confidence and Reasoning
Structured Comparisons
Fallback with use_json_mode
Enable JSON mode for models that don’t support structured output natively:
JSON mode instructs the model to respond in JSON but doesn't guarantee schema compliance. Prefer models with native structured output support.
Related
- Agent Structured Output: Configure structured output for agents
- Team Structured Input: Validate input for teams
- Output Model: Use a separate model to structure output