This example shows how to use the output_model parameter to specify the model that should be used to generate the final response from a team.

Code

cookbook/examples/teams/structured_input_output/03_team_with_output_model.py
"""
This example shows how to use the output_model parameter to specify the model that should be used to generate the final response.
"""

from agno.agent import Agent
from agno.models.anthropic import Claude
from agno.models.openai import OpenAIChat
from agno.team import Team
from agno.tools.duckduckgo import DuckDuckGoTools

itinerary_planner = Agent(
    name="Itinerary Planner",
    model=Claude(id="claude-sonnet-4-20250514"),
    description="You help people plan amazing vacations. Use the tools at your disposal to find latest information about the destination.",
    tools=[DuckDuckGoTools()],
)

travel_expert = Team(
    model=OpenAIChat(id="gpt-5-mini"),
    members=[itinerary_planner],
    output_model=OpenAIChat(id="gpt-5-mini"),
)

travel_expert.print_response("Plan a summer vacation in Paris", stream=True)

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2

Install required libraries

pip install agno ddgs
3

Set environment variables

export OPENAI_API_KEY=****
export ANTHROPIC_API_KEY=****
4

Run the agent

python cookbook/examples/teams/structured_input_output/03_team_with_output_model.py