Skip to main content
In every execution mode, the leader agent receives auto-injected tools that let it delegate work to members. You do not need to create these tools manually.

Auto-Injected Tools

ModeLeader tools
coordinatedelegate_to_member(member_name, task)
routeroute_to_member(member_name)
collaborateNone (all members execute automatically)
taskscreate_task(title, description, assignee), update_task(task_id, status), list_tasks()

Coordinate Mode

The leader receives member descriptions and decides which ones to involve:
team = Team(
    model="gpt-4o",
    members=[researcher, writer, editor],
    mode=TeamMode.coordinate,
)
  1. Leader sees each member’s name and instructions.
  2. Leader calls delegate_to_member for each selected member.
  3. Each member runs with the delegated task.
  4. Leader synthesizes all responses into a final output.

Route Mode

The leader classifies the request and routes to exactly one member:
team = Team(
    model="gpt-4o",
    members=[tech_support, billing_support, general_support],
    mode=TeamMode.route,
)
  1. Leader sees member descriptions.
  2. Leader calls route_to_member with the best match.
  3. The selected member’s response is returned directly (no synthesis).

Tasks Mode

The leader decomposes work into a task list and delegates autonomously:
team = Team(
    model="gpt-4o",
    members=[researcher, designer, developer],
    mode=TeamMode.tasks,
    max_iterations=10,
)
  1. Leader calls create_task for each subtask.
  2. Leader assigns tasks to members via delegation.
  3. Tasks complete and the leader creates follow-up tasks as needed.
  4. Loop continues until all tasks are done or max_iterations is reached.

Sharing Context

Enable share_member_interactions to pass member responses to subsequent delegations:
team = Team(
    model="gpt-4o",
    members=[researcher, writer],
    mode=TeamMode.coordinate,
    share_member_interactions=True,  # writer sees researcher's output
)
Without this, each member only sees the leader’s delegation message.