CCA-F › Domain 1 › Agentic Design Patterns

🧠 Agentic Design Patterns — the full catalog

Every pattern · what · why · how in Claude (client/server) · example · gotcha
🎯 The single most important D1 distinction: workflows (you orchestrate predefined steps in code) vs agents (the model decides the control flow at runtime). Start simple — reach for an agent only when the path genuinely can't be predefined. Most "agentic" patterns below are client-side orchestration you write around the Messages API; the server just does single calls (+ tool decoding, caching, batch). Managed Agents is the exception — there the server runs the loop.

⚛️ Building block🔗 Workflows🤖 Agents🧩 Cross-cutting

⚛️ The building block

Augmented LLM CLIENT + SERVER

What A single LLM call enhanced with tools, retrieval, memory, and structured output — the atom every pattern composes.
Why It's the smallest useful unit; every workflow/agent is just augmented LLMs wired together.
In Claude One messages.create with tools / output_config. The server decodes a tool_use block; you execute it.
Example Any single tool call — e.g. G1's structured triage call.
Gotcha It is not an agent yet — no loop, no self-direction. Don't over-claim "agent" for one call.

🔗 Workflow patterns — you orchestrate; predictable

1 · Prompt Chaining CLIENT

What Break a task into sequential steps; each call's output feeds the next, with optional gates/checks between.
Why Decompose a complex task into simpler, individually-verifiable steps (accuracy over one giant prompt).
In Claude You make N sequential messages.create calls in your code; a check between steps can bail early.
Example Extract → validate → format; meeting notes → summary → action items (P2).
Gotcha Latency & cost add up (each step re-sends context); an early error propagates — validate between steps.

2 · Routing CLIENT

What Classify the input, then send it to a specialized prompt / tool / model.
Why Different inputs need different handling; separating them beats one prompt trying to do everything.
In Claude A cheap classify call (or rules) → route; often paired with model tiering (Haiku decides, Opus does the hard case) and tool_choice.
Example Support-ticket routing; model tiering; G1's severity routing.
Gotcha The router itself can misroute — keep it cheap, evaluate it; remember tool descriptions drive selection.

3 · Parallelization — Sectioning & Voting CLIENT

What Run work concurrently. Sectioning = split independent subtasks; Voting = run the same task N times and aggregate.
Why Speed (independent parts) or reliability (consensus / diverse checks).
In Claude Fire N messages.create calls in parallel (async), then merge in your code.
Example Multi-source research fan-out (P7); N verifiers voting on one finding.
Gotcha Cost multiplies by N; you must merge/dedup; handle sub-answer disagreement.

4 · Orchestrator–Workers CLIENT (or Managed Agents = SERVER)

What A coordinator dynamically decomposes the task, delegates to worker sub-agents, then synthesizes their results.
Why The subtasks aren't known in advance and are independent — each benefits from its own context window.
In Claude A coordinator loop spawns worker calls (each isolated context); in Claude Code the Task tool must be in allowedTools. Managed Agents can run this server-side.
Example Multi-source Research Agent (P7); coordinator → sub-agents → merged report.
Gotcha Cost blowup; coordinator context bloat; convergence; delegation-prompt quality (give each worker a crisp, self-contained task).

5 · Evaluator–Optimizer CLIENT

What One LLM generates; another evaluates and gives feedback; loop until it passes.
Why When there are clear quality criteria and iterative refinement measurably helps.
In Claude generate call → evaluate call → regenerate with the critique; cap the iterations.
Example Self-correcting SQL (run = evaluate, fix = optimize); G4's verifier gating the RCA.
Gotcha Infinite loop (always cap); evaluator too lenient/strict; same-model blind spots — use a fresh context / different lens.

🤖 Agent patterns — the model decides the control flow

6 · Autonomous Agent (the tool-use loop) CLIENT loop + SERVER decode

What The model decides an action, acts via a tool, observes the result, adjusts, and repeats until done.
Why Open-ended tasks where the steps can't be predefined (you can't know the fix without running the query).
In Claude The stop_reason loop: tool_use → execute → return tool_result → repeat until end_turn. Server decodes the tool call & stamps stop_reason; you own the loop (or use the Tool Runner / Managed Agents).
Example Text-to-SQL agent (P0); G4 RCA Copilot.
Gotcha Runaway loop → max_turns; handle all 6 stop_reasons; the tool-result contract (mismatched pairing = 400); cost of long loops.

7 · ReAct (Reason + Act) CLIENT loop + MODEL reasoning

What Interleave explicit reasoning with tool actions — think, act, observe, think again.
Why Complex multi-step problems where reasoning between actions improves the next choice.
In Claude Adaptive thinking + tool use inside the loop; the response carries thinking blocks then a tool_use.
Example G4 deciding which evidence to pull next based on the last log it read.
Gotcha Thinking tokens are billed as output (cost); can get stuck looping — keep it grounded and capped.

🧩 Cross-cutting patterns — compose with any of the above

8 · Reflection / Self-Critique CLIENT

What The model reviews and improves its own output before returning it.
Why Catch errors, omissions, and format slips cheaply.
In Claude A second messages.create asking it to critique & revise the draft.
Example "Check this SQL matches the question" before trusting it.
Gotcha Same-model bias — self-review misses its own blind spots; an independent judge (fresh context) is stronger.

9 · Verifier / LLM-as-Judge CLIENT

What An independent pass, in a fresh context, checks correctness / groundedness before the output is trusted.
Why The defense against silent failures (valid-looking but wrong).
In Claude A separate call with the claim + evidence and a structured verdict schema; clean context, no priming.
Example nl2sql verifier; G4's verify() gating the ticket.
Gotcha Judge bias if it's the same model/prompt as the generator; must be grounded on evidence; costs an extra call.

10 · Human-in-the-Loop / Approval Gate CLIENT / APP

What A person approves before a high-stakes or irreversible action executes.
Why Irreversible, costly, or regulated actions need oversight — AI proposes, human decides.
In Claude Gate the tool execution in your code (or a Tool Runner per-turn hook, or an ask_user tool).
Example G4 drafts a ticket (never files it); G6 proposes a right-sizing a human applies.
Gotcha Enforce at the code layer, not the prompt; watch approval fatigue & latency.

11 · Memory CLIENT

What Persist state across turns/sessions — short-term (the window) and long-term (an external store).
Why Continuity, personalization, and long-horizon tasks.
In Claude You store & re-inject it (the API is stateless); the client-executed memory tool; context editing / compaction to keep it lean.
Example Second-Brain assistant (Redis + SQLite + vector + graph).
Gotcha Staleness; retrieval quality; context bloat; the server keeps no session — you resend history.

12 · Retrieval-Augmented (RAG) CLIENT

What Fetch relevant context and ground the answer on it.
Why Private/fresh knowledge the model doesn't have; reduces hallucination.
In Claude Retrieve in your code, put chunks in the system/user content; optionally the citations feature for grounded references.
Example G5 Runbook Agent; P1 Docs Q&A.
Gotcha Retrieval recall; stale index; ungrounded hallucination; chunking quality.

13 · Guardrails TOOL / APP (never prompt-only)

What Enforce safety, policy, and limits around the agent.
Why Prevent harmful, injected, over-scoped, or runaway behaviour.
In Claude Code checks, least-privilege / read-only tools, moderation, approval gates — not the prompt. Full set: the guardrails catalog.
Example G-series read-only grants; injection filtering on tool output.
Gotcha Prompt-based guardrails are bypassable — the enforcing ones live in code/permissions.

CLIENT vs SERVER where each pattern actually runs

Runs wherePatterns
Your client code (orchestration around the Messages API)Chaining, Routing, Parallelization, Evaluator-Optimizer, Reflection, Verifier, HITL, Memory, RAG — and the agent loop itself
The server (single-call features)Tool-use decoding, structured outputs, prompt caching, the Batch API
Server runs the loopManaged Agents (Anthropic hosts the loop + sandbox); the Tool Runner automates the loop in your process
The recurring exam theme: almost every agentic pattern is your orchestration code calling a stateless single-turn API. The model provides intelligence per call; you provide the loop, the memory, the routing, and the guardrails — unless you hand the loop to Managed Agents.