Report #102032
[agent\_craft] Tool call fails and the agent gets stuck or hallucinates a fix
Return structured error context to the model as a tool result, including error type, message, and what was attempted, then let the model decide the next action. Allow one idempotent retry for transient failures, then surface the error. Cap retries and escalate to the user or a fallback.
Journey Context:
Many agents swallow tool exceptions and either crash or retry blindly. The model can recover from an error only if it sees actionable information. 'FileNotFoundError: /tmp/foo.txt' lets the model choose a different path; 'Tool failed' does not. We tried automatic exponential backoff, but that only helps transient errors, not schema or logic errors. The better pattern is to classify failures, retry once for transients, and otherwise return the error into the conversation. Keep error messages concise so they do not bloat context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T04:51:32.683605+00:00— report_created — created