New Tool Radar

AI Agents & Automation

How to Handle a Failed Agent Tool Call with Retry and Backoff

Retry a failed tool call with backoff, so a brief outage does not kill the run and a real failure does not loop forever.

Schematic illustration with three step boxes: sort failures by type, retry with backoff, and stop at the budget.

Not every tool failure deserves a retry: a rate limit or a timeout does, a bad argument does not. Retrying the same failing call five times is just expensive failure. The pattern that works is a bounded retry with backoff for transient failures, and an immediate stop or a different approach for permanent ones.

Before you start

An agent loop where you can control retries, and a list of the tool failures you have seen.

Sort the failures by type

Split tool failures into transient and permanent. Transient: timeouts, 429 rate limits, 503 errors, brief network drops. Permanent: bad arguments, missing files, permission denied, an invalid tool name.

Write the split down with the error codes, so the code can decide without asking the model.

Retry transient failures with backoff

For transient failures, retry up to three times with growing waits, such as 1, 2 and 4 seconds. Backoff gives the failing service time to recover and avoids hammering it.

Log each retry with the attempt number and the error, so a run that retried three times can be told apart from one that succeeded first time.

Stop at the retry budget

When the retries are used up, stop retrying and escalate: return a clear error to the user, log the failure, and let the agent try a different tool or ask a human. Never retry the same call in a loop without a budget.

For permanent failures, do not retry at all: fix the arguments or the call, and only then try again.

Practice check: fictional Maple Corner agent, 10 tool failures

The table below is fictional practice material, worked out by hand from the stated failure types. It is the expected result for the practice failures, not a run of any agent.

Failure Type Action Outcome Verdict
Timeout Transient Retry, backoff Succeeded on 2nd try Pass
429 rate limit Transient Retry, backoff Succeeded on 3rd try Pass
Bad argument Permanent No retry, fix args Succeeded after fix Pass
Permission denied Permanent No retry, escalate Escalated Pass

All four failures are handled correctly: transient ones succeed after backoff retries, and permanent ones are fixed or escalated without a wasted retry loop.

Expected result. UNTESTED: the outcomes in the practice table are worked out by hand, not measured by running an agent. Sort your own tool failures into transient and permanent, retry the transient ones with backoff up to three times, and escalate when the budget is used up.

Limits

  • Retrying a permanent failure is expensive failure: sort the failure first, then decide.
  • Backoff is a wait, not a hope: the waits must grow, or the retries hit the same outage.

Sources

See all