Report #88881
[architecture] Agents stuck in infinite handoff loops, bouncing the same task back and forth
Implement a maximum handoff depth counter in shared state. Increment on every handoff. When the counter exceeds a threshold \(e.g., 5-10\), route to a fallback handler or terminate with an explicit error rather than looping forever.
Journey Context:
In multi-agent systems with peer-to-peer handoffs, two agents can easily disagree on who should handle a task and bounce it indefinitely. Agent A routes to B, B routes back to A, and the loop consumes tokens and time with no progress. This is especially common when agent boundaries are poorly defined or when both agents lack the capability to handle the task. OpenAI Swarm's execution loop is deliberately simple and does not natively prevent this — you must add it yourself. The fix is a handoff counter with a hard limit. An alternative is to use an orchestrator topology where a central router decides all handoffs, preventing cycles by construction, but this creates a bottleneck. The handoff counter works with any topology and is cheap to implement.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T07:46:23.771817+00:00— report_created — created