CCAR-F - Agentic Architecture & Orchestration - Section 1.1

Design and implement agentic loops for autonomous task execution.

The loop lifecycle: send a request, inspect stop_reason, execute the requested tools, append the results to conversation history, and iterate. Control flow continues while stop_reason is tool_use and terminates on end_turn. Candidates must separate model-driven decisions from pre-configured tool sequences, and must recognise the anti-patterns: parsing natural language for a termination signal, using an arbitrary iteration cap as the primary stop, or treating assistant text as a completion indicator.

agentic loop lifecyclestop_reason tool_use versus end_turntool results appended to conversation historymodel-driven decision-makingloop termination anti-patterns

Practice question for this objective

Free sampleAgentic Architecture & Orchestrationmedium

A research platform team runs a coordinator agent on the Claude Agent SDK that decomposes a question and delegates to web search, document analysis, synthesis and report generation subagents. Their custom harness ends the run and returns the assistant text to the caller as soon as any assistant message contains a text block. Telemetry across 800 runs shows that 46 percent of delivered reports contain only the coordinator's stated plan for which subagents it intends to call, and none of the findings those subagents returned. Which change most effectively addresses the logged behaviour?

  • ARaise the maximum output tokens on the coordinator request so that a single assistant message has room to hold both the plan and the aggregated findings before the harness reads it.
  • BInstruct the coordinator in CLAUDE.md to withhold all narrative text until every delegated subagent has reported, so that the first text block it emits is already the finished report.
  • CMove report generation into a second API request that receives the subagent outputs as pre-formatted input, leaving the coordinator responsible only for issuing the delegation calls to each subagent.
  • DDrive the harness from stop_reason, continuing the loop while it is tool_use by appending each tool result to the conversation history and sending it back, and returning to the caller only on end_turn. Correct
An agentic loop continues while stop_reason is tool_use and ends on end_turn, not when an assistant message first contains text. An assistant message can contain a text block and one or more tool_use blocks in the same turn, so the presence of text says nothing about whether the model has finished. The loop is governed by stop_reason: a value of tool_use means the model is waiting for the caller to execute the requested tools and append the corresponding tool results to the conversation history before it can continue, while end_turn means the turn is complete. Reading text as completion truncates the run at the coordinator's planning turn.

Why A is wrong: Tempting because the delivered report is short and truncation is a familiar cause of missing content, but the findings are missing because the loop stopped, not because the message ran out of room. A larger budget on a message the model has not yet been allowed to write changes nothing.

Why B is wrong: Tempting because it appears to remove the early text block the harness reacts to, but it makes correctness depend on the model choosing to stay silent on every run. A harness defect that needs a deterministic fix is being answered with probabilistic compliance.

Why C is wrong: Tempting because splitting the work looks like it isolates the broken stage, but the harness would still cut the coordinator off at its first text block, so the subagent outputs the second request depends on would never be produced.

Why D is correct: Correct because stop_reason is the signal that distinguishes a turn the model expects to continue after tool execution from a turn it considers finished, and an assistant message may carry text and tool_use blocks together.

See more CCAR-F practice questions, answers explained.

More in this domain

Back to all Agentic Architecture & Orchestration objectives, or the CCAR-F cert hub.

Examworthy is not affiliated with or endorsed by Anthropic. Original, blueprint-aligned practice material only.