Claude Academy
Sign in

Vault / wiki/301/practice/ccdv/domain-1-agents-and-workflows.md

updated 2026-07-16

Practice — CCDV-F Domain 1: Agents and Workflows (14.7%)

12 scenario-based MCQs. Answer key + explanations at the bottom.


Q1

A fintech team must process vendor invoices nightly: extract fields from each PDF, validate them against purchase-order records, then post approved entries to the ERP. The steps and validation rules are fixed at design time, and finance requires predictable, auditable behavior. The product manager has asked for "an autonomous invoice agent." Which architecture best fits the requirements?

A. An autonomous agent loop with an iteration cap and ground-truth environment feedback B. Orchestrator–workers, letting the orchestrator decide the decomposition per invoice C. A prompt-chaining workflow (extract → validate → post) with programmatic gates between steps D. Evaluator–optimizer, with a second model critiquing and iteratively refining each extraction until it passes review

Q2

You are designing a production-incident triage assistant. Every incident is different: the assistant must read alerts, query logs and dashboards, form hypotheses, and choose its next action based on what each query reveals — the number and order of steps cannot be predicted in advance. Which design best aligns with Anthropic's guidance?

A. An agent loop that takes ground-truth feedback from the environment at each step, bounded by an iteration cap B. A routing workflow that classifies each incident into a known type and dispatches to a fixed handler C. A prompt chain with programmatic gates — gather logs → analyze → recommend — run identically every time D. A single comprehensive prompt containing conditional rules for every known incident category

Q3

An internal coding agent built on a custom loop averages 22 model round-trips per task, and p95 latency is unacceptable. The system prompt is already lean and stable. Under the agent-loop framing (latency = iterations × round-trips), which change most directly attacks the problem?

A. Enable streaming so partial output reaches the user sooner B. Reduce loop iterations — for example, improve tool design and documentation so the model accomplishes more per call C. Move the stable system prompt behind a prompt-caching breakpoint so every round-trip reprocesses fewer uncached input tokens D. Raise max_tokens so each individual response can run longer

Q4

In a Claude Code session you delegate to a subagent with the prompt: "Based on our discussion above, fix the remaining lint errors in the files we identified." The subagent reports there is nothing to do. What is the most likely cause?

A. The model override in the subagent's frontmatter is too small to interpret an indirect request B. Subagents are read-only by design, so it acknowledged the task but could not act on it C. The subagent's tool whitelist blocked the search tools it needed, so it could not locate any of the files identified earlier in the session D. The subagent starts in its own empty context and never sees the parent conversation, so the brief was not self-contained

Q5

An orchestrator delegates a migration step to a subagent, which returns the summary: "Renamed all 14 config files and updated their imports." Later steps fail because several files were never renamed. Which practice does this failure highlight?

A. Treat a subagent's summary as a claim of intent and have the orchestrator verify side effects before depending on them B. Share the parent's full conversation history with subagents so their reports reflect complete context C. Run subagents on a larger model, since misreported results indicate insufficient reasoning capability D. Replace the subagent with a PostToolUse hook, because hooks are deterministic and cannot misreport

Q6

You fan out three Claude Code subagents in parallel to speed up a repo-wide refactor. Two of them edit overlapping files, and the merged result is corrupted. Which change best fixes the design?

A. Introduce a shared mutable state object that every worker reads and updates concurrently to keep its edits synchronized with the others B. Abandon parallelism and require that only one subagent ever runs at a time C. Give each subagent write-isolation via its own worktree and integrate results through the orchestrator D. Have the two conflicting subagents message each other directly to coordinate their edits

Q7

A platform team is building a reusable internal agent for build-pipeline maintenance. Requirements: a multi-turn tool loop, allow/deny permission rules with user confirmation, lifecycle hooks, and delegation to specialized subagents — all running on the team's own infrastructure. Which starting point minimizes what they must build themselves?

A. The vanilla Messages API with a hand-rolled tool loop, permission layer, hook system, and custom delegation logic for subagents B. The Claude Agent SDK, which ships the loop, permission middleware, hooks, and subagent delegation C. Anthropic-hosted managed agents configured for the pipeline maintenance task D. Interactive Claude Code sessions driven manually by the on-call engineer

Q8

Your custom agent harness asks Claude for JSON that must validate against a schema before being written to a downstream queue. About 3% of responses fail validation. Which handling best follows recommended loop design?

A. Set temperature to 0 and remove the validation step, since deterministic sampling ends the failures B. Silently repair malformed responses with regex before enqueueing them C. Log each failure and drop the item so the loop is never blocked by bad output D. Return the validation error to the model and retry, with a capped number of attempts

Q9

A two-person startup needs an agent that performs code and file operations for a fairly standard agentic task. They have no infrastructure team, need sandboxed execution, and want the fastest path to production. Which option best matches?

A. Anthropic-hosted managed agents, which run the loop in a managed sandbox on Anthropic's infrastructure B. The Agent SDK deployed on their own servers, with sandboxing and isolation the team designs, builds, and operates itself C. A from-scratch loop on the Messages API inside Docker containers they build and maintain D. Claude Code running headless on a developer laptop under a scheduled cron job

Q10

A security team wants a guarantee that a secret-scanning script runs before every Bash command an agent executes and blocks the command when a leak is detected. A teammate proposes adding "always run the secret scanner first" to CLAUDE.md instead. Why is a PreToolUse hook the correct mechanism?

A. CLAUDE.md files are loaded only in interactive terminal sessions and are ignored during agentic runs B. Hooks execute on Anthropic's servers rather than locally, so a compromised session cannot bypass them C. The harness — not the model — executes hooks, and a blocking exit code stops the tool call regardless of what the model decides D. Hooks run entirely outside the context window, so their instructions never consume tokens and can never drift or degrade over long sessions

Q11

A long-running research agent fetches dozens of full web pages per task. Mid-run, raw page dumps dominate the context window, answer quality degrades ("lost in the middle"), and per-turn cost keeps climbing. Which restructuring best addresses the root cause?

A. Progressively summarize the accumulated page dumps every few turns, replacing the oldest raw turns in the main context with compact digests B. Delegate fetch-and-read work to a research subagent with its own context window that returns only distilled findings C. Raise max_tokens so the model has more room to reason across the accumulated page dumps D. Enable prompt caching on the conversation so re-sent page dumps become cheaper per turn

Q12

Your team prototyped an orchestrator–workers research agent in LangGraph and is now standardizing on the Claude platform. A colleague argues the design must be discarded because "those patterns are LangGraph-specific." Which response is most accurate?

A. They are right — each framework defines its own incompatible pattern vocabulary and execution model, so the architecture must be redesigned from scratch B. They are partly right — the patterns transfer, but only Anthropic's Agent SDK is able to invoke Claude models C. They are partly right — routing transfers across frameworks, but orchestrator–workers is proprietary to LangGraph D. They are wrong — the canonical agentic patterns are framework-agnostic, and Strands, LangGraph, and PydanticAI all implement the same underlying loop


Answers

Q1: C. Steps and rules fixed at design time → workflow, and the sequential extract → validate → post shape is textbook prompt chaining with gates (schema checks, PO matching). Workflows are predictable, cheap, and easy to debug — exactly the audit posture finance demands. The runner-up (A) trades away predictability and cost for autonomy the task never uses, since agents are for unpredictable step counts. (B) implies dynamic decomposition when the plan is static, and (D) adds an iterative quality loop where deterministic gates already decide pass/fail.

Q2: A. Steps cannot be predicted and each action depends on what the environment reveals — the defining criteria for agent territory — and Anthropic's guidance pairs autonomy with ground-truth feedback per step plus a bounded iteration count. The runner-up (B) loses because routing requires a predetermined handler per class, but here the investigation path itself is dynamic, not just the entry point. (C) forces a fixed plan onto an unpredictable task, and (D) is the mega-prompt anti-pattern where conditional rules dilute each other.

Q3: B. With latency = iterations × round-trips, 22 round-trips is the dominant term, so the highest-leverage fix is fewer iterations — better tool design and documentation (the agent-computer interface) lets the model accomplish more per call. The runner-up (A) only improves perceived latency; total completion time is unchanged. (C) trims per-request latency and cost but leaves the iteration count untouched, and (D) changes the output budget without removing a single round-trip.

Q4: D. Subagents run in their own context window and receive nothing from the parent conversation, so "based on our discussion above" refers to text the subagent has never seen — the brief must be self-contained, with file paths and requirements spelled out. (A) blames model capability when no model could recover missing context. (B) is false: subagents can be granted editing tools via their whitelist. (C) invents a configuration failure the scenario gives no evidence for; the prompt, not the tools, is broken.

Q5: A. This is the trust trap: a subagent's summary describes intent, not necessarily reality, so the orchestrator must verify writes and changes before building on them. (B) destroys the context-isolation benefit and wouldn't make reports truthful anyway. (C) is a band-aid — larger models can also misreport, and the fix is verification, not capability. (D) confuses primitives: hooks fire on lifecycle events and enforce checks; they don't perform delegated work.

Q6: C. Parallel subagents that write the same files race, and the documented remedy is worktree isolation (isolation: worktree) so each worker edits its own copy, with the orchestrator integrating results. The runner-up (B) fixes the conflict but forfeits the parallelism that motivated the fan-out, when isolation preserves both. (A) is the shared-mutable-state anti-pattern — results must flow through the orchestrator. (D) has no supporting mechanism: subagents return a single summary to the parent, they don't talk peer-to-peer.

Q7: B. The requirements list — tool loop, permission middleware with confirmation, hooks, subagent delegation — is precisely what the Agent SDK provides out of the box while running on your own infrastructure. The runner-up (C) fails on the self-hosting requirement: managed agents run on Anthropic's infrastructure with configuration-level control only. (A) means rebuilding everything the SDK already ships, and (D) is a manual process, not a reusable production agent.

Q8: D. The self-correction loop is the recommended primitive: return the actual validation error to the model, let it repair its output, and cap retries so the loop stays bounded. The runner-up (B) loses because silent regex repair can push subtly corrupted data downstream with no feedback signal to improve the output. (A) misunderstands sampling — temperature 0 reduces variance but never justifies removing validation. (C) trades correctness for liveness and silently loses 3% of the workload.

Q9: A. Managed agents are the fastest time-to-production option: Anthropic supplies the runtime, the managed sandbox for code and file operations, and scaling, while the team supplies task and configuration — a fit for a standard agentic task with no infra team. The runner-up (B) offers full code-level control, but the sandboxing, orchestration, and ops burden land on a two-person team, which is exactly the constraint they can't absorb. (C) is even more build burden, and (D) is neither sandboxed nor production infrastructure.

Q10: C. Hooks are deterministic guardrails: the harness executes them on lifecycle events, and a PreToolUse hook's blocking exit code (2) stops the Bash call with stdout returned to Claude as the reason — no model cooperation required. CLAUDE.md is prompt-level instruction the model can deprioritize or drift away from, so it can't provide a guarantee. (A) is false — CLAUDE.md is read at session start including agentic use. (B) is false — hooks run locally in the harness. (D) is wrong on the facts (blocking hook output is fed back to Claude) and cost was never the issue.

Q11: B. The root cause is noisy bulk content entering the parent's context at all; subagent delegation gives that work its own context window and the parent only ever sees the distilled summary. The runner-up (A) compresses the dumps only after the parent has already ingested and paid for them each turn, so cost and mid-context degradation persist between summarization passes. (C) confuses the output-token budget with the context window. (D) lowers price per token but leaves the lost-in-the-middle quality problem — and a constantly growing tail limits cache value anyway.

Q12: D. The exam expects you to recognize agentic patterns across frameworks: routing, orchestrator–workers, evaluator–optimizer, and the underlying gather-context → model → act → feed-back loop are architecture, not vendor features, and Strands, LangGraph, and PydanticAI all express the same shapes. (A) and (C) treat portable patterns as proprietary — orchestrator–workers comes from Anthropic's own guidance, not LangGraph. (B) is false on its one factual claim: any framework or hand-rolled loop can invoke Claude through the API; the Agent SDK is a convenience, not a gatekeeper.