How to orchestrate multiple Claude Code agents
Claude Code gives you two built-in ways to run more than one agent: subagents and the experimental Agent Teams. Both coordinate sessions. This guide covers each one accurately, then the layer neither provides: coordinating the work itself, with gates that decide whether it ships.
Last updated
What are my options for running multiple Claude Code agents?
There are three distinct approaches, and they answer different questions. Subagents split a task inside one session. Agent Teams run several full sessions that talk to each other. An orchestrator such as Orgabot runs each piece of work as its own isolated job and decides, on evidence, whether that work is finished. You can also simply run several Claude Code sessions yourself in separate git worktrees; the guide to running coding agents in parallel covers that manual route step by step.
Everything below about subagents and Agent Teams comes from Claude Code’s own documentation as it read when this page was last updated. Agent Teams in particular is changing quickly, so treat the Agent Teams docs as the source of truth.
How do Claude Code subagents work?
A subagent is a helper Claude spawns inside your session. Each subagent gets its own context window, does a focused job, and returns its result to the main agent, which is why subagents are cheaper than a team: only the summary comes back into the main conversation. You can define reusable subagents as markdown files in .claude/agents/ with their own tools and model, and a subagent definition can set isolation: worktree so it always works in its own temporary git worktree and its edits cannot collide with yours.
Subagents are the right tool when only the result matters: search this codebase, summarize these logs, apply this refactor in a separate worktree. The main agent stays in charge of everything. The subagents documentation has the full frontmatter reference.
How do Claude Code Agent Teams work?
Agent Teams coordinate several independent Claude Code sessions. One session is the team lead: it spawns teammates, creates tasks, and synthesizes results. Teammates each have their own context window, claim tasks from a shared task list (with dependencies between tasks and file locking so two teammates cannot claim the same one), and message each other directly through per-agent mailboxes. You can talk to any teammate yourself, and teammates can run inside your terminal or, with tmux or iTerm2, in split panes.
Agent Teams is experimental and disabled by default. To try it, set the environment variable in your shell or in settings.json, then ask for a team in plain language in an interactive session:
// settings.json
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}Spawn three teammates to review PR #142: one on security,
one on performance, one on test coverage. Report findings.The documentation is candid about where it fits. Teams use significantly more tokens than a single session, because every teammate is a separate Claude instance. They work best for research, review, debugging with competing hypotheses, and new features that split cleanly into separately owned files; for sequential tasks or same-file edits, a single session or subagents do better. The recommended starting size is three to five teammates.
The documented limitations are worth reading before you rely on a team:
- No session resumption for in-process teammates: /resume and /rewind do not bring them back.
- Task status can lag: a teammate may not mark a task complete, which blocks the tasks that depend on it.
- One team per session, and no nested teams: teammates cannot spawn teammates, and the lead is fixed for the session.
- Teammates start with the lead’s permission mode, and their permission prompts surface in the lead session.
- Teammates are not spawned in non-interactive (-p) sessions, including Agent SDK sessions.
- Two teammates editing the same file overwrite each other, so the docs advise giving each teammate its own set of files.
For quality control, Agent Teams exposes hooks: TeammateIdle, TaskCreated, and TaskCompleted, each of which can exit with code 2 to send feedback and block the transition. That is a real mechanism for enforcing rules. It is also one you design, write, and maintain yourself.
What does Agent Teams not do?
Agent Teams coordinates sessions: who works on which task, who tells whom what. It has no built-in concept of the questions that decide whether code should reach your main branch. Did the tests actually pass, run by something other than the agent that wrote the change? Did someone other than the author review the diff? Is opening a pull request, or merging it, something this agent is allowed to do on its own? Where do the results go, and what happens to half-finished work when the laptop sleeps or a session dies?
That is not a flaw in Agent Teams; it is outside its job. A team is a very good way to get several minds on one problem. It is not a delivery pipeline, and the documentation does not present it as one. The gap is the space an orchestrator exists to fill, and the definition of AI agent orchestration draws the same line: coordinating agents is different from owning the work.
How do I orchestrate Claude Code with Orgabot?
Orgabot coordinates the work. Each instruction becomes a mission. Orgabot creates an isolated git worktree for it, runs a coding worker there (the claude CLI is the default worker, so this is Claude Code doing the editing), commits the result, and then runs a sequence of gates that the worker cannot skip or satisfy by describing its own success:
- Verify: Orgabot runs the project’s own registered test command against the committed change and gates on the exit code. A worker saying it is done is not evidence.
- Review: an independent reviewer reads the diff. The reviewer is never the agent that produced the change, and findings go to a fix round that is re-verified and re-reviewed.
- Deliver: the change opens as a draft pull request. Editing a branch is automatic; opening a PR, merging and deploying require policy or your explicit approval.
- Hold: when a gate fails or authority is missing, the mission stops with a named reason and keeps its worktree, branch and session, rather than guessing.
From Orgabot’s framework/ directory:
npm run orgabot -- project add ~/code/myapp --verify "npm test"
npm run orgabot -- mission myapp "Add rate limiting to the public API" --background
npm run orgabot -- mission myapp "Migrate the settings page to the new form library" --background
npm run orgabot -- status
npm run orgabot -- ship myapp --all # draft PRs, review loop, then the merge gatesSeveral missions can run at once. Each has its own worktree, and a host-wide admission budget queues work beyond what your machine can carry rather than starting it and pausing it later. Two missions on the same project that name overlapping files serialize, so the second waits for the first to merge instead of producing a conflicting pull request. The mission terminal in the dashboard streams each mission’s output and lets you steer or interrupt it, and shipping and review documents the review loop.
If you want roles, Orgabot can route missions to roles in an org chart you staff with agents or people, each with its own scoped GitHub access, so an agent never borrows your personal credentials. That is optional: --no-org runs a mission on your own credentials with every gate above still in place. The organizations and roles page covers the model.
Subagents, Agent Teams, or Orgabot: how do they compare?
| Dimension | Subagents | Agent Teams | Orgabot |
|---|---|---|---|
| Status | A standard Claude Code feature. | Experimental; disabled by default. Enabled with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1. | Private alpha, local-first, macOS-first. |
| What is coordinated | Helpers inside one session that return a result to the caller. | Full Claude Code sessions: a lead, teammates, a shared task list, and mailboxes. | Missions: an instruction, a worktree, a worker, the checks, and the delivery. |
| File isolation | Optional: isolation: worktree gives a subagent its own worktree. | The docs warn that two teammates editing one file overwrite each other; split files between teammates. | Always a separate git worktree per mission. |
| Is the work verified? | If you ask for it. | If you wire it up, for example with a TaskCompleted hook. | Orgabot runs the project’s verify command and gates on the exit code. |
| Independent review | Possible, by prompting a reviewer. | Possible, by spawning reviewer teammates. | Structural: the reviewer is never the agent that produced the change. |
| Permissions | Configured per subagent (tools, model). | Teammates start with the lead’s permission mode; their prompts surface in the lead session. | Editing a branch is automatic; opening a PR, merging and deploying need policy or approval. |
| Surviving a restart | Part of the session. | /resume and /rewind do not restore in-process teammates. | Durable mode resumes on Restate; a stopped mission keeps its worktree, branch and session. |
| Output | A result in the main conversation. | Changes in your working tree, and the lead’s synthesis. | A draft pull request, or a hold that names what it is waiting for. |
Which should I use?
- Use subagents when one session needs focused helpers and only their results matter.
- Use Agent Teams when several sessions genuinely need to debate or divide a problem in real time, you are at the keyboard to steer, and an experimental feature is acceptable.
- Use Orgabot when the output is code headed for your main branch and you want the tests run, the diff independently reviewed, and a draft pull request waiting, without being the checker for every branch yourself.
- Skip Orgabot if you need Linux or Windows today, a hosted service, or have no test suite to gate on. It is a macOS-first private alpha, and the known limitations page says what it does not do yet.
A practical workflow that uses both
The two approaches are strongest at different stages of the same change. Early on, when the question is still what to build, an Agent Team is a good way to explore: spawn an architect, a skeptic, and someone reading the existing code, let them argue, and steer them from the keyboard. Nothing they produce has to be mergeable yet. Once the plan is settled, split it into pieces that touch separate files and hand each piece to Orgabot as its own mission. From that point the question is no longer what to build but whether each piece is correct, and that is the question the gates answer: the tests Orgabot ran, the review a different agent wrote, and the draft pull request waiting in GitHub. You stay in the loop at the two points where your judgment matters most, the plan and the merge, and stop being the person who re-runs every test suite in between.
These are not mutually exclusive. A session inside an Orgabot mission is still Claude Code; Orgabot decides what happens to its work afterwards. See known limitations and install and setup before you start.
Common questions
- Does Claude Code support multiple agents natively?
- Yes, in two ways. Subagents run inside one session, each with its own context window, and report results back to the main agent. Agent Teams coordinate several full Claude Code sessions: a lead session spawns teammates that share a task list and message each other directly. Agent Teams is documented as experimental and disabled by default.
- How do I enable Claude Code Agent Teams?
- Set the CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS environment variable to 1, in your shell or in the env block of settings.json, then ask Claude for teammates in an interactive session. Claude Code’s documentation notes that teammates are not spawned in non-interactive mode with the -p flag.
- Is Orgabot a replacement for Agent Teams?
- No. They do different jobs and can coexist. Agent Teams coordinates Claude Code sessions talking to each other inside one lead session. Orgabot coordinates units of work: each mission runs a coding worker (Claude Code by default) in its own git worktree, then Orgabot itself runs the project’s tests, has an independent reviewer check the diff, and delivers a draft pull request under an approval policy.
- Can Agent Teams enforce that tests pass before a task is complete?
- You can build that yourself. Claude Code’s TaskCompleted hook runs when a task is being marked complete, and exiting with code 2 prevents completion and sends feedback. In Orgabot the equivalent check is built in: the project’s verify command runs after every mission and a non-zero exit code fails the gate.
- Does Orgabot work with Claude Code subscriptions?
- Orgabot drives the claude CLI, installed and logged in on your machine, as its default worker, and tracks quota windows for subscription executors. Codex, API-key executors and a deterministic mock worker plug into the same worker seam.
Let Claude Code write it. Let something else check it.
Orgabot is a private alpha for macOS. Each mission runs Claude Code in its own worktree, then your tests, an independent review, and a draft pull request decide whether it ships.