Report #95785
[research] Agent gets stuck in an infinite loop of tool calls, draining API budget
Set hard limits on depth \(max iterations\) and breadth \(duplicate consecutive tool calls\). Emit a specific telemetry span attribute \(loop.detected=true\) when the agent calls the same tool with the same args consecutively.
Journey Context:
Agents often loop when a tool returns an error they don't understand, causing them to retry the exact same failed strategy. Standard timeouts are too slow and expensive. Detecting identical consecutive spans in the trace allows you to break the loop early and flag the specific tool error that confused the agent, preventing budget runaway.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T19:21:30.470161+00:00— report_created — created