Claude Code shipped two orchestration upgrades in June 2026 that push the terminal agent beyond flat delegation. Nested subagents arrived in v2.1.172 on June 10: subagents can spawn their own subagents up to a hard cap of five levels deep. Separately, Anthropic added experimental agent teams, where multiple Claude Code sessions coordinate as a team with shared tasks and inter-agent messaging. Together they signal that context management through hierarchy and parallelism is now core product strategy, not a research sidebar.
Nested Subagents in v2.1.172
For most of Claude Code's life, official docs stated that subagents could not spawn other subagents. That guardrail prevented runaway recursion. Boris Cherny, who leads Claude Code, announced the change on June 9 with a one-line release note: nested subagent support, capped at depth five "to start."
The motivation is context hygiene. Each subagent runs in an isolated context window and returns only a summary to its parent. When a delegated task itself splits into parallel subtasks, the parent no longer absorbs intermediate noise from every leaf worker. A reviewer subagent can dispatch a verifier per finding; only the consolidated result climbs back to your main session.
The subagent panel below the prompt shows the full tree. Each row displays a descendant count and a path back to main. Run /agents to watch the nested tree as work fans out. Depth is counted as levels below the main conversation; agents at depth five do not receive the Agent tool and cannot spawn further. The limit is fixed and not configurable via settings.
To block nesting for a specific subagent type, omit Agent from its tools list or add it to disallowedTools in .claude/settings.json. That is the practical control surface until Anthropic exposes a global depth knob.
Token Math and When to Nest
Nesting multiplies token use. Each level adds a full context window for the child agent, even when only a short summary returns. Most productive chains in early testing sit at depth two or three, not five. Nest when the leaf agent does meaningful isolated work and the parent would otherwise ingest thousands of tokens of intermediate output.
Restrict models on deeper layers: Haiku-class models for leaf verifiers and Opus or Sonnet only where reasoning depth justifies cost. Cherny framed depth five as a starting point and asked for feedback, so treat depth as experimental and monitor spend per task.
Experimental Agent Teams
Agent teams are a separate primitive from nested subagents inside one session. Multiple Claude Code instances work together: one session acts as team lead, assigns tasks, and synthesizes results while teammates work in independent context windows and message each other directly.
Teams are disabled by default. Enable them by setting CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in settings or your shell environment. Without that variable, no team directories are written and Claude does not spawn teammates.
Agent teams use significantly more tokens than a single session because each teammate maintains its own window. Anthropic positions them for research, review, and new feature work where parallel exploration pays for the overhead. Routine chores still favor a single session or flat subagents.
As of v2.1.178, spawning a teammate no longer requires a separate setup step, and cleanup runs automatically when the session exits. Known limitations remain around session resumption, task coordination, and shutdown behavior. Docs mark the feature experimental with behavior that may change release to release.
How This Fits Other June Claude Code Work
Nesting and teams complement rather than replace recent workflow features:
- /branch session forking splits one session to explore alternatives without losing context.
- Artifacts publish live session output as shareable web pages for teammates.
- Dreaming runs background multi-agent orchestration on scheduled intervals.
Forking handles parallel exploration in one tree. Nested subagents handle hierarchical decomposition inside a run. Agent teams handle true multi-session parallelism when tasks are large enough to justify separate Claude Code processes.
Practical Guidance for Web Developers
- Upgrade to v2.1.172 or later before relying on nesting; earlier builds had stuck "active" states when nested children were stopped.
- Start with depth-two chains on real refactors and measure summary quality before adding layers.
- Enable agent teams only for bounded research spikes with explicit token budgets, not as default daily workflow.
- Combine scoped permissions on subagent definitions with org MCP policies so deep trees cannot reach production credentials unexpectedly.
Claude Code is no longer a single agent with occasional helpers. It is an orchestration runtime where developers manage trees and teams of agents the same way they once managed threads and PRs. The June releases make that architecture explicit in the product rather than hidden behind custom scripts.