Quick answers
Why does this matter? The Agent tool, formerly Task, launches both built-in and custom subagents. A custom definition lets you reuse instructions and tool restrictions.
What should you do? Measure the cost on your own task. There is no fixed 20,000-token startup cost.
What is the biggest risk? Spawning more workers than the task or machine can support. The current default Agent-tool limit is 20 concurrent subagents; it is configurable.
What does isolation change? A non-fork subagent starts without the main conversation's history. A fork copies that history, so choose deliberately.
What are you choosing?
Use a built-in subagent for a one-off search. Define a custom subagent when you need to reuse instructions or tool restrictions.
Done. Blog post over.
Delegation can cost more than the work seems to justify. I’ve felt real frustration sitting there watching usage balloon past 160k tokens for work I expected to cost 3k.
In an August 2025 report, one user on Claude Code 1.0.64 described roughly 160k subagent tokens for work they said took 2-3k in the main context. That is a dated user report, not a benchmark for your setup. The official best practices and cost guidance now discuss delegation and context costs.
The Agent tool is how Claude Code launches subagents. The useful choice is between a built-in worker, a custom definition and keeping the work in the main conversation. That distinction matters when enterprises organize their AI implementations.
What does the Agent tool do?
The Task tool, now called Agent, launches subagents. Each has its own context window, whose size depends on its model. A fresh, non-fork worker receives the delegated prompt and its startup instructions rather than your whole conversation.
Claude Code renamed Task to Agent in version 2.1.63. Legacy Task(...) references in settings and agent definitions remain aliases. Here, “Agent tool” means the launcher and “subagent” means the worker it starts.
The current concurrency limit works like this:
# Illustrative limit handling, not executable Python:
# Below the configured limit: another subagent may start.
# At the limit: a new Agent-tool spawn fails.
# Once running workers finish: capacity is available again.Older community reports described ten-worker limits. As of November 17, 2026, the official documentation gives a default of 20 concurrent Agent-tool subagents, controlled by CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS. That is a software limit, not a recommendation to run 20 workers on your machine.
For a search across 500 files, ten workers handling 50 files each is one possible split. First check whether a single search command would answer it. Subagents can send messages when SendMessage is available, but still need clear ownership and a useful result to return.
Delegation uses tokens even when it keeps the main conversation short. Model choice, instructions, tool output and caching affect the total. That is where cost optimization strategies and practical techniques for reducing Claude costs help: measure a small sample before multiplying the workers.
Revisiting that 20k figure, July 31, 2026. It is not a constant, and on a machine with a mature instruction file it reads low. Most subagent types are handed the entire CLAUDE.md hierarchy at startup, so the per-Task floor scales with whatever your instruction files have grown to. Measured here on 2026-07-30 against a two-file hierarchy of 28,620 words: a general-purpose agent that made zero tool calls and did no work still reported 111,253 tokens for the turn. Ten of those is not 200k tokens, it is over a million. The shape of the argument above holds, but the multiplier is yours to measure rather than inherit, so run wc -c on your own CLAUDE.md files before trusting any per-Task number, this one included. Method in which agents read your CLAUDE.md.
Current clarification, November 17, 2026. The July measurement above describes that setup. wc -c counts bytes, not tokens. For a current comparison, record the worker type, model, loaded instructions, input and output tokens, and cache usage. Explore and Plan skip the initial CLAUDE.md load. Custom agents can omit user, project and local CLAUDE.md files, while managed policy files still load unless the definition itself comes from managed settings. Those differences prevent one measured startup total from becoming a universal floor.
Want a second pair of eyes on your situation? Contact Blue Sheen.
When does a custom definition help?
A custom definition saves you from repeating the same brief.
Subagents are specialized Claude instances with their own prompts and tool settings. Project definitions live in .claude/agents/; user definitions in ~/.claude/agents/ can be reused across projects. The definition persists, but a new invocation starts a new conversation unless you resume an existing worker. Persistent memory is a separate, optional setting. For the ground-up definition, see what a subagent is in Claude Code.
What most people miss: the documented rule has been that subagents can’t spawn other subagents. Mind you, this limitation is by design, not a bug; the docs say so plainly in the context of plan mode, and the point is to stop runaway nesting. For most of this tool’s life, when a subagent reached for the Agent tool, it got nothing. No nested hierarchies, no recursive task decomposition. One level of delegation. (Update, June 2026: the v2.1.172 changelog notes that subagents can now nest, up to five levels deep. So treat the flat-rule wording above as the old default rather than a law of physics. The cost reason behind it has not changed though: every level you add multiplies the per-worker overhead, so deep nesting is rarely the cheap option even when it is allowed.)
The ceiling moved twice more, August 1, 2026. Nesting was switched off by default in v2.1.217, then switched back on two releases later in v2.1.219 at a lower ceiling: “Subagents can now spawn nested subagents up to depth 3 by default (was 1).” Set CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=1 to turn it off again. A separate per-session cap landed in v2.1.212, defaulting to 200 spawns, overridable with CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION and reset by /clear. The five-level figure was accurate the day it was written, which is the honest lesson here: a depth limit is a setting, not a property of the tool, and settings move.
Current limits, November 17, 2026. The documented default nesting depth is still three. The current documentation says there is no total session spawn cap. The concurrent-worker limit is separate from depth, so the historical 200-spawn setting above should not be treated as a current limit.
Background subagents run while you continue working. If a tool call needs permission, Claude Code currently surfaces the prompt in the main session and identifies the worker. Background operation does not mean every permission request is automatically denied.
Give a reviewer a clear brief and read-only tools when it should only review. A role name alone does not prevent edits or guarantee that the worker follows its brief.
Reusable definitions help keep the brief consistent. Community-shared security-auditor subagents can be useful starting points, but using the same definition does not guarantee identical conclusions or complete security coverage.
Which worker fits the job?
Use the following as a starting point, then measure it on your work.
Use a built-in subagent when:
- You need to search without a target (“find all database connections” across 1,000 files)
- Parallel reads dominate (reading 50 config files to build a dependency map)
- Context isolation matters (analyzing competitor codebases without contamination)
- It’s one-off work you’ll never need again
- The work is independent enough to justify another worker
Define a custom subagent when:
- Expertise requires consistency (code review with specific style guides)
- Tool access needs restriction (reviewer can read, can’t write)
- Workflows repeat predictably (every PR gets the same security check)
- Teams need standardization (everyone uses the same test-writer agent)
- You want to configure persistent memory explicitly
Consider the main conversation when:
- You already have the relevant files and context in the conversation.
- The steps depend closely on one another.
- Explaining the task to another worker would take more work than doing it.
Compare elapsed time, token use and review effort on a small task before choosing a larger worker count.
The diagram is a starting point. Independence and a reusable brief matter more than a fixed file count.
How can you divide the work?
These are example ways to divide work, not benchmark results.
The repository explorer pattern
For a feature spread across several directories, consider splitting the search by concept:
# Example directory split
"Explore src/, tests/, docs/ using 3 parallel tasks"
# Example feature split
"Use 4 parallel tasks:
- Auth system: find all auth/login/session code
- Data models: locate all database schemas
- API endpoints: map all routes and handlers
- Test coverage: analyze test patterns"Each worker searches for a concept across directories. This community discussion of subagents offers related examples; it does not establish that one split is always faster or cheaper.
The code review pipeline
A review pipeline could use three custom definitions:
- style-checker: Runs first, catches formatting and naming issues
- security-reviewer: OWASP Top 10, credential scanning, injection vectors
- test-validator: Ensures tests cover the changes
Run these sequentially when a later reviewer needs an earlier result; otherwise independent reviews can run in parallel. A short results file can make the handoff explicit. The community example of specialized agents is an illustration, not evidence that sequential reviews always cost less.
The hybrid orchestration
For a large refactoring, combine built-in and custom workers:
- Main conversation identifies the affected files
- Built-in subagents read independent parts
- A custom architect definition helps develop the approach
- Workers implement changes with explicit file ownership and isolated worktrees
- A test-writing worker proposes integration checks
- The main conversation reviews results and coordinates git operations
Parallel work may reduce elapsed time, but briefing, repeated context and integration also cost time and tokens. Measure the complete workflow, including review.
Limitations that will catch you off guard
Delegation has failure modes worth checking.
Progress visibility: Current Claude Code exposes running subagents in its panel and task list, with transcripts you can inspect. Check those before treating a worker as stuck.
A summary can omit details you need. Ask the worker to save exact file references, errors and evidence where you can inspect them.
A failed or partial result needs inspection. General-purpose and custom subagents can be resumed with their history; the built-in Explore and Plan agents are one-shot. Do not assume a failed operation retried successfully.
Communication: Workers do not share a live context window. Where SendMessage is available, a worker can contact named siblings or its parent. Give each one the results and file references it needs.
Configuration drift is real. That carefully tuned subagent from six months ago? Its behavior shifts subtly as Claude’s base model updates. Version control your agent configs and test them periodically.
For a small task, delegation overhead may outweigh the benefit. There is no universal 20k-token floor or tenfold saving from keeping it in the main conversation.
What should you ask before delegating?
Stop optimizing for elegance. Optimize for getting work done.
Question 1: Will I run this exact operation again?
- Yes. Consider a custom subagent definition.
- No. Continue to Question 2.
Question 2: Is there independent work worth moving out of this conversation?
- Yes. Consider a built-in subagent.
- No. Stay in the main conversation.
Question 3: Must operations share context?
- Yes. Decide whether a fork, messages or a shared results file will supply it.
- No. A fresh subagent can work from a focused brief.
Start simple, measure performance, then change the bottleneck you can identify. Designing elaborate coordination before understanding the work creates the same risk as trusting an AI readiness assessment without checking its assumptions.
I still think the main thread is the best orchestrator Claude Code has. The Agent tool and reusable subagent definitions help it delegate work. When you layer this into a full project management system with persistent CLAUDE.md files and structured folder hierarchies, even non-code work can use the same parallel execution patterns.
June 2026 changes one line of this. The “write a bash script” advice grew an official answer: dynamic workflows let Claude write a JavaScript orchestration script that runs subagents in the background, 16 at once and as many as 1,000 across a run, and the ultracode setting makes that the default for big tasks. So the main thread is no longer the only orchestrator worth using; for work that splits into dozens of independent pieces, the script now holds the plan. The per-worker overhead arithmetic in this post still applies to every one of those agents, which is exactly why the bill scales the way it does.
Current workflow note, November 17, 2026. Dynamic workflows now document a default of up to 16 concurrent workers, reduced on smaller machines, and a configurable limit. The 1,000-agent-call limit applies across a run. Worker cost still needs measurement: shared prompt caching and the instructions each worker loads affect it, so the earlier fixed-overhead arithmetic is not a current pricing rule.



