Report #97829
[agent\_craft] Tool call fails and the agent loops forever
Return tool errors to the model as structured tool messages with the exact error, the attempted arguments, and a one-line recovery hint; cap the retry loop and escalate after a fixed number of attempts.
Journey Context:
Silently swallowing tool errors is the most common cause of agent loops. The OpenAI tool-calling flow expects the application to execute the function and feed the result back; if the result is an error, the model needs the error text, not a generic 'failed'. The model can often self-correct from specific messages like '404: repo not found; check owner/name case'. Always pair this with a max-turn budget and a fallback, because giving the model more chances can also let it chase bad hypotheses.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:46:11.775023+00:00— report_created — created