Subagent Recursion is an AI code smell, a sign of trouble in LLM systems, in the Control-flow abusers group. Subagents spawn subagents with no depth or cost limit.
An internal research tool got the question “what is the reimbursement policy for international travel?”. The trace (anonymized and condensed):
agent[0] delegate("research reimbursement policy") agent[1] delegate("research travel policy") agent[2] delegate("research international travel policy") agent[3] delegate("check applicable exchange rate") agent[4] delegate("research the dollar rate") ... agent[1] delegate("research reimbursement exceptions") ...total: 140 subagents, 2,300 model calls, 47 minutesanswer: one paragraph that was on the wiki's first page
Every agent could spawn subagents, and so could every subagent. None had a depth limit, and each received a fresh budget.
An illustrative count makes the shape visible. Suppose 3 children per node and depth 5: 1 + 3 + 9 + 27 + 81 = 121 agents before the sixth level. If each makes 10 model calls, you are already past a thousand calls. The question fit in one search.
Signs of Subagent Recursion:
Subagents have the same delegation tool as the main agent.
There is no limit on depth or on the total number of agents per task.
Each subagent gets its own budget instead of sharing the parent’s.
The trace has deep trees for simple questions.
The cost of one task varies by orders of magnitude between similar runs.
flowchart TD
A(["1. Agent"]):::llm --> B(["2. Subagent"]):::llm
A --> C(["2. Subagent"]):::llm
B --> D(["3. Sub-subagent"]):::llm
B --> E(["3. Sub-subagent"]):::llm
C --> F(["3. Sub-subagent"]):::llm
D --> G(["4. and so on"]):::llm
The main agent decides to delegate.
Each subagent can delegate too.
The tree grows at every level.
With no limit, growth is exponential, and each node runs its own loop.
The design looks like team research. In practice, the model slices the question into ever thinner pieces (“exchange rate”, “dollar”, “PTAX”) instead of reading the wiki. Each slice gets a new agent, with its own history and its own cap.
Reasons
Recursive delegation looks elegant. “The agent can spawn as many agents as it needs” sounds flexible. Flexible with no cap is unbounded.
The same configuration serves everyone. The subagent is a copy of the main agent, with every tool, including delegate. Whoever can spawn children spawns grandchildren.
Budget per agent, not per task. Each node has a reasonable cap; the total does not. Three levels of 20 steps look like 20. They are not.
Models tend to delegate when they can. With the tool available, they use it. Splitting the work is the most obvious way to “be an orchestrator”.
The framework limit misleads. LangGraph’s recursion_limit and the OpenAI Agents SDK’s max_turns cut the loop of one graph or one agent. They do not cut the depth of a tree of separate processes.
Anthropic’s “Building effective agents” (Dec. 2024) recommends stop conditions (a maximum number of iterations) on agent loops. The same principle applies to the tree: depth, width, and total cost.
Cost of ignoring
Explosive cost. A simple task can cost hundreds of times the normal amount. At 2,300 calls, even a cheap model eats the day’s quota.
Latency. Even in parallel, deep trees take a long time. Forty-seven minutes for a wiki paragraph.
Quality. Each level summarizes the level below. After four summaries, the reimbursement-policy detail became a generic paragraph, and an exchange rate nobody asked for slipped in.
Quota. Hundreds of simultaneous calls exhaust the whole system’s rate limit. Innocent other tasks fail with 429.
Diagnosis. A trace with 140 branches is almost unreadable. You find the final paragraph and cannot find the path that produced it.
Internal policy research almost never needs a tree. One agent with wiki search, using the Subagent Delegation pattern with workers that lack delegate, is enough. The cascade is that pattern abused.
Payoff
A maximum cost per task that you define.
Shallow trees, with delegation only where it isolates context or parallelizes work.
Answers that pass through fewer intermediate summaries.
When to ignore
Never leave recursion unbounded. Two-level delegation, with a shared budget and workers that lack delegate, is a legitimate design. Broad parallel research (several sources at once) fits that design. Subagents without the delegation tool solve most cases.
Is it this smell?
Quick answers
What is Subagent Recursion?
Subagent Recursion is an AI code smell, a sign of trouble in LLM systems, in the Control-flow abusers group. Subagents spawn subagents with no depth or cost limit.
How do you fix Subagent Recursion?
With Add Loop Budget and Collapse Agents. Each refactoring has safe step-by-step mechanics with an eval before and after.