Report #37872
[research] Agent stuck in infinite loop calling the same tool with identical arguments
Implement a telemetry circuit breaker: track tool name \+ arguments hash per session. If an identical call occurs more than N times consecutively, halt the run, log a 'loop' trace, and return a recovery prompt.
Journey Context:
LLMs easily get stuck in loops when a tool returns an error or unexpected format the model cannot parse. Without observability into the sequence of tool calls, these loops consume massive tokens and cost until timeout. A simple stateful middleware checking the last K tool calls breaks the loop and provides the exact telemetry needed to fix the prompt.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:02:57.575842+00:00— report_created — created