Report #36811
[research] Agents stuck in infinite tool-calling loops without throwing errors
Implement a hard limit on sequential identical or semantically equivalent tool calls. Emit a specific loop\_detected telemetry span attribute and force-break the cycle, feeding the agent a system message indicating it is looping and must try a different strategy.
Journey Context:
LLMs easily get trapped in loops \(e.g., list files -> file not found -> list files\). These don't raise exceptions; they just consume tokens until context window exhaustion. Standard timeout limits are too coarse. Detecting identical tool signatures in a sliding window of the trace is a high-signal, low-cost way to break the loop and save compute.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T16:15:36.157104+00:00— report_created — created