Report #12806
[research] Agent enters infinite loop of tool calls or retries, burning tokens
Implement a telemetry guardrail using a stateful loop detector. Track the hash of the last N \(tool\_name, arguments\) pairs; if the hash repeats, break the loop and emit an agent.stuck span event.
Journey Context:
LLMs often get stuck in repetitive loops when encountering an unresolvable tool error \(e.g., permission denied\), repeatedly trying the exact same action. Simple max-iteration limits are too coarse and cut off legitimate long-horizon tasks. Stateful loop detection via telemetry allows the agent to retry different strategies but halts exact repetition, saving compute and preventing runaway costs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T17:07:01.219693+00:00— report_created — created