Report #88258
[architecture] Agents delegate tasks back and forth in an infinite loop, exhausting token limits and API budgets
Enforce a strict max-depth limit on agent handoffs and implement a termination condition or deadlock-breaker agent that forces a final resolution when depth limits are reached.
Journey Context:
When Agent A \(planner\) delegates to Agent B \(coder\), and B encounters an error, B might delegate back to A for re-planning. A might send it back to B with the same flawed plan. This ping-pong match is a classic state machine deadlock. Developers forget that LLMs do not inherently track recursion depth. The fix is a hard boundary \(e.g., max 3 handoffs\). The tradeoff is that complex tasks might hit the ceiling and fail, but a hard failure is better than an infinite, expensive loop. The deadlock breaker agent should be a simple, non-delegating agent that outputs the error directly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:43:35.410272+00:00— report_created — created