Skip to main content
Set 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 has output_schema set:
  1. The team leader delegates tasks to members
  2. Members execute and return their results
  3. The leader synthesizes all member outputs
  4. The final response is structured according to your schema
Only the team’s final output is structured. Individual member responses remain unstructured unless those members have their own 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:
Member schemas ensure consistent intermediate outputs. The team schema controls the final synthesized response.

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.