Question 1
An engineering team is building a custom agentic loop using the Claude API. On each iteration, the loop inspects the API response before deciding whether to continue calling tools or stop. Which field-and-value check should drive that decision?
Option B is correct. The authoritative loop-control mechanism in Claude's agentic loop is the `stop_reason` field, and specifically the value `'tool_use'` signals that the model wants to invoke a tool and expects results before continuing.
Reason
Under the official exam blueprint's Domain 1 knowledge summary, the agentic loop lifecycle is explicitly defined around stop_reason 'tool_use' vs 'end_turn'. When the API returns stop_reason == 'tool_use', the correct action is to execute the requested tool(s) and append the tool results back to the conversation history before resubmitting — this is the deterministic, machine-readable signal the API provides precisely so developers don't need to infer intent from text content. When stop_reason is 'end_turn', the model has signaled it has no further tool calls and the loop should terminate. This field-and-value check is the canonical, reliable loop-control mechanism.
Why the other options are not as suitable
- Option A is wrong because the presence of a text block in the content array is not a stop signal — the model routinely emits both a text block and a tool_use block in the same response, so treating accompanying text as a completion indicator would cause premature termination mid-task, which the blueprint explicitly calls out as an anti-pattern.
- Option C is wrong because output_token count does not signal tool invocation or completion intent; token usage varies based on response verbosity and has no semantic relationship to whether the model wants to continue using tools, making it an unreliable and architecturally incorrect termination signal.
- Option D is wrong because hard-coding a fixed turn count as the primary termination signal is explicitly identified in the Domain 1 blueprint as an anti-pattern ('avoiding anti-patterns like… arbitrary iteration caps'); a fixed cap may truncate legitimate multi-step workflows or allow runaway loops on short tasks, and is acceptable only as a high safety ceiling, not as the primary loop-control mechanism.