> ## Documentation Index
> Fetch the complete documentation index at: https://spacesail.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Building Teams

> Learn how to build Teams with Agno.

To build effective teams, start simple -- just a model, members, and instructions. Once that works, layer in more functionality as needed.

Here's the simplest possible team with specialized agents:

```python news_weather_team.py lines theme={null}
from agno.team import Team
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools

# Create specialized agents
news_agent = Agent(
    id="news-agent",
    name="News Agent", 
    role="Get the latest news and provide summaries",
    tools=[DuckDuckGoTools()]
)

weather_agent = Agent(
    id="weather-agent",
    name="Weather Agent", 
    role="Get weather information and forecasts",
    tools=[DuckDuckGoTools()]
)

# Create the team
team = Team(
    name="News and Weather Team",
    members=[news_agent, weather_agent],
    model=OpenAIChat(id="gpt-4o"),
    instructions="Coordinate with team members to provide comprehensive information. Delegate tasks based on the user's request."
)

team.print_response("What's the latest news and weather in Tokyo?", stream=True)
```

<Tip>
  It is recommended to specify the `id`, `name` and the `role` fields of each team member, for better identification by the team leader.
  The `id` is used to identify the team member in the team and in the team leader's context.
</Tip>

<Note>
  Team members inherit their `model` from their parent team if not specified. Members with an explicitly assigned `model` retain their own. In nested team structures, inheritance always happens from the direct parent.
  Teams without a defined model default to OpenAI `gpt-4o`.

  The `reasoning_model`, `parser_model`, and `output_model` must be explicitly defined for each team or team member.

  See the [model inheritance example](/examples/concepts/teams/basic/model_inheritance).
</Note>

## Run your Team

When running your team, use the `Team.print_response()` method to print the response in the terminal.

For example:

```python theme={null}
team.print_response("What's the latest news and weather in Tokyo?")
```

This is only for development purposes and not recommended for production use. In production, use the `Team.run()` or `Team.arun()` methods. For example:

```python theme={null}
from typing import Iterator
from agno.team import Team
from agno.agent import Agent
from agno.run.team import TeamRunOutputEvent
from agno.models.openai import OpenAIChat
from agno.utils.pprint import pprint_run_response

news_agent = Agent(name="News Agent", role="Get the latest news")
weather_agent = Agent(name="Weather Agent", role="Get the weather for the next 7 days")

team = Team(
    name="News and Weather Team", 
    members=[news_agent, weather_agent],
    model=OpenAIChat(id="gpt-4o")
)

# Run team and return the response as a variable
response = team.run("What is the weather in Tokyo?")
# Print the response
print(response.content)

################ STREAM RESPONSE #################
stream: Iterator[TeamRunOutputEvent] = team.run("What is the weather in Tokyo?", stream=True)
for chunk in stream:
    if chunk.event == "TeamRunContent":
        print(chunk.content)

# ################ STREAM AND PRETTY PRINT #################
stream: Iterator[TeamRunOutputEvent] = team.run("What is the weather in Tokyo?", stream=True)
pprint_run_response(stream, markdown=True)
```

### Modify what is show on the terminal

When using `print_response`, only the team tool calls (typically all of the delegation to members) are printed. If you want to print the responses from the members, you can use the `show_members_responses` parameter.

```python theme={null}
team.print_response("What is the weather in Tokyo?", show_members_responses=True)
```

## Next Steps

Next, continue building your team by adding functionality as needed. Common questions:

* **How do I run my team?** -> See the [running teams](/concepts/teams/running-teams) documentation.
* **How do I manage sessions?** -> See the [team sessions](/concepts/teams/sessions) documentation.
* **How do I manage input and capture output?** -> See the [input and output](/concepts/teams/input-output) documentation.
* **How do I give the team context?** -> See the [context engineering](/concepts/teams/context) documentation.
* **How do I add knowledge?** -> See the [knowledge](/concepts/teams/knowledge) documentation.
* **How do I add guardrails?** -> See the [guardrails](/concepts/teams/guardrails) documentation.
* **How do I cache responses during development?** -> See the [response caching](/concepts/models/cache-response) documentation.

## Developer Resources

* View the [Team reference](/reference/teams/team)
* View [Team Cookbook](https://github.com/agno-agi/agno/tree/main/cookbook/teams/README.md)
