Skip to main content
To build a team, create member agents and compose them under a Team with an execution mode.
content_team.py
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

1

Set up your environment

python3 -m venv .venv
source .venv/bin/activate
2

Install Definable

pip install definable
3

Export your API key

export OPENAI_API_KEY=sk-***
4

Run

python content_team.py

Constructor Reference

name
str
Human-readable team name. Auto-generated if not set.
model
str | Model
Model for the leader agent. Accepts string shorthand ("gpt-4o") or a Model instance.
members
List[Agent | Team]
Agents or nested teams the leader can delegate to.
mode
TeamMode
default:"coordinate"
Execution mode: coordinate, route, collaborate, or tasks.
instructions
str
Instructions for the leader agent.
max_iterations
int
default:"10"
Maximum delegation rounds (relevant for tasks mode).
share_member_interactions
bool
default:"false"
When true, member responses are shared with subsequent delegations.
tools
List[Function]
Additional tools for the leader (on top of auto-injected delegation tools).
output_schema
Type[BaseModel]
Pydantic model for structured output from the leader.
debug
bool
default:"false"
Enable debug logging for team operations.

Next Steps

TaskGuide
Execute and handle team responsesRunning teams
Understand delegation patternsDelegation
Orchestrate with step-based workflowsWorkflows