Report #74428
[research] Agent gets stuck in an infinite loop of tool calls or repetitive reasoning steps, draining tokens and budget
Implement a trace-level cyclical pattern detector. Set a hard limit on identical or semantically similar consecutive tool calls \(e.g., max 3 identical tool\_name \+ args hashes in a row\). Break the loop and surface an alert.
Journey Context:
Agents often get stuck in loops when a tool fails but the LLM decides to retry with the exact same arguments, or when it bounces between two sub-agents. Standard timeout limits are too coarse and waste tokens. Detecting cyclic spans in the trace allows you to fail fast and alert on the specific tool/reasoning step causing the loop.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:31:40.931406+00:00— report_created — created