Skip to main content

What are Nested Teams

Nested teams let you use a Team as an entity inside another Team. The parent team treats the child team like any other agent — selecting, delegating, or routing to it based on the mode. When called, the child team runs its own full workflow internally. This enables hierarchical multi-agent architectures where specialized departments handle sub-workflows autonomously.

How It Works

  • The entities parameter accepts both Agent and Team instances.
  • Each Team entity exposes name, role, and goal so the parent can reason about it.
  • When the parent calls a child Team, it invokes do_async() on the entire child team — not on individual agents inside it.

Sequential Mode

The parent team selects the best entity for each task. A nested team is selected when its role and goal match the task.

Coordinate Mode

The leader agent delegates tasks to entities including nested teams. The leader holds memory; member entities do not receive it.

Route Mode

The router selects the single best entity — which can be a nested team — to handle the request.

Debugging

Set debug=True on the parent team to see which entity is called in each mode:
This emits [INFO] [Team] log lines showing the entity type, name, task description, tools, and attachments for every call or delegation.