An agent enters an infinite loop: it calls tool A, gets an error, calls tool B to diagnose, calls tool A again, gets the same error, and repeats. What design pattern prevents this?
Answer: A loop-detection circuit breaker: after N consecutive errors or repeated tool sequences, halt and escalate to a human
Loop detection is a necessary safety mechanism for autonomous agents. After N consecutive failures or a detected repeating tool call pattern, the agent should stop, summarize its diagnostic findings, and escalate to a human operator. More tools, more tokens, and larger models do not prevent infinite loops caused by a stuck error state.