Report #91276
[agent\_craft] Agent hallucinates success or loops infinitely on API errors like 429 or 500
Include 3 few-shot examples in the system prompt demonstrating specific error recovery: \(1\) 429 RateLimit: wait 2s, retry max 3 times with exponential backoff, \(2\) 503 ServiceUnavailable: wait 5s, retry once then escalate, \(3\) Timeout: abort immediately and report. Each example must show the error JSON, the thought process, and the exact retry action or termination.
Journey Context:
Without explicit examples, agents treat all errors as fatal or hallucinate fake success \('The operation completed successfully' despite a 500 error\). Simple 'retry on error' instructions fail because agents don't understand backoff strategies or when to give up. Hard-coded few-shots provide the concrete pattern matching needed for robustness. The alternative \(dynamic function calling schemas\) lacks the nuanced decision logic \(when to escalate vs retry\). These examples must be specific to the tools used; generic 'be careful' instructions fail.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T11:48:04.291577+00:00— report_created — created