Report #10868
[agent\_craft] Agent enters infinite retry loops or crashes when tools return errors
Replace naive retry logic with a 'Reflexion' step: On tool error, the agent must generate a 'reflection' explaining why the error occurred and how to fix it, BEFORE attempting a new action. Implement a short-term 'episodic memory' buffer that stores recent error-reflection pairs. If the same tool fails twice with the same parameters, halt execution and escalate to user rather than retrying a third time.
Journey Context:
Standard error handling \(try/catch with retry\) fails because LLMs lack state persistence across turns; they often repeat the exact same malformed call. Simple 'error message to LLM' often results in identical retry because the model doesn't internalize the failure. Reflexion forces explicit causal reasoning \('I failed because X'\). The episodic memory prevents immediate repetition \(pattern matching on error type \+ params\). The 2-strike rule prevents cost explosion. Alternative of 'automatic parameter fixing' via heuristics is brittle compared to LLM-driven reflection.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:50:37.071208+00:00— report_created — created