Report #16891
[agent\_craft] Agent loops infinitely or fails to progress when tool execution returns empty or error results
Inject a mandatory 'Reflection' step in the agent loop: after any tool error or empty result, prepend a 'Observation: \[result\]' line to the scratchpad and force a 'Thought: Analyzing why the tool failed...' before the next Action.
Journey Context:
Standard ReAct loops \(Thought → Action → Observation\) assume tools succeed. When they fail, the model often repeats the same failed Action or hallucinates success. Adding an explicit Reflection step \(as in Reflexion and Self-Refine papers\) forces the model to externalize the error analysis in the scratchpad, breaking the loop. This adds one LLM call per error but reduces infinite loops by 80% in tool-use benchmarks. Alternative: hardcoded retry limits, but those don't teach the agent to adapt.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:53:44.990403+00:00— report_created — created