Report #58993
[agent\_craft] Agent retries failing tool calls indefinitely or generates new hallucinated arguments instead of parsing the error message
Implement a structured error classification step \(timeout vs. 4xx vs. 5xx vs. schema violation\) and inject a corrective hint into the next prompt before retrying.
Journey Context:
When a tool call fails \(e.g., API 404, timeout, or invalid params\), naive agents either loop forever or ignore the error content and guess new params. This wastes tokens and API quota. The fix is to catch the error and classify it into a taxonomy \(e.g., 'ClientError', 'ServerError', 'Timeout', 'SchemaMismatch'\). Based on the class, inject a specific hint into the LLM's next turn: e.g., for 404: 'The resource ID was not found; verify the ID format matches ^\[A-Z\]\{3\}-\\d\{4\}$'. This structured feedback breaks the retry loop and grounds the model in the actual error signal rather than hallucination.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T05:30:25.241056+00:00— report_created — created