Back to Blog

Explainers

Claude Agent SDK vs Subagents vs Agent Teams: Choosing a Topology

By · Published · Updated · 10 min read

Three panels: subagents return summaries to a main session, agent team members share a mailbox and task list, and SDK code runs the agent loop with saved sessions.
Subagents keep context separate cheaply, agent teams add peer messaging, and the Agent SDK puts orchestration under program control.

Claude gives engineering teams three ways to put more than one agent on a problem, and they are easy to confuse because they share vocabulary. All three spawn workers on the same agent loop. They differ in who coordinates the work, where state lives, whether the run can happen without a person at a terminal, and how fast token usage grows as you add workers.

This is a topology decision guide: which runtime shape should a given workload use? Grading agent output with a separate critic is a different question, covered in The Multi-Agent Evaluator-Optimizer Architecture. Every product behavior below was checked against the official documentation on November 24, 2026. These features change often, so confirm version-specific details before you write policy.

What are subagents, agent teams and the Claude Agent SDK?

Subagents are specialized assistants inside one Claude Code session. The subagents documentation says each one "runs in its own context window with a custom system prompt, specific tool access, and independent permissions," absorbing search results, logs or file contents and returning only a summary. The main conversation coordinates. By default a subagent can spawn its own subagents, up to three layers deep.

Agent teams coordinate several full Claude Code sessions. The agent teams documentation describes a lead that spawns teammates, a shared task list teammates claim work from, and a mailbox that lets any teammate message any other by name. It also says plainly: "Agent teams are experimental and disabled by default." You enable them with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in settings.json or the environment.

The Claude Agent SDK is a library, not a coordination pattern. The Agent SDK overview describes "the same tools, agent loop, and context management that power Claude Code, programmable in Python and TypeScript," running in a process you operate. SDK applications can still use subagents, hooks, permissions, MCP servers and sessions. What changes is who runs the show: your code instead of a person at a terminal. So subagents and teams are topologies, while the SDK is a host that can run the subagent topology under program control. As shown below, it cannot host a team.

Subagents vs Agent Teams vs Claude Agent SDK: how do they compare architecturally?

The matrix covers the five properties that usually decide an architecture review. Cells reflect current documentation, not benchmarks.

Architectural comparison matrix (documentation as of November 24, 2026)
DimensionClaude Code subagentsAgent teamsClaude Agent SDK
Context isolationOwn context window. Intermediate tool calls stay inside; only the final message returns to the caller.Each teammate is a separate Claude Code instance. The lead's history does not carry over; only the spawn prompt does.Your code decides. Each query() runs one agent loop; subagents in the agents option start fresh unless forked.
Peer messagingResults return to the caller. Subagents Claude named at spawn can also message each other with SendMessage.Native. Teammates message each other by name through a mailbox and share a task list with dependencies.Whatever your application implements between queries; inside a query, the same Agent and SendMessage mechanics apply.
State persistenceOne session. Subagent transcripts can be resumed; an optional memory field keeps a directory across conversations.Task list stays on disk; team config is removed at session end. /resume and /rewind do not restore in-process teammates.Sessions persist to disk and can be continued, resumed by ID or forked. A SessionStore adapter lets another host resume.
Deterministic CI gatesRun in non-interactive -p mode; per-subagent tools, permissionMode and hooks fields narrow each worker.Interactive only: no teammates in -p mode or Agent SDK sessions. TeammateIdle, TaskCreated and TaskCompleted hooks gate live runs.Tool allow and deny lists, hooks, maxTurns, a spend cap ending in error_max_budget_usd, and depth and concurrency limits.
Token multiplierNone published. Each subagent spends its own tokens; docs rate cost lower than teams because results are summarized.Published: approximately 7x more tokens than standard sessions when teammates run in plan mode; roughly proportional to team size.None published. Cost is the sum of what your code spawns, reported per query as total_cost_usd.

Two cells deserve a closer reading. Subagent messaging is no longer strictly hub and spoke: named subagents appear in a roster and can address each other with SendMessage. What they lack is the shared task list and self-claiming. If peers must argue a point to consensus, that is a team behavior.

Enabling agent teams also changes ordinary delegation. The documentation warns that "while agent teams are enabled, a subagent that Claude names launches as a teammate, so teams can form even when you didn't ask for one." Flip the flag for a pilot group and expect that group's delegation behavior, and token usage, to change.

How many tokens does multi-agent coordination actually multiply?

Only one multiplier is published. The Claude Code costs page states that "agent teams use approximately 7x more tokens than standard sessions when teammates run in plan mode, because each teammate maintains its own context window and runs as a separate Claude instance," and that team usage is "roughly proportional to team size." For subagents the docs give direction without a ratio: each subagent "spends tokens of its own while it runs," counted against the same usage limits as the main conversation.

Without a universal subagent multiplier, model your own workload and measure it. The formula below is a planning aid with stated assumptions, not a published figure.

Illustrative cost model (planning assumptions, not published figures)

N  = workers spawned (subagents or teammates)
B  = baseline context each worker loads at start
     (system prompt, CLAUDE.md, tool and skill listings)
S  = spawn prompt written for each worker
W  = tokens each worker processes while working
R  = summary each worker returns to the coordinator
M  = message tokens delivered between peers (teams only)

Fixed fan-out overhead  = N x (B + S)
Subagent topology       = coordinator + N x (B + S + W) + N x R
Team topology           = lead + N x (B + S + W) + M_delivered + coordination turns
Multiplier              = topology total / single-session total for the same task

Illustrative example: four workers, a 25,000-token baseline each and a 1,500-token spawn prompt give a fixed overhead of 4 x 26,500 = 106,000 tokens before any worker reads a file. That is the price of isolation, and why fanning out trivial tasks costs more than doing them in one session.

Teams add a messaging term. A teammate reaches everyone by sending one message per recipient, so (illustrative) a 1,500-token update to three peers delivers 4,500 tokens into three contexts. Each recipient then resends that context with every later request, because Claude Code sends the full conversation each time. Prompt caching lowers the price of those repeated tokens but does not remove them, and in-process teammates keep a five-minute cache by default unless you set subagentPromptCacheTtl to 1h.

Set these documented fan-out caps before the first automated run:

  • Depth: CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH defaults to 3; set it to 1 to stop nested spawning.
  • Concurrency: CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS defaults to 20 in SDK releases bundling Claude Code v2.1.219 or later.
  • Spend: the SDK cap (max_budget_usd or maxBudgetUsd) counts subagent requests and has no default limit.
  • Team size: start with 3 to 5 teammates and about 5 to 6 tasks each; the costs page suggests Sonnet for teammates.

The SDK docs add that Claude Opus 5 delegates to subagents more readily than earlier models, and that prompt instructions "only steer Claude," so the limits still matter. Take pricing inputs from the official Claude pricing page and our Claude 5.5 model routing and prompt caching cost guide, not memory.

When should teams switch from interactive subagents to the Claude Agent SDK?

Start with a single session and add subagents when verbose side work crowds the main context. The rubric maps observable signals to the topology that fits. One signal in the right-hand column is usually enough to justify the SDK, because it describes a requirement the interactive tools do not meet.

Escalation rubric: which signals move a workload to a heavier topology
SignalStay with subagentsPilot agent teamsMove to the Agent SDK
Who starts the runA developer in a Claude Code sessionA developer in an interactive session who will monitor and steerA scheduler, CI job, queue consumer or product feature
How workers relateIndependent tasks where only the result mattersPeers that share findings, challenge each other or claim work from a shared listA fixed pipeline your code sequences, with subagents inside steps
Spend controlUsage limits and habits are acceptableA person shuts teammates down when their work is doneA hard per-run budget must end the run automatically
ResumptionSame machine, same session is enoughLosing teammates on /resume is acceptableRuns must resume by ID, fork, or continue on another host
Policy reviewSession settings and agent files in the repoThe lead's permission mode applies to every new teammateTool lists, hooks and permissions must live in reviewed application code
Feature maturityBuilt-in subagents and agent files are enoughExperimental status and documented limitations are acceptableYou need a versioned library with published changelogs

The rubric never routes production automation to agent teams. That follows from the documentation, not from a quality judgment: teammates need an interactive session, there is one team per session, teammates cannot spawn teammates, the lead is fixed, and task status can lag. Those limits suit supervised research and review, which the docs recommend as the first use, and fit unattended jobs poorly.

Why can agent teams not run in CI pipelines?

The agent teams page is explicit: "In non-interactive mode with the -p flag, including Agent SDK sessions, Claude doesn't spawn teammates, and a subagent that Claude names runs as an ordinary subagent even with agent teams enabled." A pipeline that relies on teammate messaging will quietly degrade to subagents when it runs headless, so design CI jobs for the subagent topology from the start.

What carries into CI is the role definition. A lead can spawn a teammate from any project, user, managed or plugin subagent definition, so a security reviewer defined once works as a headless subagent and as an interactive teammate.

For deterministic gates, the SDK supplies the controls. maxTurns returns partial output at the turn limit, the spend cap ends the query with a distinct result subtype, and the sessions guide lets a later step resume after a limit. A CI step can treat error_max_budget_usd or error_max_turns as a failed gate rather than a silent truncation.

How should a platform team govern each topology?

Permissions behave differently in each shape. Subagents can be restricted with a tools list and a permissionMode field, so a reviewer can be read-only by construction. Agent teams cannot set per-teammate permission modes at spawn: a new teammate starts with the lead's mode, including bypassPermissions. Teammate prompts surface in the lead session, and a teammate cannot approve a permission prompt on the user's behalf.

In the SDK, policy becomes reviewable application code: tool lists, lifecycle hooks, MCP servers and permission settings are passed as options to each query. That suits organizations that need change control over agent behavior, and pairs with the layered controls in Three-Lane Agent Governance.

Two rollout notes. Managed settings apply after every other source, so an organization can enable or disable agent teams centrally. And the SDK overview says third-party products built on the Agent SDK may not offer claude.ai login or rate limits unless previously approved, so production SDK applications use API keys and API pricing.

What does a sensible default architecture look like?

  1. Run a single session with a lean CLAUDE.md until /context or /usage shows real context pressure.
  2. Add project subagents for high-volume reads, tests and log triage, each with a narrow tools list and an explicit model.
  3. Set depth, concurrency and spend limits before any automated run.
  4. Pilot agent teams for supervised research and review with 3 to 5 teammates, separate file ownership and a person monitoring.
  5. Promote any workflow with a non-human trigger or a hard budget into the Agent SDK, reusing the same subagent definitions.
  6. Send consequential decisions to an independent reviewer outside the run; see One AI Advisor or a Council? for when one advisor is enough.

The short version for an architecture review: subagents buy context isolation cheaply, agent teams buy peer coordination at a documented token premium and with experimental limits, and the SDK buys control. Choose by who starts the run and who must be able to stop it.

Primary sources checked for this article

Frequently Asked Questions

Is the Claude Agent SDK the same thing as Claude Code?

Not exactly. The Agent SDK is a Python and TypeScript library that runs the Claude Code binary inside a process you operate, giving your code the same tools, agent loop, hooks, permissions and sessions. The Claude Code CLI is the interactive terminal interface. Use the SDK when an application, scheduler or CI job must start and control the agent, and the CLI for interactive development.

Are Claude Code agent teams ready for production automation?

The documentation calls agent teams experimental and disabled by default, enabled with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1. Teammates spawn only in interactive sessions, never in -p mode or Agent SDK sessions. Documented limits include no restoration of in-process teammates on /resume, one team per session, no nested teams and task status that can lag. They suit supervised research and review better than unattended pipelines.

Can Claude Code subagents talk to each other?

Partly. By default a subagent returns its result to the agent that called it. Subagents that Claude named when it spawned them can also message each other with the SendMessage tool, and a subagent with that tool starts with a list of named agents in the session. What subagents lack, compared with agent teams, is a shared task list with dependencies and self-claimed work.

How many more tokens do agent teams use than a single session?

Anthropic's costs documentation states that agent teams use approximately 7x more tokens than standard sessions when teammates run in plan mode, and that usage is roughly proportional to team size. No equivalent ratio is published for subagents. To estimate your workload, multiply per-worker baseline and spawn-prompt tokens by the number of workers, add working tokens and summaries, then measure a pilot.

Add ClaudeSkillsGuide as a preferred source on Google