General-purpose sub-agents recursively spawn unbounded child agents, causing exponential fan-out and massive token burn
What happened
When using the Agent tool to delegate a research task to a general-purpose sub-agent, the sub-agent itself has access to the Agent tool and recursively spawns its own child agents. Those children can also spawn agents, creating an exponential fan-out tree with no depth or count limit.
In my case, a single Agent call for "research Venmo integration options" resulted in 48+ background agents running simultaneously. The vast majority were redundant — doing overlapping searches on the same topics (e.g., 4 separate agents researching "Wise API," 3 researching "Apple Pay P2P," multiple agents researching the same settle-up flows). The agents kept spawning faster than I could stop them manually.
This has happened twice across different sessions with different research prompts. It's a consistent pattern, not a one-off.
Note: this is new behavior. After hundreds of hours of Claude Code usage, I had never seen recursive agent fan-out until recently. The model hasn't changed (Opus 4.6 1M context) — this appears to be a harness/runtime change that started allowing or encouraging sub-agents to spawn their own children in a way they didn't before.
Expected behavior
Sub-agents spawned via the Agent tool should have bounded recursion. Options:
- Sub-agents should not have access to the
Agenttool (preventing recursive spawning entirely) - A configurable depth limit (e.g., max depth of 1 — sub-agents can't spawn their own sub-agents)
- A configurable total agent count cap per turn (e.g., max 10 agents from a single parent call)
- At minimum, the parent context should be notified and given a chance to approve before a sub-agent fans out into many children
Impact
- ~1.5M+ tokens consumed across redundant agents in a single research request
- No effective way to stop runaway agents — by the time the user sees them in the agent list and manually stops them, dozens have already launched and consumed tokens
- The useful research was complete within the first 3-4 agents; the remaining 44 added no new information
Reproduction
- Ask Claude Code to research a broad topic (e.g., "research Venmo integration options for a mobile app")
- Claude spawns a
general-purposeagent via theAgenttool - That agent decides the topic has multiple sub-questions and spawns multiple child agents
- Those child agents may themselves spawn further children
- Result: dozens of concurrent agents doing overlapping work
Environment
- Claude Code CLI (latest)
- Model: claude-opus-4-6 (1M context)
- macOS Darwin 25.5.0
Suggested fixes (in order of preference)
- Depth limit: Sub-agents should not be able to spawn their own sub-agents. The parent context should be the only orchestrator.
- Count limit: Cap the total number of agents a single
Agentcall can transitively produce (e.g., 10). - Approval gate: If a sub-agent wants to spawn more than N children, require parent/user approval before proceeding.
- Tool restriction: Remove
Agentfrom the tool set available to sub-agents spawned byAgent, so only the main conversation orWorkflow(which has explicit concurrency controls) can orchestrate multi-agent work.
This issue has 11 comments on GitHub. Read the full discussion on GitHub ↗