Question 20
A service receives an end_turn response after one tool result. How should its dispatch loop react?
- Specify and validate a typed input schema at the tool boundary.
- Interpret content blocks by type rather than treating the response as one string.
- Send a structured tool_result describing the failure without fabricating inventory.
- Exit the tool loop and deliver the completed assistant response.
Explanation
Correct Answer
D:end_turn indicates the current assistant turn has finished, so blindly issuing another tool call would add unnecessary steps.
Incorrect Answers
A:Explicit fields and runtime validation reject malformed inputs before touching external systems; model-generated arguments are not trusted by default; the recognizing completion criterion differs from tool argument validation; the gap persists.
B:Tool_use blocks carry structured inputs and IDs, not user-facing prose; the harness must branch on content type and stop reason; where recognizing completion matters, a control for content-block-aware parsing leaves that test unmet.
C:Reporting the real error lets the model revise its plan or explain the limitation; silent invention hides a failed integration; this may help surfacing client-tool errors but cannot by itself deliver recognizing completion.
Question 21
An agent requests two independent read-only tools in one assistant turn. What should a robust harness handle?
- Employ an idempotency key or deduplication record for the mutation.
- Execute both calls and return a result associated with each distinct tool_use ID.
- Store the session identifiers and supported state needed for resumption.
- End the tool loop and deliver the completed assistant response.
Explanation
Correct Answer
B:Multiple tool-use blocks may occur together; correlation is required so Claude can attribute observations to the correct requests.
Incorrect Answers
A:A repeated call after an uncertain outcome must not create duplicate side effects; idempotent execution protects state across retries; changing retry-safe external writes does not establish parallel tool result correlation in this application.
C:Long-running interaction cannot rely on in-memory local variables across process lifetimes; session continuity needs an explicit persistence design; this implements session resumption state rather than the demanded parallel tool result correlation.
D:End_turn indicates the current assistant turn has finished, so blindly issuing another tool call would add unnecessary steps; it improves recognizing completion only, leaving parallel tool result correlation unproven.
Question 22
A Claude application invokes a server-executed search tool and receives stop_reason pause_turn after the provider-side search loop reaches its limit. No client tool call is pending. What is the appropriate continuation?
- Discard the tool definitions and restart the conversation from an empty transcript.
- Treat pause_turn exactly like end_turn and present the incomplete search as the final verified answer.
- Send the paused assistant content back in a subsequent Messages request, retaining the server tool definition and applying a continuation cap.
- Send an invented client tool_result for the server-side search block and assume it will resume.
Explanation
Correct Answer
C:A pause_turn stop reason means the provider-side tool loop has paused, not that the host must run a client tool. Passing back the assistant content allows the server tool turn to continue, while a bounded continuation policy prevents runaway work.
Incorrect Answers
A:The paused assistant content contains the information needed to resume the tool loop. Removing the declared server tool and conversation state prevents the provider from reliably completing the pending work.
B:A paused turn is not a completed answer. Showing unfinished text as verified would mask missing search work rather than letting the service continue within an explicit work budget.
D:Server tools are executed by the service and do not require customer-created client tool_result blocks. Fabricating a result confuses tool categories and can break the expected conversation sequence.
Question 23
A system permits an agent to read private issue tickets but forbids posting comments automatically. Where should the write restriction be enforced?
- Set up deterministic hooks around the tool lifecycle.
- Treat the response as truncated and continue or retry with a suitable output budget.
- As an alternative, cap retries and apply backoff with a terminal failure path.
- Remove comment-posting authority from the agent's available tools.
Explanation
Correct Answer
D:The harness can deny the capability entirely; prompt instructions or post-hoc logs cannot enforce a missing permission boundary.
Incorrect Answers
A:Hook handlers are executed by the framework at defined events and can record metadata independently of model-generated prose; because deterministic tool event instrumentation is its concern, limiting agent write authority remains outside its effect here.
B:A token-budget stop is not equivalent to successful completion or a tool request; the caller must decide how to obtain a complete answer; it changes truncated response handling; it does not prove limiting agent write authority in this case.
C:Retry policy is operational control of the executor, not a reasoning preference; limits prevent a looping agent from exhausting cost and capacity; the effect concerns bounded transient error retries; the success condition is limiting agent write authority.
Question 24
A developer wants production tracing around every tool invocation without asking Claude to remember to log. Which agent construction feature fits?
- Regard the response as truncated and continue or retry with a suitable output budget.
- Pass through cancellation and cleanly stop outstanding work where possible.
- Install deterministic hooks around the tool lifecycle.
- As an alternative, remove comment-posting authority from the agent's available tools.
- Condense or filter tool observations before reinserting them into context.
Explanation
Correct Answer
C:Hook handlers are executed by the framework at defined events and can record metadata independently of model-generated prose.
Incorrect Answers
A:A token-budget stop is not equivalent to successful completion or a tool request; the caller must decide how to obtain a complete answer; for deterministic tool event instrumentation, a control centered on truncated response handling is not the appropriate substitute.
B:The execution layer owns task lifecycle and resource cleanup; another model message cannot reliably cancel a pending network operation; the effect concerns cancellation lifecycle; the success condition is deterministic tool event instrumentation.
D:The harness can deny the capability entirely; prompt instructions or post-hoc logs cannot enforce a missing permission boundary; the deterministic tool event instrumentation criterion differs from limiting agent write authority; the gap persists.
E:Returning only the relevant log evidence preserves the token budget and reduces distraction while retaining pointers to original records; it follows controlled observation size constraints but leaves deterministic tool event instrumentation unspecified.
Question 25
An integration team needs a custom event loop with its own database, queue, and retry scheduler. What approach offers the most direct control?
- Forward cancellation and cleanly stop outstanding work where possible.
- For this workflow, cap retries and apply backoff with a terminal failure path.
- Wrap external tools so deterministic test doubles can replace real connectors.
- Build a custom Messages API harness that owns dispatch and state.
Explanation
Correct Answer
D:Direct orchestration exposes scheduling, persistence, error handling, and tool-execution boundaries; it trades framework convenience for precise integration control.
Incorrect Answers
A:The execution layer owns task lifecycle and resource cleanup; another model message cannot reliably cancel a pending network operation; because cancellation lifecycle is its concern, custom orchestrator control remains outside its effect here.
B:Retry policy is operational control of the executor, not a reasoning preference; limits prevent a looping agent from exhausting cost and capacity; even if bounded transient error retries succeeds, custom orchestrator control still needs separate verification.
C:Dependency boundaries allow simulated responses and failure injection, making tool-loop behavior reproducible without real side effects; for this request, custom orchestrator control is the missing piece, not testing agent tool adapters.
Question 26
A prototype uses the Claude Agent SDK and needs session continuation after a process restart. What should the engineer plan for?
- Monitor successful source results in harness state and guard finalization on that state.
- Construct a custom Messages API harness that owns dispatch and state.
- Persist the session identifiers and supported state needed for resumption.
- Encapsulate external tools so deterministic test doubles can replace real connectors.
Explanation
Correct Answer
C:Long-running interaction cannot rely on in-memory local variables across process lifetimes; session continuity needs an explicit persistence design.
Incorrect Answers
A:Model confidence is not evidence of completed external calls; explicit state permits an auditable completion predicate; it follows verifiable completion criteria constraints but leaves session resumption state unspecified.
B:Direct orchestration exposes scheduling, persistence, error handling, and tool-execution boundaries; it trades framework convenience for precise integration control; because custom orchestrator control is its concern, session resumption state remains outside its effect here.
D:Dependency boundaries allow simulated responses and failure injection, making tool-loop behavior reproducible without real side effects; the consequence is improved testing agent tool adapters, not verified session resumption state.
Question 27
A system calls a client-side inventory tool and gets an authorization error. What should enter the conversation next?
- Employ a pre-execution hook or permission gate that can deny disallowed commands.
- Return a structured tool_result describing the failure without fabricating inventory.
- Stop the tool loop and deliver the completed assistant response.
- Run the requested client tools and return linked tool_result blocks in a new user message.
Explanation
Correct Answer
B:Reporting the real error lets the model revise its plan or explain the limitation; silent invention hides a failed integration.
Incorrect Answers
A:A deterministic inspection point can block a call before side effects occur; a prompt-based reminder cannot replace the gate; this implements command pre-execution denial rather than the demanded surfacing client-tool errors.
C:End_turn indicates the current assistant turn has finished, so blindly issuing another tool call would add unnecessary steps; the scenario's controlling requirement is surfacing client-tool errors, not the related recognizing completion concern.
D:Client tools do not run merely because the model emitted a tool_use block; the caller must dispatch them and preserve the tool_use identifiers; the effect concerns handling a tool request; the success condition is surfacing client-tool errors.
Question 28
A policy requires all potentially destructive shell actions to be checked before execution, even if the agent believes they are safe. How can this be enforced?
- Use a pre-execution hook or permission gate that can deny disallowed commands.
- Save job state outside ephemeral request workers and resume from checkpoints.
- Carry out the requested client tools and return linked tool_result blocks in a new user message.
- Adopt an idempotency key or deduplication record for the mutation.
Explanation
Correct Answer
A:A deterministic inspection point can block a call before side effects occur; a prompt-based reminder cannot replace the gate.
Incorrect Answers
B:Long-running tasks must survive worker termination; relying on a single request's memory risks losing progress and repeating side effects; when the goal is command pre-execution denial, optimizing durable long-running agent execution misses that operational boundary.
C:Client tools do not run merely because the model emitted a tool_use block; the caller must dispatch them and preserve the tool_use identifiers; because handling a tool request is its concern, command pre-execution denial remains outside its effect here.
D:A repeated call after an uncertain outcome must not create duplicate side effects; idempotent execution protects state across retries; the consequence is improved retry-safe external writes, not verified command pre-execution denial.
Question 29
An agent sometimes emits a tool_use block, but a developer treats the whole response as display text. What correction is required?
- Execute file tools under filesystem permissions that deny that directory.
- Interpret the response as truncated and continue or retry with a suitable output budget.
- Adopt a pre-execution hook or permission gate that can deny disallowed commands.
- Parse content blocks by type rather than treating the response as one string.
Explanation
Correct Answer
D:tool_use blocks carry structured inputs and IDs, not user-facing prose; the harness must branch on content type and stop reason.
Incorrect Answers
A:Operating-system boundaries block writes even if the model chooses an unsafe path; a natural-language prohibition alone is not sufficient; for content-block-aware parsing, a control centered on filesystem scope restriction is not the appropriate substitute.
B:A token-budget stop is not equivalent to successful completion or a tool request; the caller must decide how to obtain a complete answer; this implements truncated response handling rather than the demanded content-block-aware parsing.
C:A deterministic inspection point can block a call before side effects occur; a prompt-based reminder cannot replace the gate; a remedy for command pre-execution denial is not a substitute for content-block-aware parsing.
Question 30
A research agent must make a final answer only after three data sources have been queried successfully. How should completion be determined?
- Track successful source results in harness state and guard finalization on that state.
- Leave the tool loop and deliver the completed assistant response.
- Provide a structured tool_result describing the failure without fabricating inventory.
- Save the session identifiers and supported state needed for resumption.
Explanation
Correct Answer
A:Model confidence is not evidence of completed external calls; explicit state permits an auditable completion predicate.
Incorrect Answers
B:End_turn indicates the current assistant turn has finished, so blindly issuing another tool call would add unnecessary steps; the effect concerns recognizing completion; the success condition is verifiable completion criteria.
C:Reporting the real error lets the model revise its plan or explain the limitation; silent invention hides a failed integration; the consequence is improved surfacing client-tool errors, not verified verifiable completion criteria.
D:Long-running interaction cannot rely on in-memory local variables across process lifetimes; session continuity needs an explicit persistence design; even if session resumption state succeeds, verifiable completion criteria still needs separate verification.