Skip to main content
Agno agents support two methods for schema-compliant responses: Structured Outputs and JSON mode. Both use the agent’s output_schema parameter.

Structured Outputs (Default if supported)

If the model class supports it, Agno agents use Structured Outputs by default. The schema (Pydantic or JSON Schema) is passed to the model provider’s API, and the response is guaranteed to strictly follow it, so you won’t get missing fields, invalid enum values, or inconsistent formatting.
The agent returns a User object instead of free-form text. Structured Outputs are a good fit for tasks where the output shape has to be right, like entity extraction or generating content for UI rendering.

JSON Mode

Some model classes do not support Structured Outputs, and sometimes you want to bypass it even when they do. Set use_json_mode=True to enable JSON mode.
JSON mode injects a description of the expected JSON structure into the system prompt and instructs the model to return valid JSON. The response is not validated against the schema at the API level.

When to Use Which