CCDV-F · Domain 2: Applications and Integration · 20% of the exam
Task 2.4: Integration Resilience
Finding the defect in failing integration code from its error output: streaming events and the end of a stream, retries and fallbacks that ignore the documented error types, and file inputs sent through the Files API.
Study it
Resilient integrations: stream events, error types, retries, fallbacks and the Files API
Try each one before opening the answer. Every option is explained, with the Anthropic documentation page that proves it.
Question 1 · choose 1
Your service streams replies over raw HTTP and retries overloads like this:resp = http.post(URL, json=body, headers=h, stream=True)
if resp.status_code in (429, 529):
return retry_with_backoff(body)
for event in parse_sse(resp):
if event.type == "content_block_delta":
send_to_user(event.delta.text)
elif event.type == "message_stop":
breakDuring busy periods some users see replies that stop partway, and the logs show no retries at those times. What change fixes the handling?
AInspect each event's type as it arrives, and when one reports overloaded_error, retry the request with backoff
BAfter the stream closes, read the status code again and retry when it has changed to 529
CInspect each event's type and show any error to the user as final, since a request that returned 200 cannot be retried
DAdd 500 and 504 to the status codes that trigger a retry before the stream is read
Show the answer and why
AInspect each event's type as it arrives, and when one reports overloaded_error, retry the request with backoff
Correct
Errors after a 200 arrive as stream events, and overloaded_error there is the case that would otherwise be a 529.
BAfter the stream closes, read the status code again and retry when it has changed to 529
Incorrect
Once the response has started, the status stays 200; a mid-stream error does not follow the status-code path.
CInspect each event's type and show any error to the user as final, since a request that returned 200 cannot be retried
Incorrect
An overloaded_error is a transient overload, the same case as a 529, and the request can be sent again.
DAdd 500 and 504 to the status codes that trigger a retry before the stream is read
Incorrect
These replies started with a 200, so no status check before reading the stream can catch the failure.
With streaming, an error can occur after the API has returned a 200, and it then arrives as an error event rather than through the usual status codes. During high usage that event can be an overloaded_error, which corresponds to an HTTP 529 in a non-streaming context and is retried with backoff.
Late in the month, every request from your organization starts failing with HTTP 429 rate_limit_error. The responses carry no retry-after header. An engineer raised the SDK's max_retries from 2 to 10, and the requests still fail hours later, even at night when traffic is low. What should the team do?
ARaise max_retries further and add jitter, since 429 errors are always transient and clear with backoff
BSpread requests more evenly over each minute so that the token bucket has time to refill
CTreat it as the usage tier's monthly spend cap: stop retrying and request a higher limit or wait for access to resume
DSwitch the failing requests to the invalid_request_error handler, since a spend problem means the request is malformed
Show the answer and why
ARaise max_retries further and add jitter, since 429 errors are always transient and clear with backoff
Incorrect
A spend-cap 429 keeps failing until access resumes, retries included.
BSpread requests more evenly over each minute so that the token bucket has time to refill
Incorrect
Low night traffic still fails, so the cause is not the per-minute rate limit.
CTreat it as the usage tier's monthly spend cap: stop retrying and request a higher limit or wait for access to resume
Correct
At the spend cap requests return 429 without retry-after, and retrying fails until access resumes.
DSwitch the failing requests to the invalid_request_error handler, since a spend problem means the request is malformed
Incorrect
These are rate_limit_error responses; the request format is not the problem.
Once an organization reaches its usage tier's monthly spend cap, requests return HTTP 429 with rate_limit_error but no retry-after header, and retrying, including the SDK's automatic retries, fails until access resumes. Request a higher limit or wait for the reset.
Your ingestion service uploads customer files once with the Files API and then refers to them by file_id in Messages API requests. A PDF contract and a PNG photo of a signed page now both fail when sent, and the service also tries to download each uploaded file afterward to verify it. Which TWO changes make the PDF and the photo work? (Choose TWO.)
ASend both files in document blocks, since every uploaded file is referenced the same way
BRefer to the PDF by its file_id in a document block
CRefer to the PNG by its file_id in an image block
DDownload each file after upload and compare it with the original before sending its file_id
ERename each uploaded file to a .txt name so that it can be read as plain text
Show the answer and why
ASend both files in document blocks, since every uploaded file is referenced the same way
Incorrect
An uploaded image is referenced from an image block, not a document block.
BRefer to the PDF by its file_id in a document block
Correct
PDFs uploaded with the Files API are used as documents by file_id.
CRefer to the PNG by its file_id in an image block
Correct
An uploaded image is referenced by file_id in an image block.
DDownload each file after upload and compare it with the original before sending its file_id
Incorrect
Files you upload are not downloadable, so this step fails rather than verifying anything.
ERename each uploaded file to a .txt name so that it can be read as plain text
Incorrect
Uploaded files cannot be modified or renamed, and a photo is not text.
In the Messages API you refer to an uploaded file by its file_id in a block that matches its type: PDFs and plain text in document blocks, images in image blocks. Uploaded files cannot be modified or renamed, and files you upload are not downloadable.
Your streaming client raises "unknown event type" and drops the connection on some long responses, even though message_stop was never reached and nothing failed on the API side. The logs show the offending events carry only {"type": "ping"}. What is the fix?
ATreat ping as an error event and retry the request
BStop streaming long responses and wait for the complete reply instead
CAccept ping events, which streams can include in any number, and skip them
DClose the stream at the first ping and treat the text so far as the final reply
Show the answer and why
ATreat ping as an error event and retry the request
Incorrect
A ping is not an error; it is a normal event in the stream.
BStop streaming long responses and wait for the complete reply instead
Incorrect
The client only needs to accept the event, not give up streaming.
CAccept ping events, which streams can include in any number, and skip them
Correct
Event streams might include any number of ping events.
DClose the stream at the first ping and treat the text so far as the final reply
Incorrect
A ping does not end the stream; message_stop does.
A stream sends message_start, content blocks, message_delta events and a final message_stop. Event streams might also include any number of ping events, so a client should accept and skip them.
Your finance team set a workspace spend limit in the Claude Console. Today every request from that workspace fails with HTTP 400 invalid_request_error, although the requests have not changed. What should the team do to restore access?
ARetry the requests with exponential backoff until they succeed
BRaise or remove the workspace spend limit
CFix the request bodies, since a 400 always means malformed input
DCreate a new API key in the same workspace and switch the requests to it
Show the answer and why
ARetry the requests with exponential backoff until they succeed
Incorrect
Reaching a spend limit you set is not transient; retries keep failing.
BRaise or remove the workspace spend limit
Correct
A spend limit you set returns 400 invalid_request_error until it is raised or removed, or access resumes.
CFix the request bodies, since a 400 always means malformed input
Incorrect
The API also returns a 400 when usage reaches a spend limit you set.
DCreate a new API key in the same workspace and switch the requests to it
Incorrect
The limit is set on the workspace, so a new key in it hits the same limit.
When usage reaches a spend limit you set, requests return HTTP 400 with invalid_request_error and a message saying when access resumes. Raise or remove the limit to restore access sooner.