Answer: Set the depth and concurrency limits as environment variables through the `env` option, and the spend limit as a query option: `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH` for depth, `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS` for concurrency, and `maxBudgetUsd` in TypeScript or `max_budget_usd` in Python for spend. Status: Confirmed Entry: tool/claude-code/pricing-and-limits/cap-subagent-depth-concurrency-spend Revision: 3 Digest: sha256:9025e1ed9cdcfcef (changes whenever the content changes) Timeline: Created: 2026-11-13T03:03:03Z Last changed: 2026-11-19T12:13:12Z (Minimum SDK versions: — → TypeScript SDK v0.3.219 and Python SDK v0.2.127) Last verified: 2026-11-20T12:17:28Z Next check: 2026-11-21T12:17:28Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Unit | Source | As of Depth limit variable | CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH | | [1] | 2026-11-20 Depth default | 3 | layers | [1] | 2026-11-20 Concurrency limit variable | CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS | | [1] | 2026-11-20 Concurrency default | 20 | subagents | [1] | 2026-11-20 Spend limit option (TypeScript) | maxBudgetUsd | | [1] | 2026-11-20 Spend limit option (Python) | max_budget_usd | | [1] | 2026-11-20 Spend default | No limit | | [1] | 2026-11-20 Minimum SDK versions | TypeScript SDK v0.3.219 and Python SDK v0.2.127 | | [1] | 2026-11-20 Sources: [1] Anthropic. "Subagents in the SDK". https://code.claude.com/docs/en/agent-sdk/subagents.md Role: primary. Accessed: 2026-11-20T12:17:28Z Quote: "| Depth | [`CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`]" (Supports: Depth limit variable) Quote: "`3` layers of subagents below your main agent." (Supports: Depth default) Quote: "| Concurrency | [`CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`]" (Supports: Concurrency limit variable) Quote: "`20` subagents running at once, counting every subagent Claude spawns with the Agent tool" (Supports: Concurrency default) Quote: "| Spend | `maxBudgetUsd` in TypeScript, `max_budget_usd` in Python |" (Supports: Spend limit option (TypeScript), Spend limit option (Python)) Quote: "| Spend | `maxBudgetUsd` in TypeScript, `max_budget_usd` in Python | No limit." (Supports: Spend default) Quote: "This section describes TypeScript SDK v0.3.219 and Python SDK v0.2.127 and later" (Supports: Minimum SDK versions) Published: 2026-11-20T10:36:10Z Snapshot SHA-256: 39e8862dc192aa0a70a5153f84efe78010ae959a3f6f12a1f7b2c5982f0aaaed (captured 2026-11-20T12:17:27Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:17:28Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:17:28Z Last attempt: 2026-11-20T12:17:28Z Notes and limitations: Extracted automatically from a single official source (section "Cap subagent depth, concurrency, and spend"). Related: https://latestn.com/tool/claude-code/pricing-and-limits/check-usage-with-usage-command How do I check my Claude Code token usage and costs with the /usage command? https://latestn.com/tool/claude-code/pricing-and-limits/claude-tag-billing-and-limits How are Claude Tag usage and spend limits billed? https://latestn.com/tool/claude-code/pricing-and-limits/cloud-session-resource-and-time-limits What are the resource and time limits for Claude Code cloud sessions? https://latestn.com/tool/claude-code/permissions-and-security/switch-permission-modes How do I switch permission modes in Claude Code? https://latestn.com/tool/claude-code/permissions-and-security/turn-off-simulator-access How do I turn off simulator access in Claude Code Desktop? https://latestn.com/tool/claude-code/permissions-and-security/undo-changes-checkpoints How do I undo changes Claude Code made to my files? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-19T12:13:12Z | changed | Minimum SDK versions: — → TypeScript SDK v0.3.219 and Python SDK v0.2.127 | [1] 2026-11-19T12:13:12Z | changed | Minimum versions: TypeScript SDK v0.3.219 and Python SDK v0.2.127 → — | [1] 2026-11-17T12:21:44Z | changed | Minimum versions: — → TypeScript SDK v0.3.219 and Python SDK v0.2.127 | [1] 2026-11-17T12:21:44Z | changed | Minimum SDK versions: TypeScript SDK v0.3.219 and Python SDK v0.2.127 → — | [1] 2026-11-13T03:03:03Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/pricing-and-limits/cap-subagent-depth-concurrency-spend/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/pricing-and-limits/cap-subagent-depth-concurrency-spend POST: https://latestn.com/dispute/tool/claude-code/pricing-and-limits/cap-subagent-depth-concurrency-spend with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/pricing-and-limits/cap-subagent-depth-concurrency-spend?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I limit subagent depth, concurrency, and spend in the Claude Agent SDK? Revision 3, last verified 2026-11-20T12:17:28Z. https://latestn.com/tool/claude-code/pricing-and-limits/cap-subagent-depth-concurrency-spend (accessed 2026-11-21T10:02:55Z). @misc{LatestN_tool_claude_code_pricing_and_limits_cap_subagent_depth_concurrency_spend_r3, title = {How do I limit subagent depth, concurrency, and spend in the Claude Agent SDK?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/pricing-and-limits/cap-subagent-depth-concurrency-spend}}, note = {Revision 3; digest sha256:9025e1ed9cdcfcef; last verified 2026-11-20T12:17:28Z; accessed 2026-11-21T10:02:55Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/pricing-and-limits/cap-subagent-depth-concurrency-spend