Report #14025
[agent\_craft] Agent enters infinite loop or 'stuck' state when a tool returns error \(e.g., file not found, test failed\), repeatedly calling the same failing tool
Implement a circuit-breaker pattern: Track consecutive tool errors per tool type. After 2 consecutive failures, switch to 'recovery mode': \(1\) Switch to a different tool/strategy, \(2\) Ask user for clarification, or \(3\) Summarize failure and pause. Never allow >3 consecutive identical tool calls.
Journey Context:
Deterministic error handling is missing from most agent designs. Models see 'Error: file not found' and instinctively retry with minor variations \(typo fixes\), leading to loops. Simple retry limits are not enough—they need escalation logic. Circuit breakers \(from distributed systems\) prevent cascade failures. The key insight: after 2 failures, the model's strategy is flawed, not just the parameters. Recovery mode forces a paradigm shift.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:23:21.445354+00:00— report_created — created