Answer
What should an AI agent do when a tool call fails?
Read the error, decide whether it is transient or structural, and stop retrying anything that failed for a reason retrying cannot fix.
Read the error and classify it. Retry a timeout or a rate limit; do not retry a permission denial, a missing file or a bad argument, because the cause will still be there. Never continue as though it succeeded.
Tool failures divide into two classes and the appropriate response differs completely. Transient failures — a timeout, a rate limit, a temporary outage, a lock — are caused by conditions that pass, and retrying with a delay is correct. Structural failures — a permission denial, a path that does not exist, a malformed argument, an unsupported operation — are caused by conditions that persist, and retrying is pure cost. An agent that does not distinguish them will do the same thing repeatedly and describe it as persistence.
The distinguishing information is in the error message, which is why the message must reach the agent rather than being collapsed into a generic failure. A runtime that reports only that a call did not succeed has removed the one input needed to choose a response, and the agent then guesses, which usually means retrying. Where a tool returns useful error detail, passing it through unchanged is the single highest-value thing the integration can do.
Retry policy needs a limit and a delay, and both should live outside the agent's judgement. Two or three attempts with increasing gaps covers nearly all genuinely transient conditions; beyond that the failure is telling you something and the correct action is to stop and report. Leaving the retry decision to the agent produces either premature abandonment or a loop, depending on how the situation reads, and neither is a property you want varying by run.
The worst response is not a bad retry. It is proceeding as though the call had succeeded, which produces work built on an assumption about state that is false, and a completion report that describes actions which never took effect. This is why reading back the result of consequential operations matters so much: it converts an unnoticed failure into a noticed one at the moment it happens rather than at the moment someone finds the consequence.
There is a third class worth separating because it is deceptive: the call that succeeded and returned something unusable. An empty result, a truncated response, a partially written file, a rate-limited response body that is actually an error page. These do not appear as failures at any layer and are handled as data. Validating the shape of what came back — not just whether the call returned — is the control, and it is the difference between a system that fails loudly and one that fails quietly into the output.
Finally, a structural failure is usually a message about configuration rather than about the run. A permission denial means the account is wrong. A missing path means the assumption about layout is wrong. Reporting these as agent failures rather than as setup failures sends the investigation in the wrong direction, and a report that names the class of failure saves whoever reads it a considerable amount of time.
The expensive failure is not the tool call that failed; it is the next nine identical calls made in the hope that the world changed.
Siddharth Sharma, Context Theory
Related questions
Should an agent try a different approach when a tool fails?
Only where the alternative is a genuine equivalent, and this is worth constraining explicitly. Improvisation after a failure is where agents do their most surprising work: refused a write, an agent may find another route to the same effect, which defeats the control that refused it. A failed permission should end the attempt rather than start a search.
How should the failure appear in the final report?
As a named item with the error, the class, what was attempted and what remains undone as a result. A report that mentions difficulties in passing has told the reader nothing actionable, and a report that omits the failure because the run eventually completed is the version that causes real damage, since the incomplete part is invisible.
METHOD
Every figure below carries its source and the date it was verified. Nothing on this page is asserted.
The numbers on this page.
| What | Value | Specific to |
|---|---|---|
| Sub-15-minute compliance — automated routing vs manual only | 62.5% vs 39.1% | Category-wide |
| Agents who give up after one contact | 44% | Category-wide |
2026 speed-to-lead benchmark · verified
Multi-study aggregate · verified
What is specific to this page.
| Kind | Claim | Check it against |
|---|---|---|
| Software | Tool failures divide into transient causes that pass and structural causes that persist, and retrying is correct for the first and pure cost for the second, so an agent that does not classify the error repeats the same call and describes it as persistence. | Counting repeated identical calls following a permission denial in any agent run log. |
| Workflow | The information needed to classify a failure is in the error message, so a runtime that collapses tool errors into a generic failure removes the input required to choose a response and leaves the agent guessing. | Comparing agent behaviour when a tool returns a detailed error against when the same failure is reported generically. |
| Response | A call that returns successfully with an unusable payload — empty, truncated, or an error page in the body — is handled as data rather than as a failure at every layer, so validating the shape of the response is the only control that catches it. | Feeding a rate-limited or error-page response through the workflow and observing whether it is written as output. |
| Constraint | Improvisation after a refused action can defeat the control that refused it, because an agent seeking an equivalent route may reach the same effect by a path the permission did not cover, which makes a failed permission a reason to stop rather than to search. | Refusing one write path in a test run and inspecting whether the agent attempted an alternative route to the same change. |
Each row would be wrong on another industry's page. Where a sourced figure exists it is in the table above instead; these are the constraints that shape the work and do not happen to be numbers.
Start with the measurement.
Reading about a benchmark is not the same as knowing your own number. The audit produces yours, measured rather than estimated.
$497 · delivered in 5 business days · credited against month one