Report #83288
[agent\_craft] Agent enters infinite loop repeating same failed tool call
After a tool error, append the error to the tool result slot \(not the chat history\) and mandate a 'reflection' turn where the agent must output an analysis of the failure before retrying.
Journey Context:
Standard agent implementations add the error message to the conversation history as an 'assistant' or 'user' turn, then immediately sample the next action. This often leads to repetition because the context window blurs the distinction between the failed attempt and the current state. The ReAct pattern \(Reasoning \+ Acting\) suggests inserting an explicit reasoning step. By forcing the agent to generate a 'reflection' \(e.g., 'The previous bash command failed because I used single quotes inside a string interpreted by the shell...'\) before emitting the next tool JSON, you break the repetitive pattern and increase success rates by ~40% in tool-use benchmarks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T22:23:21.665576+00:00— report_created — created