What you will be able to do
- Describe the augmented LLM and explain why every workflow and agent pattern is built from it
- Tell a workflow from an agent by asking who decides the next step, and weigh what each choice costs
- Justify starting with a single optimized call and adding complexity only when it measurably falls short
- Pick the right workflow for a task: prompt chaining, routing, parallelization (sectioning or voting) or orchestrator-workers
- Recognise when an evaluator-optimizer loop fits and when a programmatic check is the better tool
Key concept
Who controls the next step — Every pattern in this lesson is made of augmented LLM calls. What separates them is whether your code fixes the path those calls take (a workflow) or the model chooses its next action at run time (an agent).
1.The augmented LLM as the building block
Every architecture in this lesson, from a two-step pipeline to an autonomous coding agent, is made from one unit: the augmented LLM. This is a model call extended with retrieval, tools and memory. Claude does not just receive these capabilities passively. It writes its own search queries, chooses which tool to call, and decides what information to keep. A pattern describes how several of these units are wired together. It never replaces the unit.
In practice a single call carries more than the user's text. Claude receives the prompt along with the system prompt, the tool definitions and the conversation history, and it may answer in text, request tool calls, or do both. So even before you choose a pattern, one call can search, look things up and act.
Two parts of the implementation matter most. First, the capabilities should fit your use case: a support assistant needs order lookup, not a general web crawler. Second, each capability needs a clear, well-documented interface the model can understand. The Model Context Protocol is one way to connect third-party tools through a simple client; choosing among integration mechanisms is covered in connection protocols. Once each call has the right augmentations, the architectural question becomes how those calls are arranged.
Checkpoint 1 of 9· Check yourself
A team is building an internal assistant that answers employees' questions about HR policy. Before choosing any workflow or agent pattern, how should they set up the single model call?
The augmented LLM is the building block. Its capabilities should fit the use case and come with an interface the model can understand. Claude writes its own search queries, and a pattern only wires these units together. It never replaces them.
“tailoring these capabilities to your specific use case and ensuring they provide an easy, well-documented interface for your LLM”Source: www.anthropic.com
2.Workflows versus agents: who decides the next step
Workflows and agents are both agentic systems, and they differ in one thing: who controls the sequence. In a workflow, your code decides the order of calls: classify, then draft, then translate. In an agent, the model directs its own process and tool use. Using tools, or making many calls, does not by itself make something an agent.
The agent's mechanics are simple. It is a model using tools in a loop and acting on what comes back. The Claude Agent SDK runs this cycle: Claude evaluates the current state and requests tool calls, the SDK runs them, and each set of results goes back to Claude for its next decision. The loop stops when Claude gives a response with no tool calls. In a bug-fix run, Claude might run the tests, read the failing files, edit one, and run the tests again before it reports that all three pass. Because the model judges its progress from these real results, agents usually also get stopping conditions, such as a maximum number of iterations, so they stay under control.
Agents fit open-ended problems where you cannot predict how many steps are needed or hardcode a path, such as resolving a SWE-bench task that touches many files. That autonomy has a price: higher cost and the risk of compounding errors, where one bad decision feeds the next. Agents call for extensive testing in sandboxed environments, guardrails, and enough trust in the model's decision-making to let it run for many turns.
| Property | Workflow | Agent |
|---|---|---|
| Who decides the next step | Predefined code paths | The model, at run time, based on tool results |
| Predictability | High: same path every time for well-defined tasks | Lower: the number of turns varies by task |
| Cost and risk | Bounded by the calls you wrote | Higher costs and potential for compounding errors |
| Wins when | Steps are known in advance | Open-ended problems where the steps cannot be predicted |
Checkpoint 2 of 9· Check yourself
Every incoming invoice goes through the same three steps: extract the fields, check them against the purchase order with a lookup tool, then draft an approval email. Which design fits best, and why?
The steps here are known and well defined, so a fixed code path gives the same path every time and keeps cost limited to the calls you wrote. Neither tool use nor the number of calls makes a system an agent, and a stopping condition only keeps an agent under control. It does not make the agent's path predictable.
“workflows offer predictability and consistency for well-defined tasks”Source: www.anthropic.com
3.Start simple and add complexity only when it pays
The default is the simplest design that works, and that is often not an agentic system at all. For many applications, a single LLM call improved with retrieval and in-context examples is enough. Current Claude models handle most multistep reasoning inside one call, so a pipeline you build to imitate that reasoning may add nothing.
Every layer you add costs something. Agentic systems usually trade latency and cost for better task performance, so the real question is whether that gain is worth paying for in this application. Each extra call adds a round trip and more tokens, and each handoff is another place the system can fail. Add a workflow when a single call measurably falls short. Add an agent only when you also need the flexibility of model-driven decisions.
Frameworks deserve the same caution. Tools such as the Claude Agent SDK make it easy to start by handling model calls, tool parsing and chaining. They can also hide the underlying prompts and responses, which makes debugging harder, and they make it tempting to add complexity a simpler setup would not need. Many patterns take only a few lines of code against the API directly. If you do use a framework, understand what it does underneath, because wrong assumptions about it are a common source of errors.
Checkpoint 3 of 9· Match them up
Match each design to the situation that justifies choosing it, following the rule of starting simple and adding complexity only when it pays.
Tap a term, then the definition that fits it.
Each layer adds latency, cost and failure points, so you begin with one optimized call. Move to a workflow when that call measurably falls short on a well-defined task. Choose an agent only when you also need the model to make its own decisions at run time.
“workflows offer predictability and consistency for well-defined tasks, whereas agents are the better option when flexibility and model-driven decision-making are needed at scale.”Source: www.anthropic.com
4.Prompt chaining and routing: fixed steps and distinct categories
Picking a workflow comes down to a few questions about the task. Are the steps fixed? Do inputs fall into distinct categories? Can the work run in parallel? Can you predict the subtasks before seeing the input? Is there a clear test for quality? Each answer points to a different pattern, and the wrong options in a design review usually answer a question the scenario never asked.
| If the task… | Use | Why |
|---|---|---|
| Breaks cleanly into fixed sequential subtasks | Prompt chaining | Each call does an easier task; gates check intermediate output |
| Has distinct input categories that are better handled separately | Routing | Specialized prompts without one input type hurting another |
| Has independent pieces, or needs several attempts for confidence | Parallelization (sectioning or voting) | Speed, or focused attention per aspect, or diverse outputs |
| Needs subtasks that depend on the specific input | Orchestrator-workers | A central LLM decides the subtasks at run time |
| Has clear evaluation criteria and improves with feedback | Evaluator-optimizer | Generate, critique and refine in a loop |
Prompt chaining splits a task into a fixed sequence, and each call processes the output of the one before it. It fits when the task decomposes cleanly into known subtasks. It deliberately trades latency for accuracy, because each call has an easier job. Between steps you can add gates, which are programmatic checks that confirm the process is still on track. A gate is ordinary code: a length limit, a schema check, a required field. Writing marketing copy and then translating it is the standard example. A content team that translates copy into three languages and must keep each string within a UI character limit has a fixed sequence plus a deterministic check, so it is a chain with a gate. It does not need another LLM to judge length, and it does not need an orchestrator to decide which languages to produce, because the languages are already known.
Chaining also helps you run the system. Explicit chains are still worth using when you need to inspect intermediate outputs or enforce a specific pipeline structure, because each step is a separate API call you can log, evaluate or branch on. Smaller, consistent subtasks also reduce inconsistency at scale, since each one gets Claude's full attention.
Routing classifies an input first and then sends it to a specialized follow-up: a different prompt, tool set or process. The reason is separation of concerns. Without routing, tuning one prompt for one kind of input can hurt performance on the others. Routing fits when the categories are distinct and classification is accurate, whether an LLM or a traditional classifier does it. A support queue with billing questions, technical bugs and cancellations, each needing its own tuned prompt, is a routing problem. Running every ticket through all three prompts in a chain wastes calls on the two that don't apply. Running them in parallel and keeping whichever finishes first throws away the reason for having specialists. Routing can also send easy questions to a smaller, cheaper model and hard ones to a more capable model; choosing those models is covered in model selection.
Checkpoint 4 of 9· Match them up
A design review lists four features. For each scenario, pick the workflow pattern it calls for.
Tap a term, then the definition that fits it.
A fixed sequence plus a deterministic rule such as a length limit is a chain with a code gate. It needs neither an LLM judge nor an orchestrator, because the languages are known in advance. Distinct input categories call for routing. Subtasks that depend on the input call for orchestrator-workers, and criteria an LLM can critique and that improve with iteration call for evaluator-optimizer.
“This workflow is ideal for situations where the task can be easily and cleanly decomposed into fixed subtasks.”Source: www.anthropic.com
Checkpoint 5 of 9· Exam question
A content team needs marketing copy generated and then translated into three languages, with a programmatic check confirming each translated string stays within a fixed UI character limit before it is published. Which architectural pattern best fits this requirement?
Correct answer: A — Prompt chaining, using sequential LLM calls with a programmatic gate that checks translated text length before publishing
- A. Correct. The task decomposes into fixed sequential steps (generate, then translate) with a deterministic, programmatic validation gate between them, which is the defining shape of prompt chaining.
- B. Incorrect. Routing classifies an input to send it down one of several specialized paths; there is no classification decision here, only a fixed sequence of steps.
- C. Incorrect. Orchestrator-workers dynamically determines subtasks at runtime; the languages and steps here are already known and fixed, not discovered dynamically.
- D. Incorrect. Evaluator-optimizer uses a second LLM to iteratively critique and refine output; the scenario describes a deterministic length check, not an LLM-based quality feedback loop.
Checkpoint 6 of 9· Exam question
A customer support system receives billing questions, technical bugs, and account cancellations. Each category needs a differently tuned prompt, and an initial step must first determine which category a given ticket belongs to before further processing. Which pattern should the team implement?
Correct answer: B — Routing, where an initial LLM call classifies the ticket and directs it to the specialized prompt for that category
- A. Incorrect. Parallelization runs independent subtasks or repeated attempts concurrently; it does not classify an input into one of several distinct categories.
- B. Correct. An initial classification step that directs the ticket to a category-specific specialized prompt is the defining shape of routing.
- C. Incorrect. Prompt chaining passes every ticket through every step in sequence; here only one category-specific prompt should run per ticket, not all three.
- D. Incorrect. Orchestrator-workers is for tasks whose subtasks are unpredictable and must be dynamically decomposed, not for a single classification-to-specialized-prompt decision.
5.Parallelization and orchestrator-workers: known versus emergent subtasks
Parallelization runs several LLM calls at the same time and combines their outputs in code. It has two forms. Learn to tell them apart by asking whether the calls do different work or the same work. Sectioning splits a task into independent subtasks that run in parallel: one call checks generated code for vulnerabilities while another checks the same code for licensing problems, and code merges both into one report. Voting runs the same task several times to get different outputs, for example several prompts reviewing code for vulnerabilities, with the code flagged if any of them finds a problem.
Sectioning often helps quality as well as speed. When a task involves several considerations, LLMs usually do better if each one gets its own call with focused attention. Guardrails are the standard case: one instance answers the user while another screens the query for inappropriate content, which works better than one call doing both. Chaining these checks would be wrong, because neither depends on the other's output. An evaluator-optimizer setup would be wrong too, because neither check is critiquing the other.
Orchestrator-workers looks like parallelization: a central LLM breaks the work down, hands pieces to worker LLMs, and combines their results. The difference is that the subtasks are not fixed in advance. The orchestrator decides them at run time from the specific input. In a coding change, the number of files to edit and what changes in each depend on the request, so nobody can write the fan-out beforehand. A fixed set of five prompts is therefore sectioning. Orchestrator-workers is the wrong choice for simple single-output tasks, when latency is critical, or when the subtasks are predictable enough to define ahead of time. In that last case, use the simpler parallel workflow.
async def research_topic(query: str) -> dict:
# Lead agent breaks query into research facets
facets = await lead_agent.decompose_query(query)
# Spawn subagents to research each facet in parallel
tasks = [
research_subagent(facet)
for facet in facets
]
results = await asyncio.gather(*tasks)
# Lead agent synthesizes findings
return await lead_agent.synthesize(results)In this code the list of facets comes from decompose_query, so it differs for each query. That one line is what makes it orchestrator-workers and not sectioning. When workers become full agents with their own context windows, you are designing a multi-agent system, and its token cost and context isolation are covered in multi-agent orchestration.
Checkpoint 7 of 9· Fill the gap
The blank marks the one call that makes this code orchestrator-workers rather than sectioning, because it produces a different list of subtasks for each query. Which lead-agent method belongs there?
async def research_topic(query: str) -> dict:
# Lead agent breaks query into research facets
facets = await lead_agent. ? (query)
# Spawn subagents to research each facet in parallel
tasks = [
research_subagent(facet)
for facet in facets
]
results = await asyncio.gather(*tasks)
# Lead agent synthesizes findings
return await lead_agent.synthesize(results)decompose_query has the lead agent decide the facets at run time from the specific query, so the fan-out can't be written in advance, and that is what makes this orchestrator-workers. synthesize only combines results at the end. gather and research_subagent run and carry out the work, but they don't decide which subtasks exist.
Checkpoint 8 of 9· Exam question
A security team wants one LLM call to check generated code for vulnerabilities while a second, independent LLM call simultaneously checks the same code for licensing issues, with both outputs combined into a single report. Which pattern does this describe?
Correct answer: A — Parallelization by sectioning, running the vulnerability and licensing checks as independent, simultaneous LLM calls
- A. Correct. Two distinct subtasks running independently and simultaneously, with their outputs combined afterward, is parallelization by sectioning.
- B. Incorrect. Voting repeats the same prompt multiple times to build confidence in one answer; here the two checks are different tasks, not repeated attempts at the same task.
- C. Incorrect. Evaluator-optimizer involves one LLM iteratively critiquing and refining another's output toward a quality target, not two independent checks combined into a report.
- D. Incorrect. Prompt chaining feeds one step's output into the next sequential step; the scenario describes two checks running independently and simultaneously, not sequentially.
6.The evaluator-optimizer loop
In an evaluator-optimizer loop, one call produces a response, a second call critiques it against criteria, and the loop repeats until the response passes. It is the same draft, review and revise cycle a human writer goes through. With Claude it is the most common chaining pattern: generate a draft, review it against criteria, then refine based on the review.
The pattern needs two conditions: clear evaluation criteria, and refinement that measurably improves the result. There are two signs it fits. First, the responses clearly get better when a human states their feedback. Second, an LLM can give that feedback itself. Literary translation passes both tests, because an evaluator can spot nuances the first translation missed. Complex search also fits: the evaluator decides whether another round of searching is needed.
That contrast is the key decision. Use an LLM evaluator when quality is a judgment, such as tone, nuance or completeness, that a model can put into words and the generator can act on. Use a programmatic gate when the test is a rule code can check. Every loop adds at least one more call per round, so stop it with a pass condition rather than letting it run open-ended. Defining the metrics an evaluator scores against is covered in evaluation metrics.
Refinement has stopped producing measurable value, which is one of the two conditions the pattern depends on. Cap the loop at the point where improvement levels off, or tighten the criteria so the evaluator's critiques give the generator something specific to fix.
Checkpoint 9 of 9· Check yourself
Before building a generate-and-critique loop for contract summaries, a team runs a pilot. Which pilot result shows that an evaluator-optimizer loop is a poor fit for this task?
The loop works only if responses demonstrably improve when feedback is articulated and an LLM can supply that feedback. If detailed feedback does not improve the drafts, iteration adds calls without adding value. The other results are signs the pattern fits.
“that LLM responses can be demonstrably improved when a human articulates their feedback; and second, that the LLM can provide such feedback”Source: www.anthropic.com
Sources
(7)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://www.anthropic.com/engineering/building-effective-agentsSecondary source
“The basic building block of agentic systems is an LLM enhanced with augmentations such as retrieval, tools, and memory.”
↩︎ The augmented LLM as the building block“generating their own search queries, selecting appropriate tools, and determining what information to retain”
↩︎ The augmented LLM as the building block“They are typically just LLMs using tools based on environmental feedback in a loop.”
↩︎ Workflows versus agents: who decides the next step“it's also common to include stopping conditions (such as a maximum number of iterations) to maintain control.”
↩︎ Workflows versus agents: who decides the next step“The autonomous nature of agents means higher costs, and the potential for compounding errors.”
↩︎ Workflows versus agents: who decides the next step“Agentic systems often trade latency and cost for better task performance, and you should consider when this tradeoff makes sense.”
↩︎ Start simple and add complexity only when it pays“They can also make it tempting to add complexity when a simpler setup would suffice.”
↩︎ Start simple and add complexity only when it pays“We suggest that developers start by using LLM APIs directly: many patterns can be implemented in a few lines of code.”
↩︎ Start simple and add complexity only when it pays“Prompt chaining decomposes a task into a sequence of steps, where each LLM call processes the output of the previous one.”
↩︎ Prompt chaining and routing: fixed steps and distinct categories“The main goal is to trade off latency for higher accuracy, by making each LLM call an easier task.”
↩︎ Prompt chaining and routing: fixed steps and distinct categories“Without this workflow, optimizing for one kind of input can hurt performance on other inputs.”
↩︎ Prompt chaining and routing: fixed steps and distinct categories“where classification can be handled accurately, either by an LLM or a more traditional classification model/algorithm”
↩︎ Prompt chaining and routing: fixed steps and distinct categories“Sectioning: Breaking a task into independent subtasks run in parallel.”
↩︎ Parallelization and orchestrator-workers: known versus emergent subtasks“This tends to perform better than having the same LLM call handle both guardrails and the core response.”
↩︎ Parallelization and orchestrator-workers: known versus emergent subtasks“subtasks aren't pre-defined, but determined by the orchestrator based on the specific input.”
↩︎ Parallelization and orchestrator-workers: known versus emergent subtasks“that LLM responses can be demonstrably improved when a human articulates their feedback; and second, that the LLM can provide such feedback”
↩︎ The evaluator-optimizer loop“Workflows are systems where LLMs and tools are orchestrated through predefined code paths.”
↩︎ Key concept“on any intermediate steps to ensure that the process is still on track.”
↩︎ Exam trap 2“For many applications, however, optimizing single LLM calls with retrieval and in-context examples is usually enough.”
↩︎ Exam trap 3“Voting: Running the same task multiple times to get diverse outputs.”
↩︎ Exam trap 4“tailoring these capabilities to your specific use case and ensuring they provide an easy, well-documented interface for your LLM”
↩︎ Checkpoint“Agents, on the other hand, are systems where LLMs dynamically direct their own processes and tool usage, maintaining control over how they accomplish tasks.”
↩︎ Prediction“workflows offer predictability and consistency for well-defined tasks”
↩︎ Checkpoint“workflows offer predictability and consistency for well-defined tasks, whereas agents are the better option when flexibility and model-driven decision-making are needed at scale.”
↩︎ Checkpoint“This workflow is ideal for situations where the task can be easily and cleanly decomposed into fixed subtasks.”
↩︎ Checkpoint“This workflow is particularly effective when we have clear evaluation criteria, and when iterative refinement provides measurable value.”
↩︎ Prediction - 2.https://code.claude.com/docs/en/agent-sdk/agent-loopOfficial docs
“Claude receives your prompt, along with the system prompt, tool definitions, and conversation history.”
↩︎ The augmented LLM as the building block“Claude continues calling tools and processing results until it produces a response with no tool calls.”
↩︎ Workflows versus agents: who decides the next step“Each set of tool results feeds back to Claude for the next decision.”
↩︎ Workflows versus agents: who decides the next step - 3.https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practicesOfficial docs
“With adaptive thinking and subagent orchestration, Claude handles most multistep reasoning internally.”
↩︎ Start simple and add complexity only when it pays“is still useful when you need to inspect intermediate outputs or enforce a specific pipeline structure”
↩︎ Prompt chaining and routing: fixed steps and distinct categories“Use subagents when tasks can run in parallel, require isolated context, or involve”
↩︎ Parallelization and orchestrator-workers: known versus emergent subtasks“generate a draft → have Claude review it against criteria → have Claude refine based on the review”
↩︎ The evaluator-optimizer loop - 4.https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/increase-consistencyOfficial docs
“Each subtask gets Claude's full attention, reducing inconsistency errors across scaled workflows.”
↩︎ Prompt chaining and routing: fixed steps and distinct categories - 5.
“Claude’s ability to route tickets effectively within your system is directly proportional to how well-defined your system’s categories are.”
↩︎ Prompt chaining and routing: fixed steps and distinct categories - 6.
“Latency is critical (multiple LLM calls add overhead)”
↩︎ Parallelization and orchestrator-workers: known versus emergent subtasks“Subtasks are predictable and can be pre-defined (use simpler parallelization)”
↩︎ Exam trap 1 - 7.
“LLM responses can be demonstrably improved when feedback is provided”
↩︎ The evaluator-optimizer loop