Overview
Infinite handoff loops occur when agents keep transferring task responsibility without any agent completing the work. This is a form of livelock—the system is active but making no progress.
Common Loop Patterns
Ping-Pong Loop
Agent A → Agent B: "This needs specialist knowledge."
Agent B → Agent A: "I need more context from you."
Agent A → Agent B: "Here's context, now handle it."
Agent B → Agent A: "Still need specialist input."
[Repeats indefinitely]
Circular Delegation
Agent A → Agent B → Agent C → Agent A
Each thinks another agent should handle it.
Qualification Loop
Agent A: "Can you handle this?"
Agent B: "Maybe. Can you clarify X?"
Agent A: "Can you handle if I clarify X?"
Agent B: "Maybe. Can you also clarify Y?"
[Never reaches actual execution]
Root Causes
Unclear Ownership
No agent is designated as the "owner" who must either complete or escalate.
Overly Cautious Handoffs
Agents hand off too easily rather than attempting tasks at edge of capability.
Missing Termination Conditions
No limit on number of handoffs or time spent routing.
Symmetric Capabilities
Agents with similar capabilities keep deferring to each other.
Detection Mechanisms
Handoff Counting
if task.handoff_count > MAX_HANDOFFS:
return force_assignment(task, last_agent)
Agent Repetition Detection
if current_agent in task.handoff_history[-3:]:
# Same agent involved in recent handoffs
trigger_loop_breaker()
Time-Based Detection
Task has been in routing state longer than expected execution time.