Claude Code 2.1.217 subagent concurrency and budget checklist
Quick answer
Claude Code v2.1.217, released July 21, 2026 UTC, adds three controls for delegated work: a default cap of 20 concurrently running subagents, no nested subagent spawning by default, and enforcement of --max-budget-usd against background subagents. When a print-mode budget is reached, new subagents are denied and running background subagents are halted.
The safest upgrade is not to keep every default. Set a smaller concurrency cap for your repository, leave nested spawning disabled until you have a measured reason to enable it, and use a dollar limit for unattended claude -p jobs. Treat these as separate controls:
breadth: how many subagents may run at once
depth: whether a subagent may delegate again
spend: when the whole print-mode run must stop
Who this is for
This guide is for developers using Claude Code subagents, background sessions, CI jobs, or scripts that can fan one prompt into parallel work. It is especially useful when an agent reviews many files, runs tests in parallel, or delegates research and implementation.
Use the Claude Code sandbox and worktree checklist for filesystem boundaries. Use the explicit /verify and /code-review workflow after delegated work returns. This page covers the control plane between those two gates.
What changed in 2.1.217
| Control | Confirmed behavior | Practical consequence |
|---|---|---|
| Concurrent subagents | The default maximum is 20; CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS overrides it |
A single prompt can no longer fan out without a ceiling, but 20 may still be too high for a small repo or API limit |
| Spawn depth | Subagents no longer spawn nested subagents by default; CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH can allow deeper nesting |
The default delegation graph stays one level deep and easier to audit |
| Dollar budget |
--max-budget-usd now stops background subagents, denies new spawns, and halts running ones after the cap |
An unattended print-mode run has a real whole-run stop condition |
The same release also fixes a symlinked-working-directory escape for background sessions, warns when transcripts are not being saved, and releases memory retained by truncated MCP outputs. Those fixes improve isolation and durability, but they do not replace the three workload controls above.
Start with a conservative profile
For a small repository or a first canary, begin with two to four concurrent subagents and the default no-nesting behavior. A print-mode automation can use this shape:
export CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS=4
unset CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH
claude -p \
--max-budget-usd 5.00 \
--output-format json \
"Inspect the changed files, delegate independent checks, run the relevant tests, and return evidence."
--max-budget-usd applies only to print mode. Interactive sessions and subscription plans need their own organization, workspace, or provider limits. The JSON result includes total_cost_usd, which gives a simple per-run ledger even when you do not operate an OpenTelemetry backend.
Raise concurrency only after you know the repository can support the extra file reads, test processes, API requests, and review output. Keep the spawn-depth variable unset unless a task genuinely needs hierarchical delegation and your evidence system can preserve parent-child relationships.
Choose a workload envelope
| Profile | Concurrent cap | Nested spawning | Print-mode budget | Use when |
|---|---|---|---|---|
| Local canary | 2 | Default off | $1-3 | Learning how a prompt decomposes and measuring cost |
| Small repo CI | 4 | Default off | $3-10 | Independent lint, test, documentation, and review checks |
| Large audit | 8 | Default off | Measured from a prior canary | Read-heavy audits with isolated outputs and adequate API headroom |
| Hierarchical workflow | Start at 4 | Explicit exception | Mandatory | A parent subagent must coordinate a second layer and the graph is observable |
These are starting points, not Anthropic service limits. Replace the dollar figures with values derived from your own model, repository, and provider. The important invariant is that concurrency, depth, and spend all have explicit owners and stop conditions.
Five-case rollout matrix
Run the checks in a disposable branch with harmless tasks. Record the Claude Code version, model, prompt, environment variables, wall time, total cost, number of spawned agents, and exit result.
| Case | Safe probe | Pass condition |
|---|---|---|
| Concurrency ceiling | Set the cap to 2 and ask for five independent read-only checks | No more than two subagents run concurrently; excess work waits or is completed without repeated spawn attempts |
| Default depth | Ask one subagent to split its own task again while the depth variable is unset | The child does not spawn another child and completes with its available tools |
| Budget stop | Run a bounded print-mode task with a deliberately small non-zero test budget | The result never exceeds the configured control by continuing background work; new spawns stop at the gate |
| Cancellation cleanup | Start multiple harmless background checks, then trigger the budget or interrupt the parent | No orphan background work keeps consuming tokens or modifying the fixture |
| Evidence completeness | Collect JSON output or OpenTelemetry spans for the run | Cost, model, agent IDs, parent-agent IDs, tool activity, and terminal state can be reconstructed without logging prompt or tool content |
Anthropic's monitoring documentation exposes agent_id and parent_agent_id on model and tool spans. Content logging is off by default; keep it that way unless a reviewed debugging need justifies the privacy cost.
Promotion and rollback workflow
- Upgrade one machine or CI runner to
v2.1.217or newer and restart its sessions. - Capture the current parallel-agent baseline: peak concurrency, p95 wall time, failed requests, total cost, and number of manual interventions.
- Apply a conservative cap and leave nesting at its default. Run the five fixtures twice so one lucky run does not become the baseline.
- Canary a real low-risk task. Compare output quality and elapsed time with a single-agent run; more parallelism is useful only when it reduces useful completion time without widening review debt.
- Increase the cap one step at a time. Roll back when cost per accepted result rises, rate-limit errors increase, agents contend on the same files, or evidence becomes incomplete.
Use this compact record:
Claude Code subagent control evidence
- version / model / provider:
- repository and fixture commit:
- concurrent cap / spawn-depth setting:
- max budget / total_cost_usd:
- peak active agents / terminal agents:
- wall time / retries / rate-limit errors:
- verification result:
- promote, hold, or roll back:
Common mistakes
- Treating the default cap of 20 as a recommended team size.
- Enabling nested spawning before a flat workflow has proved insufficient.
- Assuming
--max-budget-usdcontrols an interactive session; the CLI reference limits it to print mode. - Counting spawned agents without checking how many finished, failed, or were halted.
- Logging complete prompts and tool outputs merely to get cost visibility.
- Increasing parallelism when tasks edit the same files or share one fragile external service.
- Treating a budget stop as successful completion without running deterministic verification.
FAQ
Should I set the concurrency cap to 20?
Usually not for the first rollout. Twenty is the product default, not a repository-specific optimum. Start with two to four and raise it only when measurements show independent work, available API headroom, and manageable review output.
Should I enable nested subagents?
Keep the default unless one layer cannot express the workflow. Hierarchical delegation increases the number of paths, contexts, and failure states. If you enable it, require a parent-child trace and a stricter budget.
Does the budget flag guarantee a useful result?
No. It is a stop condition, not a quality gate. A run may stop mid-task. Your wrapper must distinguish a verified result from a budget-limited partial result.
Does this replace sandboxing?
No. Concurrency, depth, and spend limit workload shape. Sandboxing, worktrees, permissions, network controls, and credential scope limit what the workload can touch.
Sources
- Claude Code GitHub release
v2.1.217: https://github.com/anthropics/claude-code/releases/tag/v2.1.217 - Claude Code Docs: Run agents in parallel: https://code.claude.com/docs/en/agents
- Claude Code Docs: Create custom subagents: https://code.claude.com/docs/en/sub-agents
- Claude Code Docs: CLI reference: https://code.claude.com/docs/en/cli-reference
- Claude Code Docs: Monitor usage with OpenTelemetry: https://code.claude.com/docs/en/monitoring-usage
- Claude Code Docs: Manage costs effectively: https://code.claude.com/docs/en/costs
Top comments (0)