[Feature Request] Add configurable concurrency limiter for parallel agents with lower default
Status Fixed / completed
Reported on v2.1.211
Maintainer reply ✓ Yes — bcherny
Workaround ✓ Mentioned in thread ↓
Activity 3 comments · opened Jul 16, 2026 · closed Aug 17, 2026
💡 Likely answer: A maintainer (bcherny, collaborator)
responded on this thread — see the highlighted reply below.
Bug Description
104 parallel agents... I never asked for that 'speed' why is the system able to spin up that many agents at once, is there a limiter for something like that. you should have the limit default be a sane number like 5 or maybe 10. this is just a bomb that went off for no reason
Environment Info
- Platform: linux
- Terminal: guake
- Version: 2.1.211
- Feedback ID: 5c19f3a8-1760-4215-868b-c862ebd0741e
Errors
[]
3 Comments
Agreed. There are multiple other issues requesting a "max parallel agents" config setting where the issues are closed and no response from anybody at Anthropic. I just had a server go down this morning because of wild system resource usage from parallel agents.
It's possible that a simple instruction to the primary agent "Spawn no more than n parallel sub-agents" would control it, but I have not tested this. Maybe put in global CLAUDE.md file.
e-volusian is right that a CLAUDE.md instruction works, and I can confirm it. We use it in our multi-agent polling runner to prevent exactly this "bomb" scenario.
The two things that have worked best in practice:
1. CLAUDE.md global constraint
This is not enforced at the platform level, but compliance is surprisingly reliable - the model reads CLAUDE.md at session start and applies the constraint consistently. The key is stating a specific number rather than "a reasonable number."
2. PreToolUse hook as a hard gate
For situations where you cannot trust the model to self-limit (e.g. recursive spawning, skills that themselves spawn agents), a hook is more reliable:
Then in settings.json:
Both stop the runaway fan-out problem, but neither is a substitute for first-party support (a
max_concurrent_agentsconfig value). The hook approach has edge cases - the file-based counter doesn't clean up on crash, which can leave phantom counts. The platform just needs a hard cap.(I build tooling for orchestrating multiple Claude Code sessions at scale - disclosure: we run into this exact problem and these are workarounds we use ourselves, not a recommendation to not fix the root cause.)
Thanks for reporting this. Since Claude Code v2.1.217 there is a cap on concurrently running subagents (default 20), and you can lower it with the
CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTSenvironment variable, e.g.CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS=5. Spawning past the cap fails and Claude is told not to retry.Changelog: https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md
Docs: https://code.claude.com/docs/en/sub-agents#concurrent-subagent-limit
Please update to the latest version and let us know if you still see unbounded fan-out.
🤖 Generated with Claude Code