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

# Delegation

> Control how the team leader delegates tasks to members.

When you call `run()` on a team, the leader decides how to handle the request: respond directly, use tools, or delegate to members.

<img className="block dark:hidden" src="https://mintcdn.com/agno-v2-studio-tools-doc/NCEcK4D9Psa3QW_5/images/teams/team-delegate-light.png?fit=max&auto=format&n=NCEcK4D9Psa3QW_5&q=85&s=1624a1a7794b09ecc2b40d46e465b935" alt="Team delegation flow" width="4353" height="1233" data-path="images/teams/team-delegate-light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/agno-v2-studio-tools-doc/NCEcK4D9Psa3QW_5/images/teams/team-delegate-dark.png?fit=max&auto=format&n=NCEcK4D9Psa3QW_5&q=85&s=280aea192c16bff04480e71d3af90264" alt="Team delegation flow" width="4353" height="1233" data-path="images/teams/team-delegate-dark.png" />

The default flow:

1. Team receives user input
2. Leader analyzes the input and decides which members to delegate to
3. Leader formulates a task for each selected member
4. Members execute and return results (concurrently in async mode)
5. Leader synthesizes results into a final response

Modes define whether the leader delegates, routes to one member, broadcasts to all members, or runs a task loop.
Modes are explicit orchestration patterns you can swap without changing member logic.
Members can also be provided by callable factories and resolved at run time. See [Callable Factories](/teams/overview#callable-factories).

You can customize this flow with team modes:

| Mode                     | Configuration                               | Behavior                                                                 |
| ------------------------ | ------------------------------------------- | ------------------------------------------------------------------------ |
| **Coordinate** (default) | `mode=TeamMode.coordinate` (or omit `mode`) | Leader selects members, formulates tasks, synthesizes results            |
| **Route**                | `mode=TeamMode.route`                       | Leader routes to one member and returns their response directly          |
| **Broadcast**            | `mode=TeamMode.broadcast`                   | Leader delegates the same task to all members simultaneously             |
| **Tasks**                | `mode=TeamMode.tasks`                       | Leader builds and executes a shared task list until the goal is complete |

Use `TeamMode` from `agno.team.mode` to set the mode explicitly. The legacy flags still work, but `mode` is the recommended approach.

Member selection and run tracking use member IDs. Set explicit `id` values on members for stable delegation identity.

## Coordinate Mode (Default)

The leader controls everything: which members to use, what task to give them, and how to combine their outputs.

```python theme={null}
from agno.team import Team
from agno.agent import Agent
from agno.team.mode import TeamMode
from agno.models.openai import OpenAIResponses
from agno.tools.hackernews import HackerNewsTools
from agno.tools.yfinance import YFinanceTools

team = Team(
    name="Research Team",
    model=OpenAIResponses(id="gpt-4o"),
    members=[
        Agent(name="News Agent", role="Get tech news", tools=[HackerNewsTools()]),
        Agent(name="Finance Agent", role="Get stock data", tools=[YFinanceTools()])
    ],
    mode=TeamMode.coordinate,
    instructions="Research the topic thoroughly, then synthesize findings into a clear report."
)

team.print_response("What's happening with AI companies and their stock prices?")
```

Use this when:

* Tasks need decomposition into subtasks
* You want quality control over the final output
* The leader should add context or reasoning to member outputs

## Route Mode

The leader selects which member handles the request and returns the member's response directly. By default the leader can still craft the task; set `determine_input_for_members=False` to pass the user input through unchanged.

<img className="block dark:hidden" src="https://mintcdn.com/agno-v2-studio-tools-doc/NCEcK4D9Psa3QW_5/images/teams/team-passthrough-light.png?fit=max&auto=format&n=NCEcK4D9Psa3QW_5&q=85&s=574e1191c0cc86eb08118aa295959486" alt="Route mode flow" width="3609" height="906" data-path="images/teams/team-passthrough-light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/agno-v2-studio-tools-doc/NCEcK4D9Psa3QW_5/images/teams/team-passthrough-dark.png?fit=max&auto=format&n=NCEcK4D9Psa3QW_5&q=85&s=84e867c2575813017082babaf1b991a1" alt="Route mode flow" width="3609" height="906" data-path="images/teams/team-passthrough-dark.png" />

```python theme={null}
from agno.team import Team
from agno.agent import Agent
from agno.team.mode import TeamMode
from agno.models.openai import OpenAIResponses

team = Team(
    name="Language Router",
    model=OpenAIResponses(id="gpt-4o"),
    members=[
        Agent(name="English Agent", role="Answer questions in English"),
        Agent(name="Japanese Agent", role="Answer questions in Japanese"),
    ],
    mode=TeamMode.route,
    determine_input_for_members=False # Pass user input unchanged to member
)

team.print_response("How are you?")        # Routes to English Agent
team.print_response("お元気ですか?")        # Routes to Japanese Agent
```

Use this when:

* You have specialized agents and want automatic routing
* The leader shouldn't modify the request or response
* You want lower latency (no synthesis step)

### Legacy Configuration Flags

These flags still work, but are overridden by `mode` when set.

**`respond_directly=True`**: Return member responses without leader synthesis (maps to `TeamMode.route`).

<img className="block dark:hidden" src="https://mintcdn.com/agno-v2-studio-tools-doc/NCEcK4D9Psa3QW_5/images/teams/team-direct-response-light.png?fit=max&auto=format&n=NCEcK4D9Psa3QW_5&q=85&s=6505726e40289d3dfaf272149d3d3643" alt="Direct response flow" width="3741" height="906" data-path="images/teams/team-direct-response-light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/agno-v2-studio-tools-doc/NCEcK4D9Psa3QW_5/images/teams/team-direct-response-dark.png?fit=max&auto=format&n=NCEcK4D9Psa3QW_5&q=85&s=984d14e8bdf92a50aa958efae35f3404" alt="Direct response flow" width="3741" height="906" data-path="images/teams/team-direct-response-dark.png" />

**`determine_input_for_members=False`**: Send user input directly to members instead of having the leader formulate a task (works with any mode).

<img className="block dark:hidden" src="https://mintcdn.com/agno-v2-studio-tools-doc/NCEcK4D9Psa3QW_5/images/teams/team-raw-input-light.png?fit=max&auto=format&n=NCEcK4D9Psa3QW_5&q=85&s=dfca35674bc6ba501353f895faa5a515" alt="Raw input flow" width="4896" height="906" data-path="images/teams/team-raw-input-light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/agno-v2-studio-tools-doc/NCEcK4D9Psa3QW_5/images/teams/team-raw-input-dark.png?fit=max&auto=format&n=NCEcK4D9Psa3QW_5&q=85&s=674a5365875660c8879042e25efffe11" alt="Raw input flow" width="4896" height="906" data-path="images/teams/team-raw-input-dark.png" />

Combine both for a full passthrough:

```python theme={null}
team = Team(
    respond_directly=True,
    determine_input_for_members=False,
    ...
)
```

## Broadcast Mode

The leader delegates to all members at once. Useful for gathering multiple perspectives or parallel research.

<img className="block dark:hidden" src="https://mintcdn.com/agno-v2-studio-tools-doc/NCEcK4D9Psa3QW_5/images/teams/team-delegate-to-all-members-light.png?fit=max&auto=format&n=NCEcK4D9Psa3QW_5&q=85&s=59474713363f55639085a27193ed2a36" alt="Broadcast mode flow" width="3699" height="906" data-path="images/teams/team-delegate-to-all-members-light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/agno-v2-studio-tools-doc/NCEcK4D9Psa3QW_5/images/teams/team-delegate-to-all-members-dark.png?fit=max&auto=format&n=NCEcK4D9Psa3QW_5&q=85&s=29b26d563123f8bf9296a51b4d5fab6a" alt="Broadcast mode flow" width="3699" height="906" data-path="images/teams/team-delegate-to-all-members-dark.png" />

```python theme={null}
import asyncio
from agno.team import Team
from agno.agent import Agent
from agno.team.mode import TeamMode
from agno.models.openai import OpenAIResponses
from agno.tools.hackernews import HackerNewsTools
from agno.tools.arxiv import ArxivTools
from agno.tools.duckduckgo import DuckDuckGoTools

team = Team(
    name="Research Team",
    model=OpenAIResponses(id="gpt-4o"),
    members=[
        Agent(name="HackerNews Researcher", role="Find discussions on HackerNews", tools=[HackerNewsTools()]),
        Agent(name="Academic Researcher", role="Find academic papers", tools=[ArxivTools()]),
        Agent(name="Web Researcher", role="Search the web", tools=[DuckDuckGoTools()]),
    ],
    mode=TeamMode.broadcast,
    instructions="Synthesize findings from all researchers into a comprehensive report."
)

# Use async for concurrent execution
asyncio.run(team.aprint_response("Research the current state of AI agents"))
```

Use this when:

* You want multiple perspectives on the same topic
* Members can work independently
* Parallel execution improves latency

<Note>
  If both `delegate_to_all_members=True` and `respond_directly=True` are set, broadcast wins and `respond_directly` is disabled.
</Note>

## Tasks Mode

Tasks mode is an autonomous loop where the leader decomposes the goal into tasks, executes them, and marks the goal complete.

```python theme={null}
from agno.team import Team
from agno.agent import Agent
from agno.team.mode import TeamMode
from agno.models.openai import OpenAIResponses

team = Team(
    name="Ops Team",
    model=OpenAIResponses(id="gpt-4o"),
    members=[
        Agent(name="Research Agent", role="Collect findings"),
        Agent(name="Writer Agent", role="Draft the final report"),
    ],
    mode=TeamMode.tasks,
    max_iterations=6
)

team.print_response("Compile a short report on recent AI agent frameworks.")
```

## Structured Input

When using `determine_input_for_members=False`, you can pass structured Pydantic models directly to members:

```python theme={null}
from pydantic import BaseModel, Field
from agno.team import Team
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.hackernews import HackerNewsTools

class ResearchRequest(BaseModel):
    topic: str
    num_sources: int = Field(default=5)

research_agent = Agent(
    name="Research Agent",
    role="Research topics on HackerNews",
    tools=[HackerNewsTools()]
)

team = Team(
    name="Research Team",
    model=OpenAIResponses(id="gpt-4o"),
    members=[research_agent],
    determine_input_for_members=False  # Pass input directly to member
)

request = ResearchRequest(topic="AI Agents", num_sources=10)
team.print_response(input=request)
```

## Production Considerations

### Token Costs

Each mode has different token overhead:

| Mode       | Coordination Cost                | When to Use                              |
| ---------- | -------------------------------- | ---------------------------------------- |
| Coordinate | High (decomposition + synthesis) | Quality matters more than cost           |
| Route      | Low (selection only)             | Simple routing, cost-sensitive           |
| Broadcast  | Medium (synthesis only)          | Parallel research, multiple perspectives |
| Tasks      | High (planning + iterative loop) | Multi-step goals with dependencies       |

### Latency

* **Coordinate**: Sequential (leader thinks → members execute → leader synthesizes)
* **Route**: Fast (leader selects → member executes)
* **Broadcast with async**: Parallel member execution, but synthesis adds latency
* **Tasks**: Iterative; multiple cycles until tasks are complete or `max_iterations` is reached

### Error Handling

What happens when a member fails?

* **Coordinate**: Leader can work with partial results from other members
* **Route**: Failure is returned directly to caller
* **Broadcast**: Leader synthesizes available results, may note missing data
* **Tasks**: Task list tracks failed/blocked tasks; the leader can retry or reassign until completion

## Developer Resources

* [Team reference](/reference/teams/team)
* [Team examples](/cookbook/teams/overview)
