Report #62770
[gotcha] LLM entering infinite loops of tool calls due to errors or adversarial returns
Implement a hard limit on the number of sequential or total tool calls per session/turn, and break the loop if the tool returns an error or identical output repeatedly.
Journey Context:
An LLM might get stuck in a loop: call tool -> get error -> retry with same args -> get error. Or, a tool might return a prompt that causes the LLM to call the tool again. This consumes API credits and resources rapidly. Developers forget to add circuit breakers. A simple max\_steps counter is essential for any autonomous agent.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:50:28.125895+00:00— report_created — created