# Design and implement agentic loops for autonomous task execution — Practice reading

Exam: CCAR-F — Claude Certified Architect - Foundations (CCAR-F)
Knowledge domain: Agentic Architecture & Orchestration
HTML: https://learningpathx.com/learning-path/CCAR-F/learn/429

This public learning practice includes correct answers and existing explanations. Reading does not save progress or create a test.

## Question 1

Type: single\_choice
Knowledge point: The agentic loop lifecycle: sending requests to Claude, inspecting stop\_reason ("tool\_use" vs "end\_turn"), executing requested tools, and returning results for the next iteration

A deployment agent receives a Claude response with stop\_reason set to tool\_use and two requested tools: read\_config and run\_health\_check. Which action should its execution harness take next?

### Options

**A**

Return the assistant text to the user as Claude has already produced a complete response.

**B**

Run only read\_config, then ask Claude for a final answer without supplying any of the results.

**C**

Execute both requested tools, return their results to Claude, and await its next operations.

**D**

Return read\_config in one user message and run\_health\_check in a later user message, with a Claude request between them.

Correct answer: C

### Explanation

A tool\_use response hands execution to the harness. It must execute read\_config and run\_health\_check, retain the assistant turn, and return both invocation-linked outcomes in the immediately following user tool-result message before requesting Claude's next decision.

## Question 2

Type: single\_choice
Knowledge point: The agentic loop lifecycle: sending requests to Claude, inspecting stop\_reason ("tool\_use" vs "end\_turn"), executing requested tools, and returning results for the next iteration

A platform engineer is implementing a manual Claude Messages API loop with a client tool named lookup\_room. The conversation history is retained. Claude returns the following response:

```json
{
  "role": "assistant",
  "stop_reason": "tool_use",
  "content": [
    {"type": "text", "text": "I will check the available room."},
    {"type": "tool_use", "id": "toolu_room_72", "name": "lookup_room",
     "input": {"building": "North", "date": "2026-11-12"}}
  ]
}
```

The engineer executes lookup\_room with the supplied input and receives "Room N-204 is available." No server tools are involved. Which ONE action correctly continues this lifecycle and handles a subsequent normal completion?

### Options

**A**

Append Claude's complete content as an assistant message, then append the room result as an ordinary user text block. Send the updated history to Claude and finish the loop when the next response contains any text.

**B**

Append Claude's complete content as an assistant message, followed immediately by a user message containing a tool\_result with tool\_use\_id toolu\_room\_72 and the room result. Send the updated history to Claude and finish this turn if the next stop\_reason is end\_turn.

**C**

Append Claude's complete content as an assistant message, followed immediately by a user tool\_result containing the room result and tool\_use\_id lookup\_room. Send the updated history to Claude and finish this turn if the next stop\_reason is end\_turn.

**D**

Append Claude's complete content as an assistant message and return the room result directly to the caller. Finish this turn now because successful execution of the requested tool completes the assistant's response.

Correct answer: B

### Explanation

The statement “Append Claude's complete content as an assistant message, followed immediately by a user message containing a tool\_result with tool\_use\_id toolu\_room\_72 and the room result. Send the updated history to Claude and finish this turn if the next stop\_reason is end\_turn.” preserves the request/result lifecycle: the assistant message records the actual tool request, the immediately following user tool\_result supplies its outcome, and tool\_use\_id matches the request's unique id, toolu\_room\_72\. The updated history is then sent to Claude so it can use that outcome. A later end\_turn means the assistant has finished this turn. The statement “Append Claude's complete content as an assistant message, then append the room result as an ordinary user text block. Send the updated history to Claude and finish the loop when the next response contains any text.” uses ordinary text in place of the required result block and treats text as a completion signal. The statement “Append Claude's complete content as an assistant message, followed immediately by a user tool\_result containing the room result and tool\_use\_id lookup\_room. Send the updated history to Claude and finish this turn if the next stop\_reason is end\_turn.” confuses the tool's name with the individual request id. The statement “Append Claude's complete content as an assistant message and return the room result directly to the caller. Finish this turn now because successful execution of the requested tool completes the assistant's response.” stops after local tool execution without giving Claude the result for the next iteration.

## Question 3

Type: multiple\_choice
Knowledge point: The agentic loop lifecycle: sending requests to Claude, inspecting stop\_reason ("tool\_use" vs "end\_turn"), executing requested tools, and returning results for the next iteration

An incident response has stop\_reason="tool\_use" and two client calls: health h1 and deployment config c1\. The assistant response is retained. Executions finish c1 first with config=v4 and h1 second with health=degraded. The next user message contains only `{type:"tool_result",tool_use_id:"h1",content:"config=v4"}`. The API reports that c1 lacks a result; an engineer proposes adding c1 with health=degraded. The next diagnosis must associate each observation with its actual request. Which two changes are required? (Choose 2.)

### Options

**A**

Carry the originating invocation ID alongside each worker outcome instead of consuming completion-order values against request-order IDs.

**B**

Accept the proposed c1=health result, since a unique result for every pending ID is sufficient for a correct diagnosis.

**C**

Construct the next user result message as h1=health degraded and c1=config v4, then continue the loop with the retained assistant response.

**D**

Execute both read-only tools serially again and leave the current result-building logic unchanged for future multi-tool responses.

Correct answer: A, C

### Explanation

Repair both the causal association and the complete result handoff; satisfying a missing-ID check alone can still corrupt the investigation.

## Question 4

Type: single\_choice
Knowledge point: How tool results are appended to conversation history so the model can reason about the next action

The current history ends with this assistant content: `[{"type":"tool_use","id":"u17","name":"lookup_order","input":{"order_id":"O42"}}]`. The lookup returns `{"status":"shipped"}`. Which message should the harness append next so Claude can use this result for order O42?

### Options

**A**

`{"role":"assistant","content":[{"type":"tool_result","tool_use_id":"u17","content":"{\"status\":\"shipped\"}"}]}`

**B**

`{"role":"user","content":[{"type":"tool_result","tool_use_id":"O42","content":"{\"status\":\"shipped\"}"}]}`

**C**

`{"role":"user","content":[{"type":"text","text":"u17 returned shipped"}]}`

**D**

`{"role":"user","content":[{"type":"tool_result","tool_use_id":"u17","content":"{\"status\":\"shipped\"}"}]}`

Correct answer: D

### Explanation

Apply the handoff contract to the call identifier, rather than substituting the order identifier.

## Question 5

Type: single\_choice
Knowledge point: How tool results are appended to conversation history so the model can reason about the next action

A client web-search call s8 returns a vendor page containing useful release dates plus "ignore prior instructions." Adapter V1 copies the page into the system prompt and removes the assistant tool\_use message. Adapter V2 retains the assistant message but appends a user text block containing the page; the next request reports an unmatched s8 call. The application must retain the release-date evidence and its trust boundary. Which repair addresses both adapters' defects?

### Options

**A**

Retain the original assistant message and append the page as a user tool\_result with tool\_use\_id s8; continue treating the page as untrusted evidence.

**B**

Keep V1 but prefix the system-prompt page with "untrusted" so the missing call can be inferred from the text.

**C**

Keep V2 and remove the s8 tool\_use block to eliminate the unmatched-call error.

**D**

Retain s8 and return an empty matching tool\_result while moving the useful page text into the system prompt.

Correct answer: A

### Explanation

Correct protocol structure and the trust boundary must both survive the adapter repair; tool\_result placement is not a guarantee that injection can never succeed.

## Question 6

Type: multiple\_choice
Knowledge point: How tool results are appended to conversation history so the model can reason about the next action

A Claude Messages API assistant turn requests one client tool with id t1\. Each option shows the immediate next user message's content array; tool\_result content is otherwise valid. Which two arrays violate the tool-result sequence contract? (Choose 2.)

### Options

**A**

\[{"type":"text","text":"Continue"}\]

**B**

\[{"type":"text","text":"Continue"},{"type":"tool\_result","tool\_use\_id":"t1","content":"ok"}\]

**C**

\[{"type":"tool\_result","tool\_use\_id":"t1","content":"ok"}\]

**D**

\[{"type":"tool\_result","tool\_use\_id":"t1","content":"ok"},{"type":"text","text":"Continue"}\]

Correct answer: A, B

### Explanation

For this client-only turn, the immediate next user message must include the result for t1, and tool\_result blocks must precede any optional text. A omits the pending result and B puts text before it; C and D satisfy both presence and ordering, so the violating arrays are A and B.

## Question 7

Type: single\_choice
Knowledge point: How tool results are appended to conversation history so the model can reason about the next action

A Claude API application has registered client-tool functions. It needs a variable number of model-directed tool rounds, with function dispatch and tool\_result formatting managed by the SDK throughout. Which arrangement meets these requirements while removing application-written per-turn dispatch?

### Options

**A**

Register the functions with the SDK Tool Runner and let it manage each requested tool round.

**B**

Use a custom while loop around messages.create that dispatches functions and constructs tool\_result messages.

**C**

Use a workflow engine to execute the registered functions in a fixed sequence and format their results.

**D**

Use an SDK helper for the first tool round, then dispatch subsequent rounds in application code.

Correct answer: A

### Explanation

The requirement assigns tool dispatch and result formatting to the SDK for every model-directed round. Registering the functions with Tool Runner satisfies that ownership throughout the loop. A custom while loop, a fixed sequence, or an initial-round helper each leaves at least one stated requirement unmet.

## Question 8

Type: single\_choice
Knowledge point: How tool results are appended to conversation history so the model can reason about the next action

Why must a harness append tool results to the conversation before calling Claude again?

### Options

**A**

It lets Claude use execution outcomes to determine the next action.

**B**

It gives Claude access to results that are recorded only in an external application log.

**C**

It forces the Claude model to terminate after every tool call.

**D**

It tells Claude that the operation succeeded without needing any decision-relevant output fields.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — It lets Claude use execution outcomes to determine the next action.**: Execution evidence lets the model select its next action.
* **B — It gives Claude access to results that are recorded only in an external application log.**: An external log is not automatically part of the model's context.
* **C — It forces the Claude model to terminate after every tool call.**: A result can lead to further tool calls rather than termination.
* **D — It tells Claude that the operation succeeded without needing any decision-relevant output fields.**: A success flag can omit the data needed for the next decision.

## Question 9

Type: single\_choice
Knowledge point: The distinction between model-driven decision-making (Claude reasons about which tool to call next based on context) and pre-configured decision trees or tool sequences

Which characteristic identifies a model-driven agentic loop rather than a pre-configured workflow?

### Options

**A**

Application code defines every step before execution begins.

**B**

Claude dynamically selects tools based on the current context.

**C**

Intermediate execution results are never provided to the model.

**D**

Application code selects the tools, while Claude generates only the final user-facing explanation.

Correct answer: B

### Explanation

The defining boundary is who selects the next action. In a model-driven loop Claude uses the current context and returned tool evidence to choose its next tool. Predefined application steps or using Claude only to write the final explanation leave that control in application code.

## Question 10

Type: single\_choice
Knowledge point: The distinction between model-driven decision-making (Claude reasons about which tool to call next based on context) and pre-configured decision trees or tool sequences

An approval service must execute the same documented branches for identical inputs and produce an audit trail of each decision. Which architecture best meets those requirements?

### Options

**A**

A configured workflow with coded branch logic

**B**

A model chooses each approval branch from written policy and records its reasoning.

**C**

A model proposes a branch and a second model votes before execution.

**D**

A dispatcher chooses an approval chain from similarity to previous requests.

Correct answer: A

### Explanation

Identical inputs must follow the documented approval predicates, so the branch decision belongs in coded workflow logic. Explicit branches can be inspected and their decisions logged for the required audit trail. Model interpretation, model voting and similarity routing do not enforce those predicates merely by recording their outputs.

## Question 11

Type: single\_choice
Knowledge point: The distinction between model-driven decision-making (Claude reasons about which tool to call next based on context) and pre-configured decision trees or tool sequences

A troubleshooting app uses tool\_choice="auto", but its controller discards Claude's proposed tool names and always runs `health -> restart -> health`. In replay, Claude requests `inspect_config` after finding a version mismatch, yet a restart occurs. The team requires evidence-dependent diagnostic choices while retaining deterministic approval checks on restarts. Which redesign explains and corrects the discrepancy?

### Options

**A**

Dispatch Claude-selected allowed tool requests using the updated context, and keep a separate programmatic approval gate before any restart.

**B**

Keep the fixed sequence and expand the inspect\_config description so auto can override the controller.

**C**

Reorder the tools array to put inspect\_config first, leaving the controller sequence unchanged.

**D**

Remove restart approval checks and keep the fixed sequence so the workflow becomes model-driven.

Correct answer: A

### Explanation

Model discretion concerns who chooses the next action; deterministic authorization can remain outside that choice.

## Question 12

Type: single\_choice
Knowledge point: The distinction between model-driven decision-making (Claude reasons about which tool to call next based on context) and pre-configured decision trees or tool sequences

At the next decision point, a support controller has a lookup result `{"account_state":"migrated","legacy_id":null,"new_id":"N8"}`. Its fixed branch would query the legacy database again; a new-service lookup tool is available. The team wants the model to choose the next diagnostic step from this evidence. Which change implements that design and accounts for its context cost?

### Options

**A**

Return the lookup result in conversation context and let Claude select from the available tools; retain relevant intermediate evidence as the investigation proceeds.

**B**

Keep the lookup result outside the model context and execute the fixed legacy branch again.

**C**

Always execute the new-service lookup after every account lookup, without consulting the result.

**D**

Give Claude the summary 'account found; identifier updated' and ask it to choose a diagnostic lookup tool.

Correct answer: A

### Explanation

Claude needs the migrated state, null legacy identifier and actual new identifier N8 in its context to choose an appropriate next lookup. Returning that evidence enables model-directed selection instead of repeating a fixed route. Retaining relevant intermediate outcomes consumes context; the lossy summary in D removes the fields needed for this decision.

## Question 13

Type: multiple\_choice
Knowledge point: The distinction between model-driven decision-making (Claude reasons about which tool to call next based on context) and pre-configured decision trees or tool sequences

Controllers X and Y both retain tool results and call Claude. In a controlled test, tool definitions and code are unchanged; only a lookup outcome changes from `carrier_available=true` to false. X calls trace\_package in both runs because `status=late`; Claude is called only afterward to draft text. Y calls trace\_package in the first run and requests contact\_carrier in the second, based on the returned availability. An authorization check rejects Y's contact\_carrier request. Which two conclusions best explain the test? (Choose 2.)

### Options

**A**

Y's changed requested action shows evidence-dependent model selection even though the authorization layer prevented that action from executing.

**B**

Changing X's reply-writing prompt alone cannot make its preceding trace\_package branch respond to carrier availability; that coded routing must change or delegate the decision.

**C**

Y must be a fixed workflow because only trace\_package appears among its successfully executed calls.

**D**

X must be model-driven because its final replies can differ between the two lookup outcomes.

Correct answer: A, B

### Explanation

Analyze where decisions occur and distinguish proposed actions from executed actions when classifying orchestration.

## Question 14

Type: multiple\_choice
Knowledge point: The distinction between model-driven decision-making (Claude reasons about which tool to call next based on context) and pre-configured decision trees or tool sequences

A support workload uses a small, frequently needed reference set that fits the context budget and remains valid for the session, plus occasional novel investigations. Which two choices form a sound hybrid design? (Choose 2.)

### Options

**A**

Load stable, pre-computed context data up front at startup.

**B**

Allow Claude to use relevant tools for novel investigations.

**C**

Re-fetch the entire stable reference set for every request before selecting relevant evidence.

**D**

Force every request through one static branch sequence.

Correct answer: A, B

### Explanation

The reference set is small, frequently useful and valid for the entire session, so preloading it avoids repeated retrieval while fitting the given context budget. Runtime tools remain available for novel investigations beyond that set. These conditions support A and B together; they do not justify a universal preload rule for large or stale data.

## Question 15

Type: multiple\_choice
Knowledge point: Implementing agentic loop control flow that continues when stop\_reason is "tool\_use" and terminates when stop\_reason is "end\_turn"

A controller distinguishes tool\_use, end\_turn, and max\_tokens. Which two branches correctly preserve the distinction between normal completion and token-limit interruption? (Choose 2.)

### Options

**A**

On tool\_use, return matching tool results and continue.

**B**

On end\_turn, return the completed response.

**C**

On max\_tokens, return the partial output with a successful-completion status.

**D**

On max\_tokens, execute any incomplete tool arguments as received.

Correct answer: A, B

### Explanation

Correct answers: A, B.

Option analysis:

* **A — On tool\_use, return matching tool results and continue.**: The tool-use state requests execution evidence for continuation.
* **B — On end\_turn, return the completed response.**: This is the normal completed-turn signal.
* **C — On max\_tokens, return the partial output with a successful-completion status.**: Token truncation is not proof of completion.
* **D — On max\_tokens, execute any incomplete tool arguments as received.**: Incomplete arguments require recovery, not execution.

## Question 16

Type: multiple\_choice
Knowledge point: Implementing agentic loop control flow that continues when stop\_reason is "tool\_use" and terminates when stop\_reason is "end\_turn"

A platform engineer is filling in the control-flow branches of a manual Claude agent loop. After each API response, the loop examines response.stop\_reason. Only client tools are configured. A helper named execute\_and\_append\_results(response, history) executes every requested client tool and appends the complete assistant response followed immediately by a user message with all matching tool\_result blocks. The next pass through the loop sends this updated history to Claude. Other stop reasons have separate handlers. Which TWO branch implementations correctly continue on tool\_use and terminate on end\_turn? Select exactly TWO answers.

### Options

**A**

For tool\_use, call execute\_and\_append\_results(response, history), then continue to the next API request.

**B**

For tool\_use, call execute\_and\_append\_results(response, history), then break out of the agent loop because this API response has ended.

**C**

For end\_turn, return the completed response to the caller and break out of the agent loop for this turn.

**D**

For end\_turn, send the unchanged conversation history to Claude again and wait for another end\_turn before returning the response.

Correct answer: A, C

### Explanation

A and C implement the required state transitions. On tool\_use, the application must execute the requested client tools, return their matching results in the history, and make another request so Claude can continue. The supplied helper performs the execution and history update, leaving continue as the correct branch action. On end\_turn, Claude has completed its response naturally, so the current turn's loop returns that response and stops. B incorrectly equates the end of one API response with completion of the assistant turn. D starts an unnecessary request after the turn has already completed; a second end\_turn is not a required confirmation.

## Question 17

Type: single\_choice
Knowledge point: Implementing agentic loop control flow that continues when stop\_reason is "tool\_use" and terminates when stop\_reason is "end\_turn"

Claude returns stop\_reason: "tool\_use" with three requested tool blocks. What must happen before the next Claude API request?

### Options

**A**

Return a matching success, failure, or denied-execution tool\_result for each of the three client-tool calls.

**B**

Process only the fastest tool call provided.

**C**

Break the loop because multiple tools were returned.

**D**

Ignore tool blocks and return text output.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — Return a matching success, failure, or denied-execution tool\_result for each of the three client-tool calls.**: Every requested client invocation needs its corresponding result; success is not required.
* **B — Process only the fastest tool call provided.**: One result leaves two invocation IDs unresolved.
* **C — Break the loop because multiple tools were returned.**: Multiple requested calls are supported.
* **D — Ignore tool blocks and return text output.**: Ignoring the tool blocks breaks the requested continuation.

## Question 18

Type: single\_choice
Knowledge point: Implementing agentic loop control flow that continues when stop\_reason is "tool\_use" and terminates when stop\_reason is "end\_turn"

A controller chooses its first matching branch: (1) if text contains "complete", return success; (2) else if iteration==limit, return success; (3) else if stop\_reason=="tool\_use", execute tools and continue; (4) else call Claude again. Trace T reaches the limit with text "preliminary checks complete" and a pending tool\_use; trace U reaches the same limit with end\_turn and a valid final answer. The hard limit cannot increase. Which replacement correctly distinguishes both traces?

### Options

**A**

Handle end\_turn as normal turn completion; if pending tool work cannot continue within the budget, stop it as incomplete; otherwise dispatch tool\_use and return its results.

**B**

Move the iteration-limit branch first and label both T and U successful because each consumed its budget.

**C**

Move the tool\_use branch first and always execute another iteration for T; handle U only when its text contains "complete".

**D**

Label every response at the limit incomplete, even when the same response is end\_turn with a valid final answer.

Correct answer: A

### Explanation

Completion and resource-stop classification must depend on the current response state, not solely on branch ordering, text, or the shared iteration count.

## Question 19

Type: single\_choice
Knowledge point: Adding tool results to conversation context between iterations so the model can incorporate new information into its reasoning

A lookup returns a large diagnostic payload. Why should an agent retain its decision-relevant fields in a matching tool\_result before the next model call?

### Options

**A**

So Claude can choose the next action from the relevant evidence without needing unrelated output.

**B**

So a success flag alone can stand in for all returned decision fields.

**C**

So the full raw payload must also be copied into the system prompt.

**D**

So the application can choose a fixed next action without reading the returned fields.

Correct answer: A

### Explanation

Returning the decision-relevant fields lets Claude reason about the next action while avoiding unrelated payload bulk. A success flag may hide values that change the decision, and tool evidence should remain in the matching result rather than become system policy. The purpose is evidence-based continuation, not a fixed action that ignores those fields.

## Question 20

Type: single\_choice
Knowledge point: Adding tool results to conversation context between iterations so the model can incorporate new information into its reasoning

Two parallel lookups use the same tool: p1 requests account A and p2 requests account B. Execution logs identify p2 returning balance 900 before p1 returns 20\. The serialized user message contains p1=900 and p2=20; both IDs are present and the API accepts it. The final answer reverses A and B. A retry with the opposite completion order gives the correct answer. Which diagnosis and repair best fit all observations?

### Options

**A**

The adapter binds outputs by completion position rather than invocation identity; attach each outcome to its originating ID before constructing tool\_result blocks.

**B**

The API requires results sorted by numerical value; always sort balances ascending before serialization.

**C**

The tool descriptions are ambiguous about account identity; make them more detailed while retaining the same serialization logic.

**D**

The lookup tool returns the wrong balances; repeat each query three times and use the majority value.

Correct answer: A

### Explanation

Protocol acceptance establishes structural validity, not semantic correctness of each result-to-call association.

## Question 21

Type: multiple\_choice
Knowledge point: Adding tool results to conversation context between iterations so the model can incorporate new information into its reasoning

An external API result contains a malicious instruction. Which two controls keep it in the proper conversational boundary? (Choose 2.)

### Options

**A**

Return the external output in a user-role tool\_result linked to the requested tool\_use\_id, treating it as untrusted data.

**B**

Validate action-relevant fields against the tool's expected schema and reject embedded instructions as policy input.

**C**

Copy it directly into the core system prompt.

**D**

Present it as an authoritative assistant policy decision.

Correct answer: A, B

### Explanation

The external result remains untrusted evidence in a user-role tool\_result correlated to its invocation. Expected action fields can be validated independently while embedded instructions are refused as policy input. These controls preserve provenance and restrict policy uptake; schema conformance or tool\_result placement alone does not prove that all malicious semantics are absent.

## Question 22

Type: single\_choice
Knowledge point: Adding tool results to conversation context between iterations so the model can incorporate new information into its reasoning

A Claude Messages API assistant message T requests db\_lookup with id db1\. After execution returns row 7, which continuation preserves the original user message U and the required call/result relationship?

### Options

**A**

\[U, T, {"role":"user","content":\[{"type":"tool\_result","tool\_use\_id":"db1","content":"row 7"}\]}\]

**B**

\[U, {"role":"user","content":\[{"type":"tool\_result","tool\_use\_id":"db1","content":"row 7"}\]}\]

**C**

\[U, T, {"role":"user","content":\[{"type":"tool\_result","tool\_use\_id":"7","content":"row 7"}\]}\]

**D**

\[U, T, {"role":"assistant","content":"row 7"}\]

Correct answer: A

### Explanation

The next history must retain the original user message U and assistant tool-use turn T, then append the actual row 7 outcome in a user tool\_result linked to db1\. The row value is result data, not the invocation identifier. A alone preserves the full conversation and the requested call/result association.

## Question 23

Type: multiple\_choice
Knowledge point: Avoiding anti-patterns such as parsing natural language signals to determine loop termination, setting arbitrary iteration caps as the primary stopping mechanism, or checking for assistant text content as a completion indicator

A controller logs only terminal status. It stops on the phrase "finished" or after four responses, classifying either stop as success. Three frozen replays use the same budget: R1's fourth response is tool\_use with "The scan is finished; checking its dependency next"; R2's fourth is end\_turn with a supported final answer and no stop phrase; R3's second is tool\_use with the same phrase as R1\. The team must correct success rates while retaining the four-response hard budget. Which two findings should drive the redesign? (Choose 2.)

### Options

**A**

R1 and R3 contain the same pending-work signal but need different operational outcomes: R1 is budget-stopped as incomplete, while R3 should continue with its requested tool result.

**B**

R2 is a normal completion at the budget boundary; fixing R1 by labeling every fourth response incomplete would introduce a new false failure.

**C**

R1 and R2 should share a successful status because they have the same response count, while R3 should stop because its text says finished.

**D**

R1 and R3 should both receive one more model response; otherwise replacing the phrase parser cannot improve the loop.

Correct answer: A, B

### Explanation

The counterexamples show why neither prose nor iteration count alone defines completion; explicit state and resource boundaries must be evaluated together.

## Question 24

Type: single\_choice
Knowledge point: Avoiding anti-patterns such as parsing natural language signals to determine loop termination, setting arbitrary iteration caps as the primary stopping mechanism, or checking for assistant text content as a completion indicator

What is the correct purpose of an iteration limit in an agentic loop?

### Options

**A**

Act as a safeguard against runaway execution.

**B**

Replace the end\_turn completion condition.

**C**

Determine whether the assistant text is trustworthy.

**D**

Mark the task successfully completed when the limit is reached, regardless of pending tool calls.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — Act as a safeguard against runaway execution.**: The limit bounds runaway resource consumption.
* **B — Replace the end\_turn completion condition.**: Normal completion still depends on the response state.
* **C — Determine whether the assistant text is trustworthy.**: An iteration counter does not establish text reliability.
* **D — Mark the task successfully completed when the limit is reached, regardless of pending tool calls.**: Reaching a safeguard is not evidence of task completion.

## Question 25

Type: single\_choice
Knowledge point: Avoiding anti-patterns such as parsing natural language signals to determine loop termination, setting arbitrary iteration caps as the primary stopping mechanism, or checking for assistant text content as a completion indicator

Which controller behavior is most reliable after a Claude response arrives?

### Options

**A**

Inspect stop\_reason and branch on its defined value.

**B**

Scan the response for a farewell phrase.

**C**

Treat max\_tokens as successful completion once the response contains readable text.

**D**

Treat pause\_turn as final completion rather than using its supported continuation handler.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — Inspect stop\_reason and branch on its defined value.**: The defined state determines whether to execute, finish, or recover.
* **B — Scan the response for a farewell phrase.**: Farewell prose is not a control contract.
* **C — Treat max\_tokens as successful completion once the response contains readable text.**: Readable truncated output may still be incomplete.
* **D — Treat pause\_turn as final completion rather than using its supported continuation handler.**: A paused turn can require continuation rather than finalization.

