Question 90
An API stream occasionally ends after receiving partial content. What must the consumer not assume?
- Activate prompt caching on the reusable prefix of the request.
- Do not treat partial streaming deltas as a finalized, validated response.
- Use supported asynchronous SDK calls or async HTTP I/O with bounded concurrency.
- Process the intermediate tool round trip before rendering a completed assistant turn.
Explanation
Correct Answer
B:A stream must be assembled and its final completion or error state inspected; interim bytes may not form a complete answer.
Incorrect Answers
A:Cache hits avoid reprocessing the identical policy prefix; dynamic user content should appear after the stable portion; this may help shared request prefix reuse but cannot by itself deliver streaming completion safety.
C:Nonblocking request handling lets the service overlap remote latency while maintaining explicit limits on in-flight work; for streaming completion safety, this instead manages multi-criterion integration; the requested decision remains unresolved.
D:Tool-enabled interactions can require multiple Messages calls; the final user experience is not always one HTTP request; this targets multi-call conversational tool flow, while the system must demonstrate streaming completion safety.
Question 91
An application enables Claude’s server-executed web search tool and also defines a custom client-executed inventory lookup. Which execution responsibility is correct?
- Treat both tool types as plain final-answer text and omit all execution handling.
- Assume Anthropic can directly call the private inventory database because its schema is included.
- Let Anthropic run supported server tools while the application dispatches its custom inventory tool.
- Execute the server-side web search locally and return a client tool_result for every search call.
Explanation
Correct Answer
C:Server tools execute through the provider’s infrastructure; client tools yield tool_use blocks for the caller to execute and report. The application must distinguish these tool categories rather than assuming one universal executor.
Incorrect Answers
A:Client tool requests are intermediate control events, not final prose. Ignoring them prevents the inventory operation from taking place and leaves the conversation incomplete.
B:A tool declaration exposes the callable interface, not the private implementation or credentials. A client-executed inventory operation still requires authorized application code.
D:A server-executed tool is not a customer-defined function. Duplicating its execution in the host can break the expected control flow and misinterpret server-side result blocks.
Question 92
A Messages API request includes an assistant tool_use message and the next user message contains both a short note and a tool_result. Which ordering follows the documented client-tool protocol?
- Place the matching tool_result blocks first in the immediately following user message, then any permitted text.
- Send the result as an unrelated tool_use block with a new ID.
- Put a user text note before the tool_result because it is easier for a person to read.
- Insert a second assistant narrative turn between tool_use and tool_result.
Explanation
Correct Answer
A:The protocol expects tool results immediately after the assistant tool-use turn, with tool_result content blocks preceding ordinary text. The caller also preserves each result’s tool_use_id so the model can match it to the request.
Incorrect Answers
B:A new tool_use proposes an operation rather than reporting a completed one. A proper tool_result refers back to the existing call and preserves protocol correlation.
C:Readable prose does not override the content-block ordering constraint. A tool_result must come first, or the API can reject the request as an invalid tool-use exchange.
D:The intermediate assistant text breaks the required adjacency between the tool-use request and its corresponding result. The application should not manufacture an extra dialogue turn.
Question 93
A caller configures an explicit stop sequence in a Claude message. The response ends with stop_reason stop_sequence rather than end_turn. What should the client infer?
- Assume that authorization must derive from verified server-side identity, not client-controlled fields.
- Assume that compile-time types cannot verify data received from the network at runtime.
- The configured stop marker was matched, and the caller must check whether the task output is complete.
- The application's client-side tool dispatcher executes the proposed operation.
Explanation
Correct Answer
C:A matched stop sequence is an application-defined generation boundary, not proof that every requested section or business step has finished; validate the result before acting.
Incorrect Answers
A:Untrusted request payloads can be altered; tools require authoritative permission checks independently of what the model or client claims; this implements trusted authorization source rather than the demanded stop-sequence completion semantics.
B:A type assertion changes static checking, not external payloads; runtime schema validation is needed before acting on fields; testing stop-sequence completion semantics would still fail after improving runtime versus static typing.
D:Model output is a request to the caller, not a database invocation; the application validates and runs the tool before continuing the conversation; for stop-sequence completion semantics, this instead manages client-side tool execution; the requested decision remains unresolved.
Question 94
A Claude response reaches max_tokens while it is still constructing input for a tool call. What should the executor avoid?
- Assume the partial input is valid because the HTTP response status is successful.
- Convert the partial argument text into a privileged shell command automatically.
- Avoid executing a partially generated tool request; inspect the stop reason and recover with a complete input.
- Record the partial content as a successful completed side effect in the transaction ledger.
Explanation
Correct Answer
C:A generation limit can interrupt structured tool-call construction. Executing fragments as if they were validated arguments risks malformed or unintended actions, so the host must obtain and verify a complete call first.
Incorrect Answers
A:HTTP success proves transport delivery, not completion of the model-generated tool payload. The stop_reason and the structure of the returned content determine whether dispatch is safe.
B:Fallback from incomplete structured input to arbitrary shell execution expands authority and loses schema validation. It is particularly unsafe for tools that mutate external state.
D:A response fragment is not an execution receipt. Marking a business action complete before dispatch and confirmation would corrupt state and conceal a failed tool round trip.
Question 95
A team asks Claude to identify objects in a photograph. How should the request carry the visual input?
- Send a tool_result block carrying the matching tool_use_id.
- Send again the relevant prior messages or maintained conversation state with each request.
- Supply the image as a supported image content block in a user message.
- Cross-check results with their custom_id values.
- Adopt a document input path supporting visual PDF processing on the chosen platform.
Explanation
Correct Answer
C:Vision is driven by multimodal message content, not by giving Claude a local filename it cannot access. The client must send actual image bytes or a supported accessible image reference rather than merely naming a local path.
Incorrect Answers
A:The ID links observations to the tool-call block; arbitrary plain text loses protocol-level association; this may help tool-result identifier matching but cannot by itself deliver API image content structure.
B:The Messages API is stateless with respect to caller history; the client owns the turns it wants Claude to use; it changes explicit conversation history; it does not prove API image content structure in this case.
D:A stable per-request identifier supports correct correlation despite asynchronous processing or reordered completion; the API image content structure criterion differs from batch result association; the gap persists.
E:Extraction of plain text alone can omit layout and charts; document support and provider-specific feature parity matter; the scenario's controlling requirement is API image content structure, not the related visually rich PDF ingestion concern.
Question 96
A scanned contract contains charts that must be interpreted visually. What should the integration confirm?
- Manage the intermediate tool round trip before rendering a completed assistant turn.
- As an alternative, request streaming and consume server-sent events incrementally.
- Hold before executing the mutating client tool and await explicit approval.
- Use a document input path supporting visual PDF processing on the chosen platform.
Explanation
Correct Answer
D:Extraction of plain text alone can omit layout and charts; document support and provider-specific feature parity matter.
Incorrect Answers
A:Tool-enabled interactions can require multiple Messages calls; the final user experience is not always one HTTP request; the effect concerns multi-call conversational tool flow; the success condition is visually rich PDF ingestion.
B:Streaming yields content deltas before the complete message is assembled, reducing perceived wait time for the user; the consequence is improved incremental text presentation, not verified visually rich PDF ingestion.
C:The model may generate a valid tool request, but the host owns side effects and can withhold execution until policy authorization is satisfied; the consequence is improved approval before tool execution, not verified visually rich PDF ingestion.
Question 97
A long fixed legal policy is sent with every user query, and requests repeat frequently. Which API feature should be evaluated?
- Employ supported asynchronous SDK calls or async HTTP I/O with bounded concurrency.
- Inspect the permitted file and attach supported content through the API.
- Enable prompt caching on the reusable prefix of the request.
- Include again the relevant prior messages or maintained conversation state with each request.
Explanation
Correct Answer
C:Cache hits avoid reprocessing the identical policy prefix; dynamic user content should appear after the stable portion.
Incorrect Answers
A:Nonblocking request handling lets the service overlap remote latency while maintaining explicit limits on in-flight work; the scenario's controlling requirement is shared request prefix reuse, not the related multi-criterion integration concern.
B:A pathname is not a transferable attachment; the caller controls file access, serialization, and privacy checks before a request is sent; changing local file ingestion by caller does not establish shared request prefix reuse in this application.
D:The Messages API is stateless with respect to caller history; the client owns the turns it wants Claude to use; this may help explicit conversation history but cannot by itself deliver shared request prefix reuse.
Question 98
A dynamic timestamp is inserted before a cached policy, causing zero cache reads. What is the likely fix?
- Move changing context after the stable cached prefix.
- Honor rate limits and retry eligible requests with bounded exponential backoff.
- Deal with the intermediate tool round trip before rendering a completed assistant turn.
- Compare results with their custom_id values.
Explanation
Correct Answer
A:Cache keys depend on the preceding content and ordering, so early variation invalidates reuse even when the policy text is unchanged.
Incorrect Answers
B:Throttling indicates temporary capacity allocation rather than malformed prompt syntax; uncontrolled immediate retries amplify pressure; it changes rate limit handling; it does not prove cache prefix stability in this case.
C:Tool-enabled interactions can require multiple Messages calls; the final user experience is not always one HTTP request; even if multi-call conversational tool flow succeeds, cache prefix stability still needs separate verification.
D:A stable per-request identifier supports correct correlation despite asynchronous processing or reordered completion; for cache prefix stability, a control centered on batch result association is not the appropriate substitute.
Question 99
A backend must classify ten thousand independent records before the next business day. What call mode is appropriate?
- Relocate changing context after the stable cached prefix.
- Submit independent Messages requests through the Message Batches API.
- Examine each result and retry only the failed or expired requests as appropriate.
- Walk through content blocks by type rather than reading only the first text item.
Explanation
Correct Answer
B:Asynchronous batches suit throughput-oriented, latency-tolerant jobs; they are not a synchronous streaming response channel.
Incorrect Answers
A:Cache keys depend on the preceding content and ordering, so early variation invalidates reuse even when the policy text is unchanged; a remedy for cache prefix stability is not a substitute for asynchronous independent classification.
C:Batch processing has per-request outcomes; blindly replaying successful items wastes cost and can repeat external work; it follows partial batch failure recovery constraints but leaves asynchronous independent classification unspecified.
D:Messages responses can be heterogeneous; ignoring block types can hide tool requests or other structured content; the effect concerns heterogeneous response blocks; the success condition is asynchronous independent classification.
Question 100
Batch results arrive in a different order than the input requests. What should the ingestion code use?
- Send a valid max_tokens output budget for the message.
- Adopt supported asynchronous SDK calls or async HTTP I/O with bounded concurrency.
- Reconcile results with their custom_id values.
- As an alternative, do not treat partial streaming deltas as a finalized, validated response.
- Apply a document input path supporting visual PDF processing on the chosen platform.
Explanation
Correct Answer
C:A stable per-request identifier supports correct correlation despite asynchronous processing or reordered completion.
Incorrect Answers
A:The Messages request contract includes an output limit; omitting required generation parameters causes an invalid request rather than unlimited output; a remedy for required output budget is not a substitute for batch result association.
B:Nonblocking request handling lets the service overlap remote latency while maintaining explicit limits on in-flight work; the effect concerns multi-criterion integration; the success condition is batch result association.
D:A stream must be assembled and its final completion or error state inspected; interim bytes may not form a complete answer; the effect concerns streaming completion safety; the success condition is batch result association.
E:Extraction of plain text alone can omit layout and charts; document support and provider-specific feature parity matter; even if visually rich PDF ingestion succeeds, batch result association still needs separate verification.