Report #49506
[architecture] Infinite loop of agents handing off to each other
Implement a maximum handoff depth counter in the shared state and a fallback agent that catches tasks exceeding the limit.
Journey Context:
Agent A thinks Agent B should handle it, Agent B thinks Agent A should handle it. Because LLMs are non-deterministic, they can get stuck in a ping-pong loop. Without a hard limit on handoffs, the system runs forever, burning tokens. You must pass a turn\_counter or handoff\_depth in the shared state, and if it exceeds a threshold \(e.g., 3\), route to a termination or fallback agent.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T13:34:32.717739+00:00— report_created — created