Agent patterns

"Build an agent" is rarely the right first move. Most reliable LLM systems are workflows — fixed, predictable arrangements of LLM calls — and only some need a true agent that decides its own steps. These are the building blocks (from Anthropic's Building Effective Agents) and when to reach for each.

chainingrouting parallelizationorchestrator–workers evaluator–optimizer

Workflow or agent?

The key distinction: in a workflow, you wire up the control flow in code — the path is fixed and you can predict it. In an agent, the model directs its own process, choosing tools and steps in a loop until it decides it's done. Agents are more flexible but less predictable and more expensive, so the rule of thumb is: use the simplest thing that works — a single prompt first, then a fixed workflow, and only reach for an autonomous agent when the task genuinely needs open-ended, hard-to-script decisions. Step through the patterns, simplest to most autonomous:

Composing them

These aren't mutually exclusive — real systems nest them. A router might dispatch to a chain; an orchestrator's workers might each run an evaluator-optimizer loop; an autonomous agent might call a whole workflow as one of its tools. The discipline is to add autonomy only where it earns its keep, keep a human in the loop for consequential actions, and always cap the loop (max steps / budget) so an agent can't run away. The fully autonomous end of this spectrum — an LLM looping over Thought → Action → Observation with tools — is the ReAct agent you can drive in its own explainer.

Takeaways: prefer workflows (predictable, coded control flow) over agents (model-directed, flexible but costly) until the task needs open-ended decisions. Chaining = sequential steps; routing = classify then dispatch; parallelization = fan-out + aggregate; orchestrator–workers = dynamic subtasks; evaluator–optimizer = generate-and-critique loop. Compose them, keep humans on consequential steps, and bound every loop.

Curated companion: Anthropic — Building Effective AI Agents.