Overview
Anthropic separates workflows, where LLMs and tools follow predefined code paths, from agents, where the LLM directs its own process and tool use. Workflows give predictability, lower cost, and easier evaluation; agents give flexibility for tasks whose steps cannot be listed in advance. This page is the pattern catalog; multi-agent covers coordination across agents and reliable-agents-in-production covers hardening.
Start with an augmented LLM
One model call with retrieval, tools, and memory solves most “agent” requirements. Add structure only when a measured failure demands it, because every added call or agent is added failure surface and cost. Build directly on the model API first; many patterns are a few lines of code, and a framework you do not understand hides the prompts you need to debug. See tool-use-and-function-calling.
Choose a workflow when you can name the steps
| Pattern | Use when | Watch for |
|---|---|---|
| Prompt chaining | The task splits cleanly into fixed steps (outline, draft, edit) | Latency; add a programmatic gate between steps so errors fail fast |
| Routing | Inputs fall into distinct categories handled better apart; send easy cases to a cheap model | A misclassification cascading; validate the route before acting |
| Parallelization | Independent subtasks (sectioning) or several attempts at one judgment call (voting) | A token cost that multiplies by the fan-out |
| Orchestrator-worker | Subtasks are unknown until the input is read (multi-file edits, research) | Unbounded fan-out; cap the worker count |
| Evaluator-optimizer | Criteria are clear and iteration measurably helps (rubric writing, code that must pass tests) | Endless loops; cap rounds and calibrate the rubric with a real eval |
See prompt-chaining for the chain mechanics and evaluation for the harness behind an evaluator.
Use planner-executor for long-horizon work
A planner writes an explicit step list; an executor runs one step and reports; the planner replans when a step fails. The plan stays easy to inspect and recover from. See planner-executor and agent-loop.
Use an autonomous agent only for open-ended problems
Pick an agent when the number of steps cannot be predicted and you can trust its decisions in a sandbox. An agent is an LLM using tools in a loop and reading ground truth from the environment (tool results, test output) at each step. Include stopping conditions such as a maximum number of iterations, and show the plan so a person can follow it. Expect cost: Anthropic measured agents using about 4 times the tokens of a chat and multi-agent systems about 15 times, so the task must be worth it.
Constrain every pattern
- Force intermediate and final outputs through a schema so the next stage can parse them; see structured-output.
- Give every loop a hard step, token, and time budget so a stuck run halts instead of spinning.
- Evaluate the pattern against the single-call baseline; if it does not win on your eval, keep the simpler design.
Sources
- Anthropic, “Building Effective Agents” (December 2024): the workflow-versus-agent definition and the augmented-LLM, chaining, routing, parallelization, orchestrator-workers, and evaluator-optimizer patterns.
- Anthropic, “How we built our multi-agent research system”: the token-usage multiples.