An agent's tool call fails with an error. The agent must decide how to respond. Which classification framework MOST correctly guides the agent's error-handling decision?
Select an answer to reveal the explanation.
Short Explanation and Infographic
A fire alarm and a low-battery warning need different responses — you don't ignore the alarm or evacuate for the battery. Tool call errors work the same way. A network timeout is transient — wait and retry. A 403 Forbidden is not transient — retrying 10 more times does not make your token valid. A malformed request will fail every time — retry is waste. Error classification drives the response, not a uniform retry-or-abort policy.
Full explanation below image
Full Explanation
Effective error handling in agent tool calls requires classifying errors by their nature before deciding on a response. A one-size-fits-all retry policy leads to wasted API calls, unnecessary delays, and missed escalation signals.
Option A (retry all failures up to three times) treats all errors as transient. This causes the agent to retry invalid-input errors (which will always fail), retry authorization errors (which will always fail and may trigger account lockout), and retry service-unavailable errors that warrant escalation rather than indefinite retry. Blanket retry is correct for a small class of errors but harmful for others.
Option B is correct and maps error types to appropriate responses: (1) Transient errors (network timeout, connection reset, 429 rate limit) are recoverable with time — retry with exponential backoff and jitter. These errors indicate a temporary condition, not a problem with the request. (2) Invalid-input errors (400 bad request, parameter validation failure, malformed payload) will produce the same failure on every retry because the problem is with the request, not the service. Abort and report so a human or the system can fix the input. (3) Service-unavailable errors (503, 504) may warrant a few retries but signal a systemic problem if persistent — escalate to a human if the service does not recover within the retry budget. (4) Authorization errors (401 Unauthorized, 403 Forbidden) are definitively non-transient — the agent's credentials are invalid or insufficient. Retrying is pointless and may cause harm (triggering rate limits, excessive API calls, credential lockout). These require escalation for credential refresh, not retry.
Option C (abort on any failure) is too conservative. Transient errors are common in distributed systems and expected. An agent that aborts its entire workflow on a single network timeout is fragile and operationally expensive — every transient error requires human intervention to restart.
Option D (ask user on every failure) creates excessive interruptions for routine transient failures. Users do not want to be paged at 2am because an API had a 200ms timeout. Human escalation should be reserved for errors that require human judgment, not mechanical recovery.