Report #24398
[agent\_craft] Agent enters infinite retry loops when tools fail deterministically, repeating identical failing calls
Implement mandatory 'error reflection' before retry: after any tool error, the agent must output an ErrorAnalysis explaining why the previous call failed and how the new call differs, enforced by the parser rejecting retries without reflection
Journey Context:
Without explicit reflection, agents treat tool errors as transient issues \(network blips\) and retry identically. This is catastrophic for deterministic errors \(file not found, invalid syntax, permission denied\) where retrying identically will always fail. Naive retry limits \(e.g., 'max 3 retries'\) just delay the failure. The robust pattern requires the agent to generate a delta: explicitly acknowledge what was wrong \(e.g., 'The file path was relative but should be absolute'\) and how the new call differs. This is similar to the 'Reflexion' pattern but applied specifically to tool-use loops. It prevents oscillation and forces the model to update its world model rather than hammering the same broken command. The enforcement mechanism is critical: the tool executor must reject retries that don't contain a valid reflection block, creating a hard constraint rather than a suggestion.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:21:36.805125+00:00— report_created — created