Skip to main content
Agno Teams support various forms of input and output, from simple string-based interactions to structured data validation using Pydantic models. The most standard pattern is to use str input and str output:

Structured Output

One of our favorite features is using Teams to generate structured data (i.e. a pydantic model). This is generally called “Structured Output”. Use this feature to extract features, classify data, produce fake data etc. The best part is that they work with function calls, knowledge bases and all other features. Structured output makes teams reliable for production systems that need consistent, predictable response formats instead of unstructured text. Let’s create a Stock Research Team to generate a structured StockReport for us.
1

Structured Output example

structured_output_team.py
2

Run the example

Install libraries
Export your key
Run the example
The output is an object of the StockReport class, here’s how it looks:
Some LLMs are not able to generate structured output. Agno has an option to tell the model to respond as JSON. Although this is typically not as accurate as structured output, it can be useful in some cases.If you want to use JSON mode, you can set use_json_mode=True on the Agent.

Streaming Structured Output

Streaming can be used in combination with output_schema. This returns the structured output as a single RunContent event in the stream of events.
1

Streaming Structured Output example

streaming_structured_output_team.py
2

Run the example

Install libraries
Export your key
Run the example

Structured Input

A team can be provided with structured input (i.e a pydantic model) by passing it in the Team.run() or Team.print_response() as the input parameter.
1

Structured Input example

structured_input_team.py
2

Run the example

Install libraries
Export your key
Run the example
Structured input is only available for the team leader. Structured input on member agents (when used in a Team) is not yet supported.

Validating the input

You can set input_schema on the Team to validate the input. If you then pass the input as a dictionary, it will be automatically validated against the schema.
1

Validating the input example

validating_input_team.py
2

Run the example

Install libraries
Export your key
Run the example

Typesafe Teams

For complete type safety with both input and output validation, Teams work similarly to Agents. You can combine input_schema and output_schema to create fully typesafe teams that validate inputs and guarantee structured outputs. For detailed examples and patterns of typesafe implementations, see the Agent Input and Output documentation, which demonstrates the same concepts that apply to Teams.

Using a Parser Model

You can use a different model to parse and structure the output from your primary model. This approach is particularly effective when the primary model is optimized for reasoning tasks, as such models may not consistently produce detailed structured responses.
Using a parser model can improve output reliability and reduce costs since you can use a smaller, faster model for formatting while keeping a powerful model for the actual response.
You can also provide a custom parser_model_prompt to your Parser Model to customize the model’s instructions.

Using an Output Model

You can use a different model to produce the run output of the team. This is useful when the primary model is optimized for image analysis, for example, but you want a different model to produce a structured output response.
You can also provide a custom output_model_prompt to your Output Model to customize the model’s instructions.
Gemini models often reject requests to use tools and produce structured output at the same time. Using an Output Model is an effective workaround for this.

Developer Resources