Home › Rules › Claude Code multi-agent
Claude Code multi-agent setup: subagents, agent view, agent teams, workflows and Projects, and which one to use
Short answer: Claude Code can work on several things at once in five ways. Subagents are helpers inside your session. Agent view (claude agents) lets you start background sessions and watch them all on one screen. Agent teams have a lead session that hands out work to teammates. Dynamic workflows run a script that starts many subagents and checks their results against each other. Projects start parallel sessions in the cloud from one conversation. Pick by who should run the show: Claude inside one chat (subagents), you (agent view), a lead Claude (teams), a script (workflows), or a long-running cloud conversation (Projects). If parallel agents edit the same repo, give each one its own git worktree. Every one of these uses more of your plan than a single session.
We already have full pages on three of these: subagents (with 7 to copy), agent teams and workflows. This page puts all five side by side and covers the parts those pages don't: agent view, worktrees, sessions messaging each other, and the commands that tie them together.
The five ways, side by side
Anthropic's "Run agents in parallel" page names these five. The table is our summary of it plus each feature's own page:
| Approach | Who runs it | Where it runs | Can workers talk? | Status | Start it with |
|---|---|---|---|---|---|
| Subagents | Claude, inside one conversation | Your session | They report back to the session that started them | Standard | Ask for one, or /subtask for a fork |
| Agent view | You: you start each session and check back | Your machine, in the background | Report to you; Claude can message them with cross-session messaging | Research preview | claude agents or claude --bg |
| Agent teams | A lead Claude session | Your machine (or inside a cloud session) | Teammates message each other directly | Experimental, off by default | CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, then ask for a team |
| Dynamic workflows | A script Claude writes, which you can rerun | Your session, in the background | Results stay in the script; only the answer reaches you | See our workflows page | A bundled workflow such as /deep-research, or ask for a workflow |
| Projects | Claude, in one ongoing conversation | The cloud (or your computer through Remote Control) | Threads report to the project conversation | Public beta on Pro, Max and Ultra | claude.ai/code or the desktop app |
Three more things help but aren't a way to run agents on their own: worktrees (a separate git checkout per session), cross-session messaging (Claude passes notes between your sessions) and /batch (a built-in skill that splits one big change into 5 to 30 subagents, each in its own worktree). A background shell command, a forked subagent and a cloud scheduled task also run without you, but Anthropic says they solve a different problem.
Which one should I use?
Anthropic boils the choice down to three questions. Here they are in plain words, with what we'd pick:
- Who should coordinate? Claude, inside the chat you're in: subagents. You, handing off separate jobs and checking back: agent view. A lead Claude that plans, assigns and supervises: agent teams. A script, so the plan is fixed and repeatable: workflows. Claude, over days or weeks, even with your computer off: Projects.
- Do the workers need to talk to each other? Subagents report to the session that started them. Agent view sessions report to you, though Claude can pass messages between them. Only agent teams are built for workers to talk among themselves, with one shared list of tasks.
- Will they edit the same files? Use worktrees. Subagents and sessions you run yourself can each get one, and sessions you start from agent view move into one before they edit. Agent teams don't use worktrees, so split the work so each teammate owns different files.
Pick this if:
- You want a quick side job without cluttering the chat (run the tests, search the logs): a subagent.
- You have three unrelated jobs (a bug fix, a README update, a review): three background sessions in agent view.
- One job splits into parts that need to agree (front end, back end and tests for one feature; competing theories about a bug): an agent team.
- The same check across hundreds of files, or research you want cross-checked: a workflow, or
/batchfor one big code change. - A goal that keeps producing tasks for weeks (one lint rule across every repo): a Project.
If you're new to this, start with subagents. They need no setup, and Anthropic's own advice for teams is to begin with research and review jobs that don't write code.
How many agents can run at once?
| Approach | Limit Anthropic gives | Change it with |
|---|---|---|
| Subagents | 20 running in one session by default; no limit on the total over a session. Subagents can start their own, up to 3 layers deep | CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS (needs v2.1.217+); CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH (1 turns nesting off) |
| Agent view | No cap given. Each session uses your plan on its own | n/a |
| Agent teams | No hard limit; Anthropic suggests 3 to 5 teammates, one team per session, no nested teams | Ask the lead for a number |
| Dynamic workflows | 16 agents at once by default (fewer on machines with fewer CPUs), 1,000 agents per run; a "Large workflow" warning past 25 agents or 1.5 million projected tokens | CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS, 1 to 256 (needs v2.1.269+) |
/batch | Splits the change into 5 to 30 units, one background subagent each | n/a |
| Projects | No fixed number of running threads; 500 new threads per day across your projects | Ask Claude in the project to run fewer at a time |
The subagent cap counts only subagents Claude starts with its Agent tool. Workflow agents and teammates follow their own limits, and sessions with ultracode on skip the subagent cap.
What it costs, in Anthropic's words
There's no separate price for any of this. It all comes out of the same plan or API usage, just faster:
- In general: "Running several sessions or subagents at once multiplies token usage."
- Agent view: background sessions use your plan like normal ones, "so running ten agents in parallel uses quota roughly ten times as fast as running one." The one-line summary on each row is written by a Haiku-class model, one short request each time.
- Subagents: each one "spends tokens of its own while it runs", and a lot of detailed results coming back can fill your main chat. Anthropic's fix is a smaller model for simple subagents (
model: haiku). A fork reuses the main chat's prompt cache, so it "costs less than a fresh subagent" for jobs that need the same background. - Agent teams: about "7x more tokens" than a standard session when teammates are in plan mode (costs page). Use Sonnet for teammates, keep teams small, and shut teammates down when they're done.
- Workflows: one run can use "meaningfully more tokens" than doing the same job in the chat. Try it on one folder first, and watch per-agent usage in
/workflows. - Projects: uses the same plan limits "and uses them faster"; on Pro "expect to reach your limit sooner on days you run one". A thread watching a pull request wakes up and uses your plan again when CI fails or a review comment arrives.
Run /usage to see where your usage goes; Anthropic's breakdown shows the share that went to subagents. Plan limits by tier are on Claude Pro vs Max vs Ultra.
Agent view: background sessions on one screen
Agent view is the part none of our other pages cover, and it's what most "parallel agents" and "background agents" searches are about. It was added in Claude Code 2.1.139 (May 11, 2026) as a research preview, so keys and screens may still change.
- Open it: run
claude agentsin your project folder. You'll get the workspace trust prompt first if you haven't trusted that folder. - Start a session: type a task at the bottom and press Enter. Every prompt starts a new session; it doesn't send a follow-up to the last one. Each row shows Working, Needs input, Idle, Completed, Failed or Stopped.
- Peek and reply: select a row and press Space to see the latest output or the question it's stuck on, and reply without leaving the list.
- Attach: press Enter or → on a row to open the full conversation. Press ← on an empty prompt to go back to the list.
- Move a running chat into the background: run
/bg(or press ← on an empty prompt) in a normal session./forksends a copy to the background and keeps you working in the original.
You can also start sessions straight from your shell. The --bg flag goes first and the prompt is a normal argument (not -p, which Claude Code rejects with --bg). Add --agent <name> to run one of your subagents as the session's main agent.
# From your project folder: start three background sessions
claude --bg "fix the failing login test and open a draft PR"
claude --bg "update the README install steps to match package.json"
claude --agent code-reviewer --bg "review this branch, don't edit files"
# (the last one needs a code-reviewer subagent in .claude/agents/)
# Check on them
claude agents # full-screen list: working, needs input, done
claude logs <id> # recent output from one session
claude attach <id> # open it in this terminal
claude stop <id> # stop it
claude rm <id> # remove it from the list
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.
Things to know before you leave it running:
- It keeps going without you. A separate background service runs the sessions, so you can close the terminal. Sessions survive sleep but stop when the machine shuts down. After a restart, a session from the last 48 hours shows as failed; reply to it and it picks up from its saved conversation.
- Each session gets its own worktree before it edits. In a git repo, a session you start from agent view or with
--bgmoves into a worktree under.claude/worktrees/first. One you moved there with/bgkeeps editing where it was. - It commits for you, but never to main. In its own worktree, Claude commits without asking, pushes the branch if there's a remote, and opens a draft PR when the task calls for it. Anthropic says it never pushes to main or master, force-pushes or merges. If your CLAUDE.md says you handle git yourself, it leaves git to you.
- Deleting a session can delete its work. Deleting from agent view (Ctrl+X twice) removes the worktree Claude made, uncommitted changes included.
claude rmkeeps a worktree that has uncommitted changes. - Permission mode depends on how you started it. A session you moved with
/bgkeeps its mode. A new one starts like a freshclaudein that folder, unless you open agent view with defaults, for exampleclaude agents --permission-mode plan --model opus. - Make it the default:
/config defaultToAgentsView=truemakes plainclaudeopen agent view. Turn it off with thedisableAgentViewsetting orCLAUDE_CODE_DISABLE_AGENT_VIEW=1.
Not to be mixed up: /agents (inside a session) only points you to your subagent files. claude agents (in your shell) opens agent view. /tasks lists the background work in the session you're in, and /workflows lists workflow runs.
Prefer the desktop app? Click + New (Cmd+N on Mac, Ctrl+N on Windows) for another session, Ctrl+Tab to switch, and Option-click or Alt-click a session for split view. Turn on Worktree under the prompt box to give a session its own copy of the project.
Worktrees: keep parallel agents out of each other's files
A git worktree is a second folder with its own files and branch that shares your repo's history. Anthropic recommends one per session when sessions run side by side, so one can build a feature while another fixes a bug.
- Start a session in one:
claude --worktree feature-auth(or-w). It lands in.claude/worktrees/feature-auth/on a new branchworktree-feature-auth. Run it again with another name in a second terminal for a second session. Leave the name off and Claude makes one up. - Ignore the folder: add
.claude/worktrees/to your.gitignore, as Anthropic suggests. - Bring your .env along: a worktree is a fresh checkout, so gitignored files like
.envaren't there. List them in a.worktreeincludefile at the project root. - Give a subagent its own worktree: add
isolation: worktreeto its frontmatter. Claude Code removes the worktree on its own if the subagent made no changes. - Cleanup: when you exit a worktree session, a clean worktree is removed (a named session asks first), and one with work in it asks keep or remove. Old subagent and background worktrees are swept after your
cleanupPeriodDayssetting, unless they still hold work. - Shared, not copied: the repo's
.gitfolder, project-scope plugins, and "don't ask again" approvals for Bash commands (saved to the main checkout's.claude/settings.local.json) carry across all worktrees of the repo. On Windows, those approvals stay with the one worktree.
# Copied into every new worktree Claude Code creates.
# Same syntax as .gitignore. Only files that are also
# gitignored get copied, so tracked files never double up.
.env
.env.local
---
name: test-fixer
description: Fixes one failing test at a time in its own worktree. Use when a test fails and the fix may touch several files.
isolation: worktree
model: sonnet
tools: Read, Edit, Bash, Grep, Glob
---
Fix the failing test you are given. Work only inside your worktree.
Run that test, then the full test suite. Commit on your branch when both pass.
Report back: what was wrong, which files you changed, and the branch name.
Never push to main and never force-push.
More subagent files to copy, plus every frontmatter field, are on Claude Code subagents examples. Base branch, starting from a PR, cleanup and fixes in full: Claude Code worktrees.
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.
Let your sessions message each other
With cross-session messaging, one Claude session can send a short note to another one: "the schema changed", "the migration finished". It's on by itself from Claude Code v2.1.224 on macOS, Linux and WSL 2, and v2.1.234 on native Windows. Type /list-agents (or /peers) to see which sessions Claude can reach, or mention one with @name in your prompt, such as "Let @api-worker know the tests pass now".
- Messages are plain text only, never the other session's history or files.
- A message to an idle session starts a new turn there, which sends that session's full context and uses your plan. Set
crossSessionInboundtohold(notice only) orrefuse(drop) to stop that. - Messages to sessions on other machines or in the cloud need Remote Control and a claude.ai sign-in; they don't work with an API key or through Bedrock, Google Cloud or Foundry.
The commands, in one place
| Command | What it does |
|---|---|
claude agents | Opens agent view (shell) |
claude --bg "<task>" | Starts a background session from the shell |
/bg or /background | Moves the chat you're in to the background and frees the terminal |
/fork | Copies the chat into a new background session; you keep working in the original. With agent view turned off, it starts a forked subagent instead |
/subtask <task> | Starts a forked subagent: it sees the whole chat so far, works in the background and sends its result back here |
/tasks | Lists background work in this session, including finished subagents |
/batch <change> | Plans a big change as 5 to 30 units, then runs one subagent per unit in its own worktree; each runs tests and opens a PR or reports back |
/workflows | Lists workflow runs, their phase and how many agents finished |
claude --worktree <name> | Starts a session in its own worktree |
/list-agents | Shows which of your sessions this one can message |
Orchestration patterns that work
These come from Anthropic's pages. The example prompts are ours.
- Hide the noise (subagent): "Use a subagent to run the test suite and tell me only what failed and why."
- Research in parallel (subagents): "Look at the login, billing and email code in parallel with separate subagents, then give me one summary." Anthropic says this works best when the parts don't depend on each other.
- Chain them (subagents): "Have the code-reviewer subagent list slow spots, then have the test-fixer subagent fix the top one."
- Hand off and walk away (agent view): one
claude --bgper unrelated job, then checkclaude agentslater. - Competing theories (agent team): "Create an agent team of three to find why the checkout page is slow. Each teammate tests a different theory and argues with the others before you report."
- Sweep and cross-check (workflow): "Write a workflow that checks every API route for a missing auth check, then has a second agent confirm each finding."
- One big mechanical change (
/batch): "/batch rename the old config helper everywhere and update its tests."
## Parallel work
- For a noisy side job (test runs, logs, big searches), use a subagent
and give me only the summary.
- If I hand you several separate tasks, tell me which ones could run
as background sessions instead of doing them one by one here.
- Anything that edits files in parallel goes in its own worktree.
Never let two agents edit the same file.
- Commit to a branch and open a draft PR. Never push to main.
- Before you start more than 5 subagents, a workflow or an agent team,
tell me the plan and wait for my OK.
- When you finish, say where the work is: branch, PR or file path.
{
"env": {
"CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS": "8",
"CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH": "2",
"CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS": "8"
},
"worktree": {
"bgIsolation": "worktree"
}
}
Our settings lower the defaults (20 subagents running, 3 layers deep, 16 workflow agents at once) to keep usage down on a smaller plan. "bgIsolation": "worktree" is already the default; we spell it out so nobody turns it off by accident. Delete any line you don't need.
Parallel agents not working: 8 things to check
claude agentsprints your subagents and exits. That's how older versions behaved. Runclaude update. If it still happens, checkdisableAgentViewandCLAUDE_CODE_DISABLE_AGENT_VIEW.- "Concurrent subagent limit reached". 20 subagents are already running. Wait for some to finish, or raise
CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS. - A background session can't edit files. It has to move into a worktree first. If
permissions.blockWritesOutsideWorkingDirectoriesis on, Claude loses its worktree tools; start it withclaude --bg --worktreeor setworktree.bgIsolationto"none". - The app won't start in a worktree: missing .env. Add the file to
.worktreeinclude, and ask Claude to install dependencies in the new worktree. - Two agents overwrote each other. Agent teams don't use worktrees. Give each teammate its own files, or use subagents with
isolation: worktree. - Sessions show "failed" after a restart. Shutting down stops them. Within 48 hours, reply to the session to resume it. After that it shows as stopped: press Enter twice on the row.
- "Operation not permitted" on Desktop, Documents or Downloads (Mac). The background host asks for folder access separately. Allow the Claude Code entry under Privacy & Security > Files and Folders; after an update, look for a new entry named for the new version.
.claude/worktrees/keeps growing. Rungit worktree list, thengit worktree remove <path>. If git says the worktree is locked, rungit worktree unlockfirst.
Where Anthropic's pages don't line up
- Can subagents talk to each other? Run agents in parallel says subagents "report results back to the conversation that spawned them". The Agent teams page's comparison says subagents Claude named when it spawned them "can also message each other".
- Do teammates survive an interruption? The Dynamic workflows comparison says "Teammates keep running". The Agent teams limits say
/resumeand/rewinddon't bring back in-process teammates. /forkhas two meanings. With agent view on, it copies the chat into a background session. With agent view off, it starts a forked subagent, and/subtaskisn't there. Not a mistake, but easy to trip on.claude agentsused to mean something else. An older changelog entry added it "to list all configured agents". It now opens agent view, and Anthropic's troubleshooting says a version that still lists subagents needsclaude update.
FAQ
Can Claude Code run multiple agents at once?
Yes. Anthropic lists five ways: subagents (helpers inside one session), agent view (background sessions you start and watch from one screen with claude agents), agent teams (a lead session that runs teammates, experimental and off by default), dynamic workflows (a script that runs many subagents and cross-checks them), and Projects (one conversation that starts parallel cloud sessions, in public beta on Pro, Max and Ultra). In every one of them the workers are Claude sessions.
What's the difference between subagents and agent teams?
A subagent works inside your session, does a side task in its own context and hands back a summary. An agent team is a lead session plus teammate sessions that talk to one another and work from one shared list of tasks. Teams cost more, since every teammate runs as its own Claude with its own context. Teams are experimental and need CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS set to 1.
How many agents can Claude Code run in parallel?
It depends on the method. By default a session stops spawning subagents while 20 are running (CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS changes that). A dynamic workflow runs up to 16 agents at once by default and 1,000 per run. Agent teams have no hard limit, and Anthropic suggests starting with 3 to 5 teammates. Projects have no fixed number of running threads, with an enforced limit of 500 new threads per day. Agent view doesn't publish a cap, but every session uses your plan on its own.
Do parallel agents use more of my Claude plan?
Yes. Anthropic says running several sessions or subagents at once multiplies token usage. Its agent view page says running ten agents in parallel uses quota roughly ten times as fast as running one. Its costs page puts agent teams at about 7x the tokens of a normal session when teammates are in plan mode, and its workflows page warns that one run can use a lot more tokens than doing the job by chat.
Can Claude Code orchestrate other AI tools or agents?
Not directly. Anthropic's Run agents in parallel page says that in every approach the workers are Claude sessions, and that to involve a different tool you expose it to Claude as an MCP server. You don't need an outside harness to run Claude sessions in parallel: agent view, worktrees and cross-session messaging are built in.
Related setups
Every parallel setup starts with good project rules: CLAUDE.md examples. Then go deeper on the one you picked: subagents, agent teams or workflows. Picking models for the workers is on Claude Code models. Using Kiro instead? Kiro Crew is Kiro's take on long-running agents. Before you let agents commit while you're away, go through the vibe coding security checklist.
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)
Parallel agents go faster when each one has a clear piece of a clear plan. 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 agent teams (turn them on, cost, teams vs subagents, tmux)
- Claude Code workflows (/deep-research, saving a workflow, workflows vs skills)
- Claude Code worktrees (--worktree, base ref, .worktreeinclude, cleanup, fixes)
- Claude Code advisor (/advisor, which model can advise which, cost)
- Claude Code models (full list, aliases, /model, opusplan, effort)
- Claude Code hooks examples (7 copy-paste hooks)
- Claude Pro vs Max vs Ultra (which plan for Claude Code)
- Kiro Crew (install, bots, steering, skills, Crew vs the IDE)
- CLAUDE.md examples (copy-paste template)
- Free rules file generator
Sources
- Claude Code docs: Run agents in parallel
- Claude Code docs: Manage multiple agents with agent view
- Claude Code docs: Create custom subagents (background, forks, limits)
- Claude Code docs: Orchestrate teams of Claude Code sessions
- Claude Code docs: Dynamic workflows (limits, cost)
- Claude Code docs: Run parallel sessions with worktrees
- Claude Code docs: Message your other Claude Code sessions
- Claude Code docs: Projects
- Claude Code docs: Manage costs effectively
- Claude Code docs: Commands (/batch, /fork, /subtask, /tasks)
- Claude Code docs: Desktop app (parallel sessions, worktrees)
- Claude Code docs: Environment variables
- Claude Code docs: Settings reference
- Claude Code docs: Changelog (agent view added in 2.1.139)
Every command, setting, limit and version number here was checked Nov 15, 2026 on Anthropic's own Claude Code docs. Agent view is a research preview, agent teams are experimental and Projects are in beta, so these pages change often. Run claude --version and check Anthropic's page if something looks different. If something here no longer matches, tell us at [email protected].