Home › Rules › Claude Code agent teams
Claude Code agent teams: how to turn them on, what they cost, and agent teams vs subagents
Short answer: agent teams let one Claude Code session (the lead) start several other Claude Code sessions (teammates) that share a task list and message each other. They're experimental and off by default: set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to 1 in your settings or shell, then ask Claude for a team in an interactive session. Anthropic says teams "use significantly more tokens than a single session", so they're worth it for research, review and features that split cleanly, not for routine edits. You don't need tmux; split panes are optional.
Turning on agent teams
Agent teams are disabled until you set one environment variable. Put it in the env block of a settings file (this is Anthropic's example), or export it in your shell:
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}
Free rules starter pack for Cursor, Claude Code, Codex and Antigravity
One shared AGENTS.md that works across Cursor, Claude Code, Codex, Copilot and Antigravity, plus database and test rules in each tool's format. Unzip it into your project and fill in two sections. I'll email you the link.
Free. No spam. Unsubscribe anytime. See our privacy note.
- The variable:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1. The Environment variables page lists it as "experimental and disabled by default". - Interactive sessions only. In
claude -pand Agent SDK sessions, Claude doesn't spawn teammates, even with the flag on. - It changes ordinary delegation too. Claude sometimes gives a subagent a name on its own so it can message it later. With teams on, a subagent Claude names launches as a teammate instead, unless the call is a fork or passes
isolationon the call itself. So a team can form when you didn't ask for one, and Claude Code doesn't ask you to confirm.
Then describe the job and the teammates you want in plain words. If Claude uses subagents instead (they show up in the same agent panel, so the panel alone doesn't prove a team formed), ask again and say "agent team".
What agent teams cost, in Anthropic's words
"Agent teams use significantly more tokens than a single session. Each teammate has its own context window, and token usage scales with the number of active teammates." Anthropic adds: "For research, review, and new feature work, the extra tokens are usually worthwhile. For routine tasks, a single session is more cost-effective." The Manage costs page puts one number on it: "Agent teams use approximately 7x more tokens than standard sessions when teammates run in plan mode." That's Anthropic's figure, not a test of ours.
Anthropic's tips from its Manage costs page:
- Use Sonnet for teammates. Anthropic says it "balances capability and cost for coordination tasks."
- Keep teams small. Token use is "roughly proportional to team size." The Agent teams page suggests 3 to 5 teammates for most jobs, and 3 even if you have 15 independent tasks.
- Keep spawn prompts focused. Teammates load CLAUDE.md, MCP servers and skills on their own, and everything in the spawn prompt adds to their context from the start.
- Shut down teammates when they're done. Each one keeps using tokens until it exits or the session ends.
Caching: an in-process teammate's prompt cache lasts five minutes by default, even on a Claude subscription. Setting subagentPromptCacheTtl to "1h" keeps it for an hour, but the API bills 1-hour cache writes at a higher rate. Plan limits: Claude Pro vs Max vs Ultra.
How a team works
Anthropic's four parts of a team:
| Part | What it does |
|---|---|
| Team lead | Your main session. It spawns teammates, hands out work and pulls the results together. It stays the lead for the whole session. |
| Teammates | Separate Claude Code sessions, each with its own context window, working on their own tasks |
| Task list | Shared work items with three states (pending, in progress, completed). Tasks can wait on other tasks and show as blocked until those are done. |
| Mailbox | Messages between agents, kept as a JSON file per agent under ~/.claude/teams/ |
- What a teammate knows: the same project context as a normal session (CLAUDE.md, MCP servers, skills) plus the lead's spawn prompt. The lead's conversation history doesn't carry over, so put the details in the prompt.
- Tasks: the lead can assign a task to a named teammate, or a teammate that finishes picks up the next unassigned, unblocked task on its own. File locking stops two teammates claiming the same task.
- Messages: teammates message each other by name and messages arrive on their own, so the lead doesn't poll. When a teammate finishes and stops, the lead gets an idle notice with its final answer. To reach everyone, send one message per teammate. Tell the lead what to name each teammate so you can use the names later.
- Models: Claude Code uses the first of these that applies: the model your spawn prompt names, the
modelof a subagent definition you used,CLAUDE_CODE_SUBAGENT_MODEL(if it isn'tinherit), then the lead's model. The oldteammateDefaultModelsetting was removed in v2.1.234 and is ignored. - Reusable roles: name a subagent type when you spawn ("using the security-reviewer agent type") and Claude Code applies parts of that definition, like its tools and model. Its
skillslist isn't applied to teammates. Our subagents examples work as starting roles. - No team file to write: Claude Code keeps the team config under
~/.claude/teams/and overwrites hand edits. A.claude/teams/teams.jsonin your project is just an ordinary file. For reusable roles, use subagent definitions.
In-process or split panes (tmux, iTerm2)
By default every teammate runs in-process, inside your main terminal, and this works in any terminal. Teammates are listed in the agent panel under your prompt: up and down arrows pick one, Enter opens its transcript so you can message it, Escape interrupts it while you're viewing it, x stops it, and Ctrl+T shows or hides the task list.
Split panes give each teammate its own pane, so you can watch them all at once and click into one. They need tmux, or iTerm2 with the it2 CLI and iTerm2's Python API setting turned on. Anthropic notes tmux "traditionally works best on macOS" and suggests tmux -CC in iTerm2. You switch it on with teammateMode:
teammateMode | What happens (Settings reference) |
|---|---|
"in-process" (default) | Teammates run inside your main terminal pane |
"auto" | Split panes when you're running inside tmux, or inside iTerm2 with it2 on your PATH or tmux installed; in-process otherwise |
"tmux" | Split panes using tmux or iTerm2, detected from your terminal. Started outside tmux and iTerm2, the panes open in a separate tmux session; run the command on the View teammates line in a second terminal to watch them |
"iterm2" | iTerm2's own split panes through it2; teammates start only when you run Claude Code in iTerm2 with it2 set up |
For one session, use claude --teammate-mode auto. That flag is experimental and doesn't show in claude --help.
Plans, permissions and quality checks
- Plan first: put the lead in plan mode, then ask for a teammate. The teammate plans first and sends a plan approval request to the lead. If you haven't changed that teammate's permission mode, Claude Code approves the plan as soon as it arrives, without the lead reviewing it.
- Permissions: new teammates start in the lead's permission mode, including
bypassPermissionsif you started with--dangerously-skip-permissions. You can't set a per-teammate mode at spawn time. Teammate permission prompts show up in the lead's session. - Hooks:
TeammateIdleruns when a teammate is about to go idle,TaskCreatedwhen a task is created, andTaskCompletedwhen one is marked done. Exit with code 2 to send feedback and keep the teammate working, or to block the task. Copy-paste hook scripts: Claude Code hooks examples.
Agent teams vs subagents vs workflows
Built from Anthropic's two comparison tables (Agent teams page and Dynamic workflows page), shortened:
| Subagents | Agent teams | Workflows | |
|---|---|---|---|
| What it is | A worker Claude spawns inside your session | A lead agent supervising peer sessions | A script the runtime runs |
| Who decides what runs next | Claude, turn by turn | The lead agent, turn by turn | The script |
| How they talk | Return a result to the caller (named subagents can also message each other) | Teammates message each other directly; you can message any teammate | Results stay in script variables; only the answer reaches your chat |
| Where results live | Claude's context window | A shared task list | Script variables |
| Scale | A few delegated tasks per turn | A handful of long-running peers | Dozens to hundreds of agents per run |
| Token cost | Lower: results summarized back | Higher: each teammate is a separate Claude instance | A single run can use "meaningfully more tokens" |
| Best for | Focused jobs where only the result matters | Work that needs discussion: research, review, competing theories, features split by layer | Sweeps, big migrations, cross-checked research you want to rerun |
| Status | Standard | Experimental, off by default | See our workflows page |
Anthropic's own advice is to check whether a lighter option does the job before you set up a team, and that sequential tasks, edits to the same file, or work with many dependencies go better in one session or with subagents. More on each: Claude Code subagents examples and Claude Code workflows. All five ways side by side, plus agent view and worktrees: Claude Code multi-agent setup.
Matching kit: MVP Spec-to-Build Pack ($7)
The free rules set the boundaries. The MVP pack gives you the build order: a 1-page spec to fill in first, then 7 prompts in sequence (skeleton, review, login, database, security, one feature at a time, polish), plus a "did I leak user data?" checklist.
See the MVP Spec-to-Build Pack ($7) →
Instant download. 7-day refund, no questions asked.
Our setup: a small team with clear lanes
One user settings file that turns teams on and opens split panes when you happen to be in tmux or iTerm2 (and stays in-process everywhere else):
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
},
"teammateMode": "auto"
}
Teammates read CLAUDE.md like any session, so house rules for teams can live there. This block follows the practices on Anthropic's Agent teams and Manage costs pages: small teams, Sonnet teammates, separate files, full context in the spawn prompt, and shutting teammates down.
## Agent teams
- Only start a team when I ask for one. For a quick side job, use a subagent.
- Start with 3 teammates unless I give a number. Give each one a short name I can type.
- Run teammates on Sonnet unless I name another model.
- Each teammate owns its own files. Never have two teammates edit the same file.
- Put the file paths, the goal and what "done" means in every spawn prompt; teammates don't see this chat.
- Wait for teammates to finish their tasks before you start the same work yourself.
- When a teammate's work is done, ask it to shut down. Before you tell me the job is done, check the task list for anything still open.
And three prompts to start with. Anthropic suggests a first team on work with clear lanes that doesn't write code, like a review, so prompt 1 is the place to begin:
# 1. Review only, no code changes (a good first team)
Create an agent team to review the changes on this branch. Spawn three teammates
on Sonnet named sec, perf and tests: sec looks for security problems, perf for
slow code, tests for missing or weak tests. Don't edit any files. Each one reports
its findings with file and line, then you merge them into one list, worst first.
# 2. A bug with more than one possible cause
Create an agent team to find why the signup form sometimes saves twice. Spawn
three teammates, each testing a different theory: the button, the API route, the
database write. Have them message each other and try to rule out each other's
theory. Only change code after they agree on the cause.
# 3. A feature split by files
Create an agent team for the new settings page. Spawn three teammates on Sonnet:
ui owns src/pages/settings/, api owns src/api/settings/, tests owns tests/settings/.
Nobody edits files outside their folder. Wait for all three before you report back.
No CLAUDE.md yet? Copy one from our CLAUDE.md examples or make one with the free rules generator.
Known limits (experimental)
- No resume for in-process teammates.
/resumeand/rewinddon't bring them back. If the lead tries to message teammates that are gone, tell it to spawn new ones. - Task status can lag. A teammate sometimes doesn't mark its task completed, which blocks tasks that depend on it. Check whether the work is done, then update the task or have the lead nudge the teammate.
- Shutdown can be slow. A teammate finishes its current request or tool call first.
- One team per session, no nested teams, and the lead is fixed. Teammates can't spawn their own teammates or become the lead.
- No background subagents from in-process teammates. Their subagents run in the foreground, and a definition with
background: truereturns an error.
Turning agent teams off
Set the same variable to 0 in the env block of your user settings.json. You don't need a new session: Claude Code reapplies settings-file env values when you save, and the next subagent Claude names launches as a normal subagent. A 0 in user settings beats a shell export, but a project, local or --settings file that sets it to 1 still wins, and so do managed settings (ask your admin). To end one teammate instead, ask the lead: "ask the researcher teammate to shut down". The teammate can approve and exit, or refuse and say why.
Agent teams not working: 8 things to check
- Nothing happens when you ask for a team. Check the flag is
1and that you're in an interactive session, notclaude -por the Agent SDK. Claude also decides whether a task is big enough for a team. - You got subagents, not teammates. They share the agent panel. Ask again and say "agent team".
- You got teammates, not subagents. With the flag on, a subagent Claude names starts as a teammate. Set the flag to
0(see above). - A teammate vanished from the panel. Idle rows hide 30 seconds after the whole panel goes idle, and more than three idle teammates collapse into one
N idle agentsrow (Enter expands it). The teammate is still running; message it by name. - No split panes. Run
which tmuxto check tmux is on your PATH. For iTerm2, checkit2is installed and the Python API is on. With"auto", you have to startclaudeinside tmux or iTerm2. An unrecognizedteammateModevalue is skipped; since v2.1.325,claude doctorand the startup warning list it. - Too many permission prompts. Teammate prompts go to the lead. Pre-approve common commands in your permission settings before you spawn. For split-pane teammates,
--allowedToolsisn't passed on; put the rules underpermissions.allowin--settingsinstead. - A teammate or the lead stops early. Open the teammate and give it more instructions, or spawn a replacement. If the lead starts doing the work itself, tell it: "Wait for your teammates to complete their tasks before proceeding". If it calls the job finished too soon, tell it to keep going.
- A tmux session is left behind. Run
tmux ls, thentmux kill-session -t <session-name>for the team's session.
FAQ
How do I turn on agent teams in Claude Code?
Set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to 1 in your shell or in the env block of settings.json (it's experimental and off by default), then ask Claude for a team in an interactive session.
Do agent teams cost more than subagents?
Yes. In Anthropic's comparison, teams cost more tokens than subagents: every teammate runs as its own Claude instance with its own context window, so usage grows with each active teammate.
What is the difference between agent teams and subagents?
A subagent does a job inside your session and sends its result back to the main agent. Agent team teammates are separate Claude Code sessions that share a task list, claim work, and message each other directly, and you can talk to any teammate yourself.
Do I need tmux for Claude Code agent teams?
No. The default in-process mode runs every teammate inside your main terminal and works in any terminal. tmux, or iTerm2 with the it2 CLI, is only needed if you want each teammate in its own split pane, which you turn on with the teammateMode setting.
How do I stop Claude from starting teammates instead of subagents?
Set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to 0 in the env block of your user settings.json. It applies when you save, but a project, local, --settings or managed setting of 1 still wins.
Related setups
A team sits on top of the rest of a Claude Code setup. Put your project rules in CLAUDE.md, define reusable roles as subagents, pick models on Claude Code models, and use workflows when the job is too big for a handful of teammates. Want a stronger model to check one session's hard decisions instead? See the Claude Code advisor.
Next step for Claude Code: Agent Skills
Skills are folders your AI coding agent loads only when the job comes up, and Claude Code, Cursor and OpenAI Codex all read the same SKILL.md format. The Vibe Coder Skills Pack ($9) is 6 ready-to-copy SKILL.md skills (fix-one-bug, stop-the-loop, leak-check, ship-check, explain-project, builder-handoff) for Claude Code, Cursor and OpenAI Codex. Also included in the 6-kit bundle.
Get the Skills Pack for $9 on Gumroad → See what's inside
One .zip of skill folders plus one markdown file. 7-day refund, no questions asked.
Best value
All 6 kits for $29 — or $20.30 with code WELCOME30 (through Nov 30)
A team splits one job across several Claude sessions. The kits give your AI the plan for a whole project, step by step: a small game, a Discord bot, an email-triage agent, an MVP, or a cleanup of messy code.
Get all 6 kits for $29 → See what's in each kit
$29 instead of $48 for the six kits bought separately; WELCOME30 takes 30% off that at checkout ($20.30). Instant download from Gumroad. 7-day refund, no questions asked.
Related
- Claude Code subagents examples (7 copy-paste subagents)
- Claude Code workflows (/deep-research, saving a workflow, workflows vs skills)
- Claude Code multi-agent setup (subagents vs agent view vs teams vs workflows, worktrees)
- Claude Code advisor (/advisor, which model can advise which, cost)
- Claude Code hooks examples (7 copy-paste hooks)
- Claude Code models (full list, aliases, /model, opusplan, effort)
- Claude Pro vs Max vs Ultra (which plan for Claude Code)
- CLAUDE.md examples (copy-paste template)
- Free rules file generator
Sources
- Claude Code docs: Orchestrate teams of Claude Code sessions (agent teams)
- Claude Code docs: Manage costs effectively (agent team token costs)
- Claude Code docs: Settings reference (teammateMode, subagentPromptCacheTtl)
- Claude Code docs: Environment variables (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS)
- Claude Code docs: Create custom subagents
- Claude Code docs: Dynamic workflows (comparison table)
- Claude Code docs: Hooks reference (TeammateIdle, TaskCreated, TaskCompleted)
- Claude Code docs: Changelog
Every setting, key, limit and version number here was checked Nov 14, 2026 on Anthropic's own Claude Code docs. Agent teams are experimental and the Agent teams page changes often (its split-pane steps were rewritten between Nov 13 and Nov 14), so run claude --version and check that page if something looks different. If something here no longer matches, tell us at [email protected].