Lever 01 up close: deciding, at each point, whether your code drives or the model drives — and naming the five shapes the workflow side comes in.
Lesson 1 gave you the map and its master lever: control flow — who decides the next step, your code (a workflow) or the model (an agent). The single most important correction to make to your intuition is this: that choice is not made once for the whole system. It's a dial you set at every decision point.
A production “agent” is usually a mostly-deterministic program with the model dialled in at a few high-leverage spots, and dialled out everywhere reliability is cheaper to get from code.2 Your job this lesson: learn to set the dial deliberately, and to recognise the five named shapes the workflow end comes in.1
Anthropic’s headline finding, after surveying dozens of production deployments, is almost anticlimactic:
Consistently, the most successful implementations weren't using complex frameworks… they were building with simple, composable patterns. Find the simplest solution possible, and only increase complexity when needed… add complexity only when it demonstrably improves outcomes. — Anthropic, Building Effective Agents
So the dial has a default position, and the default is “toward code.” You earn each click toward the model end by showing it buys you something a deterministic path couldn’t. Before reaching for an autonomous agent, ask two questions:
Everything on the workflow side of the dial is a composition of five patterns. Learn them as a vocabulary: when a problem arrives, you want to name the shape, not invent it.1
Fixed sequential steps; each call works on the last one’s output, with optional code checks (“gates”) between.
Classify the input, then dispatch to a specialised path. Lets you optimise each category — and pick cheap vs. capable models.
Run calls at once. Sectioning splits independent subtasks; voting runs the same task several times for confidence.
A lead model breaks a task into subtasks at runtime, delegates to workers, and synthesises. For when you can’t list the subtasks up front.
A generator produces; a separate critic scores and feeds back; loop until good. Needs clear evaluation criteria to converge.
| When the task… | Reach for |
|---|---|
| splits cleanly into fixed, ordered subtasks | Prompt chaining |
| falls into distinct categories handled differently | Routing |
| has independent parts, or needs multiple looks for confidence | Parallelization |
| needs subtasks you can’t predict until you start | Orchestrator–workers |
| has a clear quality bar and improves with critique | Evaluator–optimizer |
Routing and evaluator–optimizer are the two you’ll reach for most. Both keep the structure in code and put the model on a leash — exactly the discipline Lesson 1 called “own your control flow”:
route = model(classify_prompt(query)).label # model returns a label only
handler = { # the switch is yours, not the model's
"refund": handle_refund,
"technical": handle_technical,
"general": handle_general,
}[route]
return handler(query) # specialised path per category
draft = model(generate_prompt(task))
for _ in range(MAX_ROUNDS): # bounded loop — see Lesson 4
verdict = model(critique_prompt(draft)) # a second call grades the draft
if verdict.passes:
return draft
draft = model(revise_prompt(task, draft, verdict.feedback))
return draft # best effort within the budget
You dial all the way to agent for “open-ended problems where it’s difficult or impossible to predict the required number of steps.”1 That flexibility is bought with cost, latency, and a wider blast radius for mistakes — which is exactly why the later levers (context, budgets, error recovery) exist: they’re the guard-rails that make the agent end of the dial safe to use.
Given a task, you can now (1) set the dial with the two-question gate instead of defaulting to “build an agent,” and (2) name which of the five patterns fits — chaining, routing, parallelization, orchestrator–workers, evaluator–optimizer — and say why. That’s the core design skill of Lever 01.
Retrieve, don’t re-read. Map each scenario to its pattern from memory.
Anthropic — Building Effective Agents. Re-read the “Workflows” section: each of the five patterns has a diagram and a worked example. ~15 minutes. Notice how every example keeps the structure in code and the model on a leash.
TradingAgents pipeline into these five patterns? Just ask in the chat.