Skip to main content
The Team class enables multiple agents to work together on complex tasks. Teams can operate in different modes, delegate work to members, and coordinate responses.

Constructor

from agno import Agent, Team

researcher = Agent(name="Researcher", role="Research")
writer = Agent(name="Writer", role="Writing")

team = Team(
    members=[researcher, writer],
    model="gpt-4o",
    name="Research Team"
)

Core Parameters

members
List[Agent | Team] | Callable
required
List of agents or teams that make up this team. Can also be a callable factory.
model
Model | str
default:"None"
Language model for the team leader to use for coordination.
name
str
default:"None"
A descriptive name for the team.
id
str
default:"None"
Unique identifier for the team. Auto-generated if not provided.
role
str
default:"None"
If this team is part of another team, this is its role.

Execution Modes

mode
TeamMode
default:"None"
Team execution mode. When set, overrides the boolean flags below.
respond_directly
bool
default:"False"
If True, team leader won’t process member responses and returns them directly.
delegate_to_all_members
bool
default:"False"
If True, delegates the task to all members instead of deciding which to use.
determine_input_for_members
bool
default:"True"
If False, sends the run input directly to member agents.
max_iterations
int
default:"10"
Maximum number of iterations for autonomous task loop (mode=tasks).

Session & State

session_id
str
default:"None"
Default session ID for the team.
session_state
Dict[str, Any]
default:"None"
Session state stored in the database.
add_session_state_to_context
bool
default:"False"
If True, adds session_state to the context.
enable_agentic_state
bool
default:"False"
If True, gives the team tools to update session_state.

History & Memory

add_team_history_to_members
bool
default:"False"
Send team-level history to members.
num_team_history_runs
int
default:"3"
Number of historical runs to include in messages to members.
share_member_interactions
bool
default:"False"
If True, sends all member interactions during current run to delegated members.
add_history_to_context
bool
default:"False"
Adds messages from chat history to the context.
num_history_runs
int
default:"None"
Number of historical runs to include.

Database

db
BaseDb | AsyncBaseDb
default:"None"
Database for storing team sessions and history.
memory_manager
MemoryManager
default:"None"
Memory manager for the team.

Knowledge & Tools

knowledge
KnowledgeProtocol | Callable
default:"None"
Knowledge base for the team.
tools
List[Toolkit | Callable | Function | Dict] | Callable
default:"None"
Tools available to the team leader.
get_member_information_tool
bool
default:"False"
If True, adds a tool to get information about team members.
read_chat_history
bool
default:"False"
If True, adds a tool to read the chat history.

Response Configuration

output_schema
Type[BaseModel] | Dict[str, Any]
default:"None"
Pydantic model or JSON schema for structured output.
stream
bool
default:"None"
Stream the response from the team.
stream_events
bool
default:"None"
Stream intermediate steps.
stream_member_events
bool
default:"True"
Stream events from member agents.
store_member_responses
bool
default:"False"
Store member agent runs inside the team’s RunOutput.

Methods

run()

Run the team with a task.
response = team.run("Research AI trends and write a report")
print(response.content)
Parameters:
  • input (str | List | Dict | Message | BaseModel): The input task
  • stream (bool): Whether to stream the response
  • session_id (str): Optional session ID
  • user_id (str): Optional user ID
Returns: TeamRunOutput or Iterator of events if streaming

arun()

Async version of run().
response = await team.arun("Research and write")
Run the team and print the response to console.
team.print_response("Create a marketing plan")

save()

Save the team configuration.
team.save(db=db, stage="published")

load()

Load a team from the database.
team = Team.load(id="my_team", db=db)

Example Usage

from agno import Agent, Team

researcher = Agent(
    name="Researcher",
    role="Find information",
    instructions="Search and gather information"
)

writer = Agent(
    name="Writer",
    role="Write content",
    instructions="Write clear, engaging content"
)

team = Team(
    members=[researcher, writer],
    model="gpt-4o",
    instructions="Coordinate research and writing tasks"
)

response = team.run("Write about quantum computing")

Build docs developers (and LLMs) love