Report #3170
[research] Agents stuck in infinite tool-calling loops exhausting tokens and budget
Add observability guards on agent loops by tracking tool call depth and consecutive identical tool calls. Set hard limits on loop iterations and emit telemetry spans for loop detection. If an agent calls the same tool with the same arguments more than twice, break the loop and alert.
Journey Context:
LLMs often get stuck in loops, especially when a tool returns an unexpected format or the model gets confused. Without observability into the loop depth, an agent can spin for minutes, consuming massive token counts. By instrumenting the agent executor with loop-depth telemetry and breaking on repetitive calls, you prevent cascading cost failures while providing the trace data 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-15T15:37:44.593082+00:00— report_created — created