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

# Building Teams

> Create multi-agent teams with execution modes and delegation.

To build a team, create member agents and compose them under a Team with an execution mode.

```python content_team.py theme={null}
from definable.agent import Agent
from definable.agent.team import Team, TeamMode

researcher = Agent(model="gpt-4o", instructions="You are a research specialist. Find facts and data.")
writer = Agent(model="gpt-4o", instructions="You are a technical writer. Write clear, accurate content.")
editor = Agent(model="gpt-4o", instructions="You are an editor. Polish prose and fix errors.")

team = Team(
    name="content-team",
    model="gpt-4o",
    members=[researcher, writer, editor],
    mode=TeamMode.coordinate,
    instructions="Produce well-researched, polished technical content.",
)

result = await team.arun("Write about the state of AI agents in 2026.")
print(result.content)
```

## Run Your Team

<Steps>
  <Step title="Set up your environment">
    <Snippet file="setup-venv.mdx" />
  </Step>

  <Step title="Install Definable">
    <Snippet file="install-definable.mdx" />
  </Step>

  <Step title="Export your API key">
    <Snippet file="export-openai-key.mdx" />
  </Step>

  <Step title="Run">
    ```bash theme={null}
    python content_team.py
    ```
  </Step>
</Steps>

## Constructor Reference

<ParamField path="name" type="str">
  Human-readable team name. Auto-generated if not set.
</ParamField>

<ParamField path="model" type="str | Model">
  Model for the leader agent. Accepts string shorthand (`"gpt-4o"`) or a Model instance.
</ParamField>

<ParamField path="members" type="List[Agent | Team]">
  Agents or nested teams the leader can delegate to.
</ParamField>

<ParamField path="mode" type="TeamMode" default="coordinate">
  Execution mode: `coordinate`, `route`, `collaborate`, or `tasks`.
</ParamField>

<ParamField path="instructions" type="str">
  Instructions for the leader agent.
</ParamField>

<ParamField path="max_iterations" type="int" default="10">
  Maximum delegation rounds (relevant for `tasks` mode).
</ParamField>

<ParamField path="share_member_interactions" type="bool" default="false">
  When `true`, member responses are shared with subsequent delegations.
</ParamField>

<ParamField path="tools" type="List[Function]">
  Additional tools for the leader (on top of auto-injected delegation tools).
</ParamField>

<ParamField path="output_schema" type="Type[BaseModel]">
  Pydantic model for structured output from the leader.
</ParamField>

<ParamField path="debug" type="bool" default="false">
  Enable debug logging for team operations.
</ParamField>

## Next Steps

| Task                                  | Guide                                 |
| ------------------------------------- | ------------------------------------- |
| Execute and handle team responses     | [Running teams](/teams/running-teams) |
| Understand delegation patterns        | [Delegation](/teams/delegation)       |
| Orchestrate with step-based workflows | [Workflows](/workflows/overview)      |
