Claude Code Subagents Can Now Spawn Subagents Claude Code v2.1.172 now allows subagents to spawn their own subagents up to 5 levels deep, enabling autonomous multi-agent pipelines. Developer UCJung migrated their uc-taskmanager pipeline to use a nested orchestrator agent instead of Main Claude, reducing round trips and improving efficiency. The feature is disabled by default in v2.1.217 and requires setting CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH. In Claude Code, a subagent can spawn its own subagents. This landed in v2.1.172. To see why that matters, you have to look at what wasn't possible before. I maintain uc-taskmanager https://github.com/UCJung/uc-taskmanager-claude-agent — a Claude Code pipeline that automates requirement → specification → plan → implementation → verification → commit across six agents. Its README stated this constraint twice: "Subagents can't nest. So Main Claude orchestrates everything." That premise is gone. So I moved the orchestrator out of Main Claude and into an agent. This post is that migration. dynamic workflows claude -p First, what the runtime actually guarantees. As of July 2026; latest Claude Code version is 2.1.217 . | Version | Change | |---|---| 2.1.172 | Subagents can spawn their own subagents up to 5 levels deep | | 2.1.187 | A background subagent's depth is fixed when first spawned. Resuming it later from a shallower context doesn't change it | | 2.1.193 | The subagent panel shows the full tree siblings, direct children, and the path back to main | | 2.1.212 | Per-session spawn cap of 200 CLAUDE CODE MAX SUBAGENTS PER SESSION | 2.1.217 | Nested spawn disabled by default. Set CLAUDE CODE MAX SUBAGENT SPAWN DEPTH to allow it. Concurrency cap of 20 added CLAUDE CODE MAX CONCURRENT SUBAGENTS | If an agent definition's tools list includes Agent , that agent can spawn subagents of its own. To prevent a specific agent from spawning others, omit Agent from tools or add it to disallowedTools . --- name: orchestrator description: Orchestrates the entire WORK pipeline autonomously via nested spawn tools: Agent, Read, Write, Edit, Bash, Glob, Grep model: opus --- One gotcha: writing a type list in parentheses inside a subagent definition — Agent some type — does nothing; the list is ignored. The Agent agent type allowlist syntax applies only to an agent running as the main thread via claude --agent . So you can't express "this agent may only call builder" through tools . Depth counts levels below the main conversation , regardless of whether each level runs in the foreground or background. A subagent at depth five doesn't receive the Agent tool at all, so it can't go deeper. Our pipeline looks like this: Main Claude depth 0 └─ orchestrator depth 1 ├─ specifier depth 2 ├─ planner depth 2 └─ builder / verifier / committer depth 2 We only use depth 2, so there's room under the cap of 5. This constraint shaped the design more than anything else. A nested subagent cannot ask the user anything directly. Interactive tools like AskUserQuestion aren't available to it. If your pipeline has approval gates, this decides your architecture: the actual handling of approvals and decisions must always happen at the Main Claude boundary . Back when nesting wasn't possible, the structure looked like this: Main Claude ──spawn── specifier → returns dispatch XML Main Claude ──spawn── planner → returns dispatch XML Main Claude ──spawn── scheduler → returns XML saying "builder is next" Main Claude ──spawn── builder → ... Main Claude ──spawn── verifier → ... Main Claude ──spawn── committer → ... There was an agent called scheduler that did no LLM work of its own. It read the DAG and returned XML naming what to call next; the actual spawn was always done by Main Claude. Because nesting was impossible, the coordinator couldn't coordinate — it could only write coordination memos. The consequences: With nesting from v2.1.172, the structure became: WORK tagged message │ ▼ work-pipeline SKILL Main Claude ── spawns orchestrator once raw request + REFERENCES DIR + mode=gated|auto handles gates │ depth 1 ▼ orchestrator ← flow control + TASK DAG scheduling + autonomous decisions + logging │ nested spawn depth 2 ┌──────────────────┼──────────────────────────────┐ ▼ ▼ ▼ specifier → planner → per TASK builder → verifier → committer creates WORK PLAN+DAG DAG READY order, builder retried ≤3 on FAIL │ ▼ Final WORK summary + list of auto-decisions returned to Main Claude Three core principles: scheduler was deleted.Because of the constraint from section 1 — nested subagents can't ask the user — gates are built on a yield model. At a gate, the orchestrator returns an XML signal and stops parks :