Beta
Start for free

ResourcesDefinition

Claude Code subagents: What they are, which kinds exist, and how their usage adds up

A Claude Code subagent is an AI assistant that takes a specific kind of task from the main conversation, does the work in its own context window, and returns only a summary. You use one to keep search results, logs, and other output you won't read again from filling up the main conversation.

A subagent protects the main conversation's context, but what it reads still counts toward your usage.

What's in this article?

This article starts with the definition, then covers when and how to set one up, how to plan for usage and concurrency, and what the evidence says about their benefits and limits.

What is a Claude Code subagent?

A subagent has four things of its own, separate from the main conversation. According to the subagents documentation, those are its own context window, a custom system prompt, specific tool access, and independent permissions1. The work happens in the subagent's context, and only the summary comes back to the main conversation.

Anthropic's guide to context engineering describes the same pattern: each subagent may explore using tens of thousands of tokens or more, yet returns only a condensed summary, often 1,000–2,000 tokens2. The details stay with the subagent, and the lead agent can focus on combining the results.

Claude reads each subagent's description to decide which one to delegate to. Subagents run inside a single session. Background agents, which run many independent sessions side by side, and agent teams, a group of sessions that Claude starts and supervises, are separate features.

  1. Anthropic, Claude Code documentation, "Create custom subagents" (2026; retrieved November 27, 2026). ↩
  2. Anthropic, Engineering blog, "Effective context engineering for AI agents" (September 29, 2025; retrieved November 27, 2026). A vendor's guide. ↩

How does a subagent differ from the main conversation?

The main conversation suits work with frequent back-and-forth and work whose phases share a lot of context. A subagent suits work that produces lots of output the main conversation doesn't need, and work that is self-contained and can end in a summary. The documentation's guidance breaks down like this1:

FitMain conversationSubagent
ContextWork whose phases, such as planning, implementation, and testing, share a lot of contextSelf-contained work where a summary is enough
ScaleA quick, targeted changeWork that produces lots of output the main conversation doesn't need, such as search results, logs, or file contents
ApproachWork you decide through back-and-forthWork where you want to enforce limited tools or permissions
LatencyWork where latency mattersWork that can afford the time to start fresh and gather context

The latency row needs a word of explanation. Except for a fork, which inherits the parent conversation, a subagent starts from a fresh context, so it may need time to gather context. Handing it a small question that needs a quick answer can be slower than answering in the main conversation.

  1. Anthropic, Claude Code documentation, "Create custom subagents" (2026; retrieved November 27, 2026). ↩

What kinds of subagents are there?

Subagents are either built into Claude Code or defined by you. The main built-in ones are these three1.

  • Explore: A read-only agent for exploring a codebase. It can't use Write or Edit. When Claude calls it, Claude sets a depth of quick, medium, or very thorough.
  • Plan: A read-only agent that researches before a plan is written in plan mode.
  • general-purpose: Handles multi-step tasks that need both exploration and changes. It has every tool a subagent can use.

Explore and Plan start without your CLAUDE.md files and the git status snapshot. When you hand them work that must follow your project's rules, pass the rules they need in the instructions.

A subagent you define sets its behavior in frontmatter. Fields include description, used to decide delegation; tools and disallowedTools, which limit the tools it can use; model, which picks the model; and permissionMode, which sets how permissions are handled. With isolation: worktree, the subagent runs in a temporary git worktree, an isolated copy of the repository. By default, that worktree branches from the default branch rather than the parent session's HEAD.

  1. Anthropic, Claude Code documentation, "Create custom subagents" (2026; retrieved November 27, 2026). ↩

How is subagent usage counted?

Change in token use relative to chat

Anthropic's internal data (2025). About 4× and about 15×, expressed as an increase.

A subagent's requests count toward the same usage limits as your main conversation1. The costs documentation explains that every subagent sends its own requests on top of the main conversation's3. On a Pro, Max, Ultra, Team, or Enterprise plan, the breakdown (attribution) in /usage shows what share of your recent usage went to subagents.

You can estimate the share of what a subagent reads that comes back to the main context with this formula:

Share that returns to the main context = tokens in the returned summary ÷ tokens the subagent read

For example, if a subagent reads 50,000 tokens of logs and returns a 2,000-token summary, the main conversation's context grows by 4% of what was read (2,000 ÷ 50,000). The 50,000 tokens the subagent read still count toward your usage as the subagent's requests. The context is protected, but the subagent's usage still counts against your limits.

In a multi-agent research setup, total token use grows too. According to Anthropic's 2025 report on its multi-agent research system, in the company's data, agents used about 4× the tokens of chat (a 300% increase), and multi-agent systems used about 15× (a 1,400% increase)4. To lower subagent usage, the costs documentation suggests choosing a smaller model for a subagent or running every subagent on one model.

  1. Anthropic, Claude Code documentation, "Create custom subagents" (2026; retrieved November 27, 2026). ↩
  2. Anthropic, Claude Code documentation, "Manage costs effectively" (2026; retrieved November 27, 2026). ↩
  3. Anthropic, Engineering blog, "How we built our multi-agent research system" (June 13, 2025; retrieved November 27, 2026). The vendor's internal evaluation and data; not peer-reviewed. ↩

How many subagents can run at once?

By default, Claude Code runs up to 20 subagents at once in a session. While 20 are running, starting another fails with Concurrent subagent limit reached. This limit applies to Claude Code v2.1.217 and later. By default, nesting goes up to 3 levels below the main conversation1.

  • Concurrency limit: Change it with CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS. There's no limit on the total number of subagents started over a session.
  • Nesting limit: Change it with CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH. Set it to 1 and subagents no longer start subagents of their own.

These limits are Claude Code's numbers, not how many your machine can handle. In my setup, on October 8, 2026, I ran 12 to 15 subagents for implementation and review in the background from one session, and the session crashed. The load average was around 80, and available memory had dropped to 6 GB. My estimate of free memory had left out what the session itself and each agent's tests, builds, and test containers would use. The next day, I set heavy checks such as the full test suite, Storybook, Playwright, next build, and pre-push to run one at a time across the whole machine.

  1. Anthropic, Claude Code documentation, "Create custom subagents" (2026; retrieved November 27, 2026). ↩

Why do subagents matter?

Subagents let you split work that doesn't fit in one agent's context into separate contexts. For research that parallelizes well, large gains have been reported.

On Anthropic's internal research eval, a multi-agent system with Claude Opus 4 as the lead agent and Claude Sonnet 4 subagents outperformed single-agent Claude Opus 4 by 90.2%4. In the same report, on the BrowseComp evaluation, token usage alone explained 80% of the variance in performance. The report explains that splitting work across agents with separate context windows helps by adding capacity to spend enough tokens on a problem.

  1. Anthropic, Engineering blog, "How we built our multi-agent research system" (June 13, 2025; retrieved November 27, 2026). The vendor's internal evaluation and data; not peer-reviewed. ↩

Where do subagents fall short?

Subagents don't help with every kind of work. Anthropic's report names domains where all agents need to share the same context, and domains with many dependencies between agents, as a poor fit for today's multi-agent systems4. It also notes that most coding tasks involve fewer truly parallelizable tasks than research.

  • Synchronous execution: In the report's system, the lead agent waits for each set of subagents to finish before moving on. The lead can't steer subagents along the way, and the whole system can wait on a single subagent. In Claude Code, background subagents run while you keep working in the main conversation.
  • Delegation instructions: Each subagent needs an objective, an output format, guidance on tools and sources, and clear task boundaries. With short instructions, agents duplicate work and leave gaps.
  • Scope of the evaluation: The 90.2% comes from Anthropic's internal eval, and the report gives few details on that eval's design or size. It hasn't been peer-reviewed.

The Claude Code documentation also cautions that many subagents each returning detailed results can consume a lot of the main conversation's context1. Even when only summaries come back, more of them fill the main conversation.

  1. Anthropic, Engineering blog, "How we built our multi-agent research system" (June 13, 2025; retrieved November 27, 2026). The vendor's internal evaluation and data; not peer-reviewed. ↩
  2. Anthropic, Claude Code documentation, "Create custom subagents" (2026; retrieved November 27, 2026). ↩

How can Harnessforce help?

From the main conversation, you only see a summary of the work you handed to a subagent. With Harnessforce, everyone on the team can see how far the work you handed to AI has gotten and where it's stuck, so people can make the call and steer.

With Harnessforce, you can:

  • See progress by issue: For each issue, see how far the work you handed to AI has gotten, where it stopped, and how CI and review went.
  • Follow it to the conversation and traces: From an issue, follow the work to the session's conversation and its traces.
  • Read how harness elements are used: On the Harness page, see calls for each element, subagents included, and the outcomes of the sessions that used it, with your team's values and your own side by side. Names of custom subagents arrive only from machines set to send tool details.
  • Link runs to pull requests: Link sessions to issues and pull requests, with CI and review results next to them. Inferred links are labeled as inferred.
  • Work alongside your tools: Keep using Claude Code and GitHub as they are; Harnessforce runs alongside them.

Learn more on the Handling the reins page, talk to us, or get started today.


This article was written with AI assistance and reviewed by the author.