Report #5312
[research] Agent gets stuck in an infinite loop of tool calls, draining tokens and budget
Set hard limits on step depth and implement telemetry alerts on tool\_call\_consecutive\_failures >= 2. Break the loop by injecting a stop and ask for help system message when the loop is detected.
Journey Context:
LLMs often get stuck in self-reinforcing loops \(e.g., calling a search tool, getting no results, slightly changing the query, calling it again\). Standard timeout limits don't catch this if each individual API call succeeds quickly. Observability must track the sequential pattern of tool calls. Detecting repeated tool names or identical error responses allows the orchestrator to intervene before token limits are hit.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:03:55.126425+00:00— report_created — created