Table of Contents
Tool use in agentic AI fails in specific ways: tool unavailable, arguments invalid, returned data unexpected, downstream service rate-limited. Recovery patterns determine whether the agent gracefully continues or fails the user. Build robust error handling into the tool layer.
Error classes: tool down, invalid args, malformed result, rate-limited. Recovery: retry with backoff for transient; reformulate args for invalid; fall back to alternative for down; surface to user when agent can't recover. Always include the error in the conversation context so the LLM can adapt subsequent actions.
Error classes
- Tool unavailable / 5xx: external service down. Retry with backoff; fall back to alternative if persistent.
- Invalid arguments / 4xx: LLM produced bad arguments. Surface error to LLM; let it reformulate.
- Rate-limited / 429: backoff and retry. If persistent, suggest alternative tool.
- Malformed result: tool returned data that doesn't match expected schema. Surface to LLM with raw output.
- Authorisation denied: user lacks permission. Surface to user; agent can't recover.
Recovery
- For transient: standard exponential backoff retry
- For permanent within one call: include error in conversation; LLM reformulates next step
- For dependency failure: alternative tool (e.g., different API; cached data; degraded mode)
- For rate limits: respect
Retry-After; switch to alternative if available - For unrecoverable: graceful degradation message to user; log for analysis
Verdict
Tool use error recovery is essential for production agents. Each error class needs its own pattern; LLMs adapt remarkably well when errors are surfaced in conversation context. The mistake is silent retry / silent failure; agents become incoherent. Always log; always provide recovery signal to the LLM.
Bottom line
Surface errors to LLM; standard retry semantics. See error handling.