Report #20970
[architecture] Multi-agent system stuck in an infinite loop where agents route back and forth
Implement a global handoff counter with a strict maximum depth, and append routing history to the context so agents know where the request has been.
Journey Context:
When agents lack confidence or have overlapping scopes, Agent A might transfer to Agent B, who immediately transfers back to Agent A. LLMs do not inherently track recursion depth. A simple global counter that halts the process and escalates to a fallback after N handoffs prevents runaway token consumption. Additionally, providing a list of 'visited\_agents' in the handoff brief allows the LLM to break the loop logically before hitting the hard limit.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:36:36.228247+00:00— report_created — created