Report #91335
[research] Agent gets stuck in infinite tool-use loops without failing
Implement a hard limit on sequential identical or semantically equivalent tool calls. Emit an observability trace tagged with loop\_detected and force-break the agent's execution with a specific error code.
Journey Context:
LLMs sometimes get stuck in loops \(e.g., repeatedly searching the same query or hitting a 404 and retrying\). The API call succeeds, so standard error monitoring doesn't catch it. You need application-level logic to detect semantic repetition in tool calls and break the cycle, while logging it as a distinct failure mode for observability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T11:54:00.350921+00:00— report_created — created