On this page
- What are Claude Code agent teams?#
- How do you enable and start a team?#
- How do teammates claim work without colliding?#
- What changes when nobody is watching the panel?#
- How do you verify a teammate’s work?#
- What does an agent team cost?#
- When should you not use agent teams?#
- How do you finish and shut down a team?#
- Versions and sources#
curl -s https://jedarden.com/guides/claude-code-agent-teams.md Claude Code agent teams put several coding sessions under one lead. One session becomes the team lead: it spawns named teammates, hands out work, and synthesizes the results. In sessions with the Task tools, it uses a shared task list; otherwise agents coordinate by messages. Each teammate is a full Claude Code instance with its own context window, and teammates message each other directly instead of routing everything through you.
TL;DR — Agent teams are experimental and disabled by default; you enable them with
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, and the documentation’s own advice is to start with 3–5 teammates. There is no documented hard teammate cap; token use grows with the active teammates. The feature as documented assumes a person is watching the panel. I run about twenty coding agents unattended, and the parts of the docs that read as footnotes — task status that can lag, no restoration of in-process teammates on resume, messages between agents treated as untrusted — are the load-bearing walls at that scale. First half of this guide: the feature as Claude Code currently documents it. Second half: what actually changes when the team is big and unsupervised — dispatch, claims, verification, and cost.
Everything in the feature-description half was verified against Claude Code’s agent teams documentation on 2026-11-30. It is an experimental feature and the details move — the page itself calls out behavior changes across point releases — so treat that access date as part of the citation and re-verify anything you build on. The fleet-scale half comes from running about twenty headless coding agents, which I have written up as a failure taxonomy and as an architecture. The short version of that experience: when you run many agents, almost nothing that breaks is the model.
What are Claude Code agent teams?#
Agent teams coordinate multiple Claude Code instances working together. The current documentation names four components:
| Component | What the docs say it does |
|---|---|
| Team lead | Your main session. Spawns teammates, coordinates work, synthesizes results. |
| Teammates | Separate Claude Code instances, each with its own context window, that work on assigned tasks. |
| Task list | Shared work items for agents with the Task tools; others coordinate by messages. |
| Mailbox | Messaging system for communication between agents — one JSON inbox file per agent. |
The division of labor is the point. A subagent does focused work and returns a result to the caller. Named subagents can also message each other now; messaging alone does not identify a team. A teammate stays alive, holds its own context, and coordinates with the other teammates through messages and, where available, the shared task list. The docs’ comparison boils down to: use subagents when only the result matters; use agent teams when the workers need to share findings, challenge each other, and coordinate on their own.
The docs are equally blunt about the price: agent teams add coordination overhead and use significantly more tokens than a single session, because every teammate is a separate instance. Before reaching for a team, they point at two lighter tools — subagents for in-session delegation and cross-session messaging for passing findings between sessions you drive yourself.
The documented sweet spots are tasks where parallel exploration adds value: research and review from independent lenses, new modules where each teammate owns a separate piece, debugging with competing hypotheses, and cross-layer work spanning frontend, backend, and tests. The documented anti-patterns are sequential tasks, same-file edits, and work with many dependencies — all places where coordination cost buys nothing.
A team lifecycle, with a verification gate. This is a schematic of the documented workflow plus my artifact check, not a timing measurement.
| Stage | Boundary |
|---|---|
| Lead sets the boundary | Give each teammate a deliverable, files, evidence requirements, and a stopping point. |
| Teammates work and message | Separate contexts; share findings with peers and the lead. |
| Coordinate available work | With Task tools: shared list and file-locked claims. Without them: messages. Blocked tasks are excluded from self-claiming, but lead/user assignment is still possible. |
| Verify the artifact | Check the actual result before accepting completion; an agent summary is evidence to investigate. |
| Request shutdown | Ask named teammates to stop; requests can take time, and session end cleans up the team configuration. |
How do you enable and start a team?#
Agent teams ship disabled. Enable them with an environment variable or in
settings.json:
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}
Enabling changes ordinary delegation, which surprised me on first read: while
the flag is on, a subagent that Claude names launches as a teammate — so
teams can form even when you asked for a subagent, or didn’t ask for anything
multi-agent at all. Named calls that fork the conversation or pass isolation
on the Agent call remain subagents. Setting the variable to 0 turns the behavior off again,
and per the docs you don’t need to restart the session for that. Spawning
teammates also requires an interactive session: in headless mode (claude -p)
and Agent SDK sessions, Claude never spawns teammates, and a named subagent
stays an ordinary subagent even with the flag on. That single sentence in the
docs rules out most unattended use — more on that below.
Starting a team is a natural-language prompt. For a first run, I would use a read-only review with clear boundaries:
Create an agent team with three teammates named security, performance,
and tests. Review the current change without editing files. Give each
teammate one of those review lenses. Report file locations, evidence, and
uncertainties; reconcile conflicting findings before the final summary.
This is a suggested prompt, not a measured benchmark. Start with a change you can inspect yourself. Claude launches a teammate when it calls the Agent tool with a name while the flag is enabled (subject to the fork and isolation exceptions), without a confirmation prompt. In sessions with the Task tools, it coordinates work through the shared task list. The agent panel also shows ordinary subagents, so a row alone does not prove a team formed.
Two display modes exist. In-process (the default) runs every teammate
inside your terminal, with an agent panel for selecting a teammate, reading
its transcript, and messaging it directly. Split panes gives each teammate
its own tmux or iTerm2 pane; the docs set that with a teammateMode setting
("auto", "tmux", or "iterm2") or a --teammate-mode flag, and note that
the flag is experimental enough not to appear in claude --help. With "auto", split panes open inside tmux or iTerm2 and other terminals
use in-process mode. With tmux installed, forcing "tmux" outside either
terminal opens a separate tmux session; use the displayed View teammates
command to watch it. The default in-process mode works in any terminal.
The panel has its own physics worth knowing before you run a real team: an
idle teammate’s row hides 30 seconds after everything goes idle (the teammate
is still running and addressable), and when more than three teammates are idle
the surplus rows collapse into a single N idle agents row. At three
teammates this is trivia. At ten it is the difference between “the panel is
empty” and “everything is fine” — a small example of the general rule that
fleet UIs are sized for fleets of three.
Check Task-tool availability before relying on that list. Current Claude Code does not provide the task-tracking tools by default on every model. For a team where every worker should have them, the documented settings route is:
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1",
"CLAUDE_CODE_ENABLE_TODO_TOOLS": "1"
}
}
Use settings rather than only exporting the second variable in your shell:
split-pane teammates do not inherit that exported variable, but do receive
the settings environment. An explicit --tools list or deny rule can still
remove individual tools. If you have set CLAUDE_CODE_ENABLE_TASKS=0, clear
that override too: it substitutes TodoWrite for the four Task tools. See the
Task-tool availability reference.
How do teammates claim work without colliding?#
For agents with the Task tools, the shared task list is the coordination surface; others use messages. Tasks have three states — pending, in progress, completed — and can depend on other tasks. The docs are specific about the mechanics:
- Teammates do not self-claim blocked tasks. You or the lead can still explicitly assign one, so dependency edges are not an absolute enforcement barrier. Completing prerequisites unblocks dependents.
- The lead can assign tasks explicitly, or teammates self-claim: after finishing, a teammate picks up the next unassigned, unblocked task.
- Task claiming uses file locking to prevent race conditions when multiple teammates try to claim the same task simultaneously.
That file lock is the right primitive, and it is necessary. It is not sufficient once the team gets bigger or runs longer, because the lock answers exactly one question: when two live teammates race for task 4, who wins. It does not answer the two questions that dominate a fleet’s incident log.
Who reclaims a dead teammate’s claim? The docs’ limitations section
concedes the raw material for this failure: /resume and /rewind do not
restore in-process teammates, and “task status can lag” — teammates sometimes
fail to mark tasks completed, which blocks dependent tasks. So the failure
shape exists in the documented feature: a task stuck in progress, its claimant
gone or silent, dependents blocked. My fleet’s version of this ran for months
before I fixed it — claims outliving their
workers — and the
fix was not a better lock. It was a lease: a claim carries an owner and a
liveness check, and a claim whose owner cannot be reached is reconciled, not
waited on. The state-and-claims section of my orchestration
guide covers
why an abandoned claim is neither done nor available, and the atomic-claims
chapter of the workflow manual shows the
claim protocol that made this boring.
Is the completion real? File locking serializes the claim; the
completion is still a teammate’s self-report. The docs give you an
enforcement point — the TaskCompleted hook, where exit code 2 rejects the
completion and sends feedback — and that is the right place to hang real
verification, which is its own section below.
What changes when nobody is watching the panel?#
The docs ask you to monitor progress, redirect unproductive work, and reconcile the findings. They warn that long unattended runs can waste effort. That is an honest boundary, and it is the exact seam between the documented feature and fleet operation. Four things change when the person leaves the panel.
The spawn prompt is the teammate’s entire world. Teammates load project context — CLAUDE.md, MCP servers, skills — but the docs are explicit that the lead’s conversation history does not carry over. Whatever the teammate needs beyond the repo has to be in the spawn prompt. This is the same rule I learned running replaceable workers: the plan is the prompt — a worker can only reconstruct what was written down for it, so the write-down is the work. A teammate spawned with “review the auth module” inherits your taste for scope only if the prompt carries it.
Launch is not arrival. The docs’ troubleshooting section opens with “teammates not appearing” — which tells you the documented feature already knows a requested teammate may simply not materialize. Scale that up and it becomes my first fleet incident: the fleet you launch is not the fleet you get — fifteen workers requested, fewer actually running, and no error marking the difference. The rule I operate: stagger launches and count what actually started, never what was requested. The docs’ advice to give teammates predictable names helps here; a named teammate you never received is at least auditable.
Failure needs an owner, not a notification. The documented behavior is that an idle teammate notifies the lead, including its final answer — and that a teammate whose turn ended on an API error notifies the lead with the error text. That is the right wiring. But the lead is also a Claude session, and at fleet scale the question becomes: who reads the lead’s inbox at 3 a.m.? In my setup the answer is an outcome handler that classifies each ending — verified completion, agent failure, broken gate, provider outage — because each needs a different response, and a stack of identical “teammate X failed” notifications is not a response. The same goes for retries: unbounded restart of a structurally impossible task is the death loop, so attempts get capped and structural failures get routed to a human instead of back into the queue.
The team topology stays flat. The documented limitations draw the ceiling precisely: one team per session, no nested teams (teammates cannot spawn their own teammates), and a fixed lead that cannot be promoted or transferred. In-process teammates can use foreground subagents, but cannot launch background subagents that outlive the lead. For 3–5 teammates that ceiling is invisible. At twenty workers you are not running a big team — you are running a queue, with teams or sessions as the workers, which is the cattle-not-pets argument in one sentence. The when-orchestration-becomes-necessary section of the hub guide marks the same boundary from the other side: unattended continuation is the threshold where task state has to move out of any session entirely.
Attempts are not deliveries. These are my unattended fleet’s observed outcomes over the 49-day trace period beginning September 12 and ending October 31, 2026. Attribution follows the adapter that actually ran the attempt, rather than the worker’s name. Yield is verified attempts divided by all attempts, including attempts that split a task into smaller work.
| Harness | Attempts | Verified | Yield |
|---|---|---|---|
| Codex CLI | 9,708 | 4,843 | 49.9% |
| Claude Code / Anthropic | 91 | 20 | 22.0% |
| Claude Code / GLM (Z.AI) | 8,302 | 3,303 | 39.8% |
The workloads and sample sizes differ. This is an operational observation, not a controlled model comparison or an agent-teams benchmark. A verified attempt is an outcome recorded by the fleet’s gate; it is not a count of unique tasks. The larger coding-harness study explains the surrounding telemetry.
How do you verify a teammate’s work?#
The documented enforcement points, in one table:
| Hook | Fires when | Exit code 2 does |
|---|---|---|
TaskCompleted | A task is being marked complete | Blocks the completion and sends feedback |
TaskCreated | A task is being created | Blocks the creation and sends feedback |
TeammateIdle | A teammate is about to go idle | Sends feedback and keeps the teammate working |
Task hooks need tasks to act on. Without Task tools, TaskCreated does
not fire; a message-only team is not a substitute completion gate.
TaskCompleted also runs when a teammate ends its turn with in-progress
tasks, so exercise the hook against your actual workflow. Test its failure
path too: with blank stdout, an exit-2 error containing No such file or
can't open is treated as a missing script and does not block completion
or idle. A hook that could not run needs a separate artifact check. See the
hook reference.
Plan mode adds a second gate: a teammate spawned while the lead is in plan mode works read-only until its plan is ready, and the plan approval is auto-approved only if you have not changed that teammate’s permission mode since spawn — otherwise the lead reviews it.
The permission model underneath is the part I’d underline. Teammates start
with the lead’s permission mode (except dontAsk, which they do not inherit),
and --dangerously-skip-permissions propagates to all of them. An in-process
teammate outside plan mode follows the lead’s live acceptEdits, auto, or
bypassPermissions mode even if its own status bar says Manual; switch the
lead to Manual too if you need prompts. Permission prompts bubble to the lead.
Split-pane teammates inherit --tools and --disallowedTools from the lead
on current releases, but not --allowedTools. Put session-wide allow rules
in permissions.allow through --settings when you need them to apply there. And the docs state the trust boundary explicitly:
a teammate cannot approve a permission prompt or supply consent on your behalf,
a denied action cannot be relayed to another teammate to bypass the check, and
in auto mode the classifier treats an approval claim relayed from another agent
as untrusted input. That last rule is word-for-word the lesson of
env-var isolation is not a
defense and trust is a property of the
system: instructions between
agents are traffic, not authority.
Then the gap the docs concede themselves: “task status can lag.” A checkbox is a claim about the artifact, and the claim can be wrong in both directions — done-but-unmarked (which blocks dependents) and marked-but-broken (which ships regressions). So verification has to run against the artifact, not the status field. My operating rules, each earned the expensive way:
- Nobody grades their own homework — the original
lesson. Put the real
check in the
TaskCompletedhook, or run it after the team reports done. The teammate’s “completed” is the trigger for verification, never the verdict. - A gate that could not run is not a gate that passed. The verification section of the hub guide covers why I classify “check didn’t execute” as its own outcome. An exit code you never saw is not a zero.
- Read the diff, not the summary. A teammate’s idle notification includes its final answer — which is a summary. Summaries are for routing attention; verification reads what changed.
What does an agent team cost?#
The docs name the cost model plainly: agent teams use significantly more tokens than a single session, and token usage scales with the number of active teammates, because each has its own context window. Two documented details matter more than the headline:
- An in-process teammate’s requests fall outside the main conversation’s
cache TTL bucket, so its prompt cache holds for five minutes by default.
subagentPromptCacheTtlcan extend that to an hour, and the docs note the one-hour cache writes bill at a higher rate. - The docs’ own break-even: the extra tokens can be worthwhile for research, review, and new feature work ; routine tasks favor one session.
The fleet lens replaces “tokens” with a different unit: cost per verified completed task. Token totals alone hide whether the fleet delivered anything. A low token bill with zero verified results does not establish good economics. An idle worker does not necessarily make API requests, but later resumption can lose a warm cache; active coordination can spend tokens without delivering an artifact. The docs’ starting advice of 3–5 teammates matches what I run into constantly: beyond a handful, coordination overhead and diminishing returns eat the parallelism for discussion-shaped work. Twenty only makes sense with the machinery from the second half of this guide — durable task state, capped retries, independent verification — and with spend measured against verified completed tasks, not panel activity.
A short returned answer can hide a large delegation bill. My Claude Code transcript study through October 31, 2026 found the following in subagent sidechain transcripts. All tokens includes uncached input, cache creation, cache reads, and output; output is generated tokens, not verified code.
| Measure | Observed value |
|---|---|
| All tokens in sidechains | 7.7% |
| Output tokens in sidechains | 1.0% |
| Subagent files | 4,567 |
| Parent sessions | 2,452 |
| Median total tokens / sidechain | 384,492 |
| Median output tokens / sidechain | 348 |
These are subagents across my mixed interactive and headless workload, including different model providers. They are not teammate measurements, a quality score, or a predicted multiplier for your next team. They show why I inspect the whole token mix before inferring cost from the answer’s length. Background and method: the coding-harness study.
When should you not use agent teams?#
Take the docs’ boundary first, because it is correct: sequential tasks, same-file edits, and dependency-heavy work fit a single session or subagents better. Two teammates editing the same file leads to overwrites — the docs’ best-practices section says so in one line. That line deserves amplification, because it is not a product limitation; it is a decomposition rule. Decomposition is concurrency control: if two workers’ tasks touch the same function, no claim protocol will save you — the tasks were cut wrong.
My additions, from the other side of the docs’ boundary:
- Strictly ordered pipelines. Dependency edges guide self-claiming, but explicit assignment can still select a blocked task. A step-by-step pipeline gains nothing from a team. Use one session with a plan.
- Anything you cannot afford to re-verify. Until a real gate exists in
TaskCompleted(or after the team), a team of five is five sources of plausible-sounding completion claims. - Headless automation. Per the docs, teammates only spawn in interactive sessions. Unattended multi-agent work is a queue-and-worker architecture — which is the hub guide’s whole subject — not a very large team.
A useful framing before adopting any of this: the same four requirements from
choosing a control tool
— durable task state, exclusive claims, an explicit failure handler, and
independent verification. Agent teams supply session-scoped task state and file-locked claims
when the Task tools are available, plus hooks and plan approval mechanisms.
The task directory surviving on disk does not restore a team after /resume,
and a plan can be auto-approved; neither is independent artifact verification. The verification — and the budget that bounds it — is still yours.
Team or fleet? Choose the coordination boundary first. This is my operating heuristic, not an Anthropic guarantee or a performance estimate.
| Work shape | Starting choice |
|---|---|
| Headless, unattended, or work must outlive this session | Durable queue and workers; keep ownership, retries, and verification outside any single conversation. |
| Interactive and session-bounded, but ordered or overlapping | One session; sequence the edits before adding concurrency. |
| Interactive, independent tasks with findings to return | Subagents; give each a bounded deliverable. |
| Interactive, independent tasks needing peer discussion | Agent team; start small and reconcile the result. |
How do you finish and shut down a team?#
Give the lead a concrete finish line: each reviewer returns findings with evidence, the lead reconciles disagreements, and the final artifact passes the checks you chose before launch. Then ask the lead to shut down named teammates. A teammate can accept or reject the shutdown request; a running request or tool call can delay its exit.
There is no separate team-cleanup command in the current documentation.
Claude Code removes the session’s team-config directory automatically when
the session ends. The task directory stays on disk subject to
cleanupPeriodDays. Those files are useful records, but they do not restore
in-process teammates after /resume.
The question I now ask is simple: will someone be present to reconcile the result? If yes, a small team can be a useful thinking tool. If no, I need an owner, durable task state, bounded retries, and an independent gate before I add more workers.
Versions and sources#
Versions used (so the next refresh is mechanical):
- Claude Code agent teams documentation — code.claude.com/docs/en/agent-teams — accessed 2026-11-30. Installed CLI: 2.1.332. This is a documentation review, not a live team benchmark. The feature remains experimental and interactive-only for teammate spawning.
- Hooks reference and cross-session messaging — accessed 2026-11-30. Hook gates apply only when the hook actually runs; messaging retains the receiving session’s permission boundaries.
- Split-pane display mode requires tmux, or iTerm2 with the
it2CLI and the iTerm2 Python API enabled. - Fleet-scale claims in the second half are summarized from my own operation of about twenty concurrent headless agents; the incidents are written up with causes and rules in what breaks when you run twenty agents at once, and the surrounding architecture — queues, claims, verification gates, budgets — in agent orchestration in production.
Related reading in this series and nearby: the workflow manual for the full human-driven loop this fleet grew out of, credential boundaries and independent verification for the trust model, and cost per closed task for the economics.
Documentary schematic · no measured durations
- Lead sets the boundary
Name the outcome, assign separate work, and supply the context each teammate needs.
- Teammates work and message
Each teammate has its own context. Messages connect teammates directly.
- Coordinate available work
With Task tools: use the shared task list and file-locked claims. Without Task tools: coordinate through messages.
- Verify the artifact
My operating rule: run the real check before accepting done. TaskCompleted hooks can reject completion with exit code 2.
- Request shutdown
The lead requests shutdown; a teammate may approve or reject it with an explanation.
Blocked tasks are excluded from teammate self-claiming. You or the lead can still assign one explicitly; that guard is not an enforcement boundary.
Feature behavior: Claude Code agent teams documentation. Verification before accepting done is my operating rule.
Observed subagents · July 9–October 31, 2026
Both bars use a 0–100% axis; each share has its own token denominator.
- Subagent files
- 4,567
- Parent sessions
- 2,452
- Median total tokens / sidechain
- 384,492
- Median output tokens / sidechain
- 348
Observed subagent transcripts, not an agent-team benchmark. All tokens include input, cache creation, cache reads, and output. Output share is not a productivity measure; these are different denominators.
Observed fleet · executed adapter view · September 12–October 31, 2026 · 49 days of attempt traces
Attempts share a 0–9,708 scale. Yield shares a separate 0–100% scale.
Observed fleet adapters, not an agent-team benchmark or a randomized model comparison. Workloads and models differ. Anthropic has only 91 attempts. Yield is verified attempts divided by all attempts; splits remain in that denominator. The adapter that executed the work determines attribution.
Choose the coordination shape
A workflow recommendation based on the boundaries in this guide, not a prediction of speed, price, or success.
Keep ordered steps and overlapping edits together. Recut the task before adding parallel workers.