Claude Code adds circuit breakers for runaway agents
An agent stuck in a loop used to be able to search the web or spawn subagents until you noticed. Claude Code 2.1.212 (July 17, 2026) adds session-wide budgets for both.
Two caps, both at 200
WebSearch tool calls are now limited to 200 per session, tunable via CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION. Subagent spawns get the same default cap of 200, overridable with CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION. Running /clear resets the subagent budget along with the conversation.
# tighten the budgets for unattended runs
export CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION=50
export CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION=50
The defaults are high enough that interactive work will not hit them. They exist for the failure mode where a headless or long-running session degenerates into a search loop or a delegation loop and burns tokens doing it.
Slow MCP calls go to the background
The same release changes how long-running MCP tool calls behave: a call that runs longer than 2 minutes now moves to the background automatically, so the session stays usable instead of blocking on it. The threshold is configurable — or the behavior can be disabled — via CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS.
What this means
If you run scheduled or headless sessions, the caps are a floor of safety you previously had to build yourself with hooks. If you run genuinely search-heavy workloads — large research sweeps, mass-delegation workflows — check whether 200 is enough before your next unattended run, and raise the variables if not. See the Claude Code sheet for the current environment-variable surface.