After a tool returns an error, the agent calmly calls the very same tool with the very same arguments, again…
After a tool returns an error, the agent calmly calls the very same tool with the very same arguments, again and again.
- AHide the error from the model and return an empty result instead
- BFeed the error text back as the tool’s result AND require the next step to differ from the one that failed
- CRetry up to ten times with the same arguments and a growing delay, since tool errors are usually transient and the next attempt will often succeed on its own
- DFail the whole run on the first tool error
Answer: B
Feed the error text back as the tool’s result AND require the next step to differ from the one that failed
Why
Two things have to be true at once: an error the model cannot SEE it cannot route around, and an error it cannot ACT on it will simply repeat. Hiding it is the worst of the options - an empty result reads as «nothing found», which is a different and false fact.
- Errors & recoveryYour main AI provider fails halfway through a streamed answer; the user already sees the first paragraph.
- Errors & recoveryA nightly batch of 20,000 documents on DeepSeek stopped at document 12,000 with HTTP 402.
- Errors & recoveryA tool call fails with an error.
- Errors & recoveryA streamed generation fails mid-way.
More on Way of the Agent
- Course programThe first three modules are free: start in the browser or the app, no card needed.
- Library: guides, skills and promptsReady prompt templates, grouped into collections.
- AI ChroniclesSourced stories from the history of AI.
- ConceptsPlain-language explainers of agent engineering.
- Learn AI agentsApps and courses for learning AI agents, compared honestly.
Real situations from building agents - with the answer and why.
Solve a new one every day on the Path