Report #8019
[agent\_craft] Agent enters infinite loop or gives up after tool execution error
Pass raw stderr and exit codes to the LLM in the next context turn; do not wrap errors in 'Failed to execute' summaries.
Journey Context:
When a shell command or API call fails, many agent frameworks catch the exception and return a generic 'Error occurred' message to the LLM. This forces the LLM to guess the cause \(file not found? permission denied? syntax error?\). The ReAct paper demonstrates that providing observations \(including error details\) is crucial for the LLM to correct its next action. The tradeoff is that error logs can be long \(token heavy\), so they should be truncated smartly \(tail -n 50\) but never summarized by code—let the LLM summarize. Alternatives like 'retry 3 times then stop' fail because they don't address the root cause.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T04:19:34.017204+00:00— report_created — created