Workflow Patterns

Time: ~12 minutes. Tangible win: choose one of five composable patterns for a task and state its main trade-off in one sentence.

Most production agent systems are assembled from a small set of patterns. Anthropic describes them as building blocks rather than rules. Each one trades something for something else, and recognizing the trade lets you pick the right one without trying every option.

Primary source Building effective AI agents, Anthropic: the section "Building block: The augmented LLM" and the five workflow patterns that follow it. Each pattern has a "when to use" note worth reading.

The five patterns

PatternShapeUse it whenTrade-off
Prompt chainingSequential steps, with checks between themA task splits cleanly into fixed subtasksHigher latency for higher accuracy
RoutingClassify the input, then send it to a specialized pathDistinct categories need separate prompts or toolsClassification errors send work down the wrong path
ParallelizationRun subtasks at once, or run the same task several timesSubtasks are independent, or you want several opinionsMore total cost, and results must be merged
Orchestrator-workersA central model plans subtasks and delegates themYou cannot predict the subtasks in advanceFlexible, but harder to test and predict
Evaluator-optimizerOne call generates, another critiques, and the loop repeatsClear criteria exist and feedback measurably helpsCosts extra rounds, and needs good criteria

Routing has a useful cost detail. Anthropic's example sends easy questions to a smaller, cheaper model such as Claude Haiku and hard questions to a more capable one such as Claude Sonnet. In your own systems, use claude-haiku-5-5 and claude-sonnet-5-5, the approved models for this course.

Combine patterns These are building blocks, not exclusive choices. A common shape routes a request, runs a chain for the chosen category, and gates the result with an evaluator. Add each piece only when it measurably improves outcomes.

Practice

  1. Take a task from lesson 0002 that you classified as a workflow. Name the pattern that fits and write its trade-off in one sentence.
  2. Sketch the pattern as boxes and arrows on paper. Mark where a check or gate belongs.
  3. Identify one place in the sketch where a cheaper model could handle the step. Note the eval from lesson 0006 that would confirm the cheaper model is good enough.

Retrieval check

A drafted document must be translated next, with a quality check between the two steps. Which pattern fits?

Correct. The steps are fixed and ordered, and a programmatic gate checks the intermediate output before the next step runs.

Not quite. The steps run in a fixed order with a check between them, which is the defining shape of prompt chaining with a gate.

A coding task needs an unknown number of file edits, and the subtasks depend on what the code contains. Which pattern fits?

Correct. The orchestrator decides the subtasks from the input, which suits work where the steps cannot be listed in advance.

Not quite. Here the subtasks are not known in advance, so a fixed split or single route will not work. An orchestrator plans the subtasks from the input.

Ask the agent: "Compare two patterns for this task: [describe it], and tell me which trade-off matters more." Next lesson covers multi-agent systems, and when adding more agents is worth the cost.