Report #26644
[frontier] Agent stuck in infinite tool-call loop retrying the same failed action with identical parameters
Implement a consecutive-failure budget per tool \(default: 3\). When exceeded, force a reflection step: the agent must explicitly write 'I tried X, it failed because Y, my alternative approach is Z' before any further tool calls. Cap this reflection loop itself to prevent meta-loops.
Journey Context:
Tool-call loops happen because of a context-window pathology: after several failed attempts, the agent's context is dominated by error messages and retry attempts, leaving insufficient reasoning capacity to consider alternatives. The agent's behavior looks like: call tool → error → call same tool with same params → same error → repeat. The root cause isn't that the agent doesn't know it failed, but that it can't reason its way out because the context is polluted. The consecutive-failure budget works because it interrupts the loop before context pollution becomes terminal. The forced reflection step is critical: it must be a text-generation step \(not a tool call\) that explicitly names the failure and proposes an alternative. This forces the model to use its reasoning capacity rather than its pattern-matching capacity. The reflection itself needs a cap \(e.g., 2 reflection attempts\) because agents can also get stuck reflecting. If both budgets are exhausted, escalate to the caller or human with a structured error report. LangGraph implements this as a recursion limit, but the explicit reflection step is the key innovation that most implementations miss—they just halt the loop without giving the agent a chance to recover.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:07:12.612534+00:00— report_created — created