How should an agent degrade gracefully when a third-party API tool with 99% uptime is unavailable?
Retry with exponential backoff, circuit breaker on repeated failures, and a structured tool-error message to the LLM so it can choose an alternate path instead of silently retrying forever.
Imagine you are working with a friend who sometimes does not answer the phone. The first time the line is busy, you try again in a few seconds. The second time, you wait a bit longer. If they have not answered after a few tries, you stop calling for a while so you do not flood their phone, and you decide whether to try someone else, do the task yourself with what you know, or ask for help. You do not pretend they answered when they did not, because then you would tell people the wrong thing. And you do not give up your whole day just because one friend is not picking up. An agent's tool-failure handling works the same way.
Detailed answer & concept explanation~9 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Open with the framing that tool failure is a state the agent has to reason about, not an exception. Walk the three layers: retry with exponential backoff for transient blips, circuit breaker with open/half-open/closed states for sustained outages, structured tool-error message that the LLM can read and route around. Emphasise that the error must be honest. Cover idempotency keys on retries of mutating tools, observability on retries and breaker events, and the discipline of teaching the model how to respond to tool errors via the prompt or fine-tuning.
Real products, models, and research that use this idea.
- Anthropic's tool-use documentation explicitly recommends returning structured error responses to the model so it can reason about tool failure rather than getting silently misled.
- Netflix's Hystrix and the modern resilience4j library encode the retry plus breaker plus fallback pattern that originated in microservices and translates directly to agent tool wrappers.
- LangGraph and LangChain ship retry decorators and circuit-breaker abstractions for tool wrappers, treating tool fault tolerance as a first-class concern in the framework.
- Production browser-using agents like Anthropic's computer use and OpenAI's Operator handle browser-tool failures with retries plus a structured error to the model, which can then re-plan around a missing capability.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow should the tool-error message be shaped so the LLM actually uses it correctly?
QThe third-party tool is the only one that does what you need. There is no alternative. How should the agent degrade?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Silent retry forever or returning fake empty results. Both hide the failure from the agent and the user, producing stalled tasks or confidently wrong answers.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.