Agent Teams
CollaborationTeammates + Mailboxes
When one agent can't finish, delegate to persistent teammates via async mailboxes
s01 > s02 > s03 > s04 > s05 > s06 > s07 > s08 > [ s09 ] s10 > s11 > s12
"When one can't do it all, call for teammates" -- multi-role agents collaborate via mailbox messaging.
Harness layer: Collaboration -- multi-agent communication, specialized division of labor.
Problem
s04's subagents are ephemeral: spawn → work → return → gone. No persistent identity, no conversation, no collaboration. Real teams need: persistent roles, bidirectional messaging, shared context.
Solution
Mailbox system: agents send/receive messages asynchronously. Role agents have persistent context.
Key Code
class Mailbox:
def send(self, from_agent, to_agent, content): ...
def receive(self, agent_name): ...
class RoleAgent:
def __init__(self, name, role_prompt, mailbox): ...
def step(self): ... # Check inbox, reason, send messages
What's New (s04 → s09)
| Component | s04 | s09 |
|---|---|---|
| Lifecycle | Ephemeral | Persistent roles |
| Communication | None (return only) | Bidirectional mailbox |
| Roles | Undifferentiated | Specialized |
Deep Dive
Q1: Why Mailbox not shared messages array?
Async decoupling. Shared array causes context bloat and role confusion.
Q2: How does Orchestrator decide turn order?
Simple: fixed order. Advanced: dynamic scheduling based on inbox state. s10's FSM formalizes this.
Q3: What if agents disagree?
Max discussion rounds. Orchestrator decides or escalates to human.
Q4: Difference from s20?
s09 = multi-role in same process. s20 = multi-process parallel.
Q5: Max number of roles?
2-4 roles optimal. Beyond 5, coordination overhead exceeds specialization benefits.
Try It
cd learn-claude-code
python agents/s09_agent_teams.py
References
- Building Effective Agents: Multi-Agent — Anthropic, Dec 2025.
- Claude Code: Agent Teams — Anthropic Docs.