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.
Fallback parsing failures are logged and can leave response.content as a string. Check its type before accessing schema fields when the team model lacks native schema support.

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

JSON Mode

Agno uses a JSON fallback automatically when the model lacks native schema support. Set use_json_mode=True to force JSON mode for a model that supports native structured output:
JSON mode instructs the model to respond in JSON but doesn't guarantee schema compliance. Prefer models with native structured output support.