An agent calls an external API that sometimes returns HTTP 503 and sometimes 400 for a malformed request. Which two error-handling rules fit? (Select TWO.)
- Exam domain
- Implement tool use and environment interaction20–25% of the exam
- Difficulty
- Medium
- In this mock
- 17 questions on this domainPractise this domain
Why the exam asks this
Objective in the exam guide: Implement error handling.
Agents meet failing APIs constantly. The exam checks sound error handling and retries.
Why A and E are the answers
A multiple-response question. Choose two. There is no credit for picking only some of them.
Do not retry 400 responses; fix the request or report the error
Retry 503 responses with exponential backoff and a retry limit
Transient errors, such as 503, are retried with backoff and a limit. Permanent errors, such as 400, will not succeed on retry, so they need a fix or an error report.
How it works
Transient errors, such as timeouts and 503s, may succeed on retry.
Exponential backoff waits longer between attempts, and a limit stops endless retries.
Permanent errors, such as 400 Bad Request, need the input fixed or the error reported.
Clues in the question
The words that point to the answer, and what each one tells you.
- 503 sometimes
- Transient.
- 400 for a malformed request
- Permanent.
In detail
- Log each retry with the attempt number for traceability.
- After the retry limit, escalate.
Side by side with look-alikes
| Error | Retry? | Then |
|---|---|---|
| 503 Service Unavailable | Yes, with backoff and limit | Escalate after limit |
| 429 Too Many Requests | Yes, after the wait period | Escalate after limit |
| 400 Bad Request | No | Fix input or report |
| 401 Unauthorized | No | Fix credentials |
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Do not retry 400 responses; fix the request or report the errorRight
Transient errors, such as 503, are retried with backoff and a limit. Permanent errors, such as 400, will not succeed on retry, so they need a fix or an error report.
B. Retry every error forever until it succeedsWrongMost tempting
Infinite retries waste resources and hide failures.
Why it tempts: Persistence sounds robust. But permanent errors never succeed, and infinite loops hide the problem.
C. Ignore errors and continue with empty dataWrong
Continuing with empty data produces wrong results silently.
D. Retry 400 responses immediately in a tight loopWrong
Retrying a malformed request cannot succeed.
E. Retry 503 responses with exponential backoff and a retry limitRight
Transient errors, such as 503, are retried with backoff and a limit. Permanent errors, such as 400, will not succeed on retry, so they need a fix or an error report.
In practice
- Add jitter to backoff so parallel agents do not retry in lockstep.