Agent orchestration: workflows before agents
Use the simplest composition that works: a single call, a fixed workflow, and only then an autonomous agent loop with limits.
Anthropic's engineering post Building effective agents draws a useful line: workflows are LLM calls orchestrated through predefined code paths; agents are systems where the model directs its own process and tool use. It recommends finding the simplest solution and adding complexity only when it demonstrably improves results (official, see sources).
| Pattern | Shape | Use when |
|---|---|---|
| Prompt chaining | Fixed sequence of calls, each checking or transforming the last | The task splits cleanly into steps |
| Routing | Classify the input, send it to a specialised prompt or model | Distinct request types with different handling or cost |
| Parallelisation | Run sections or votes concurrently, then aggregate | Independent sub-tasks, or you want several opinions |
| Orchestrator-workers | One call plans sub-tasks, workers do them, orchestrator merges | Sub-tasks cannot be known in advance |
| Evaluator-optimiser | One call drafts, another critiques, loop until good enough | Clear quality criteria and iteration helps |
| Autonomous agent | Model loops: think, call tool, observe, until done | Open-ended tasks where steps cannot be predicted |
What production agents need
- A harness: the loop that calls the model, executes tools, manages context (caching, compaction, memory) and recovers from errors. Anthropic's Managed Agents post describes exactly this as the job (official, Sources A5).
- Budgets: max steps, max tokens, max wall-clock time, max spend per task.
- Checkpoints and durability: long tasks survive restarts (durable execution / workflow engines).
- Observability: a trace of every step, tool call and token count, so a failure can be replayed.
- Human-in-the-loop for irreversible actions, and a clear stop condition.
- Sandboxing for code execution and browsing.
Practice
Written for this site to drill the lesson. Not reported interview questions.
- Design an agent that triages failing CI builds and opens a fix PR. Where are the human checkpoints, and what are its budgets?
- A support agent sometimes loops forever calling search. Name three mechanisms that stop it, and how you would detect it in production.
- Turn an "autonomous research agent" proposal into a workflow. What do you lose and gain?
Check yourself
What is the difference between a workflow and an agent, in Anthropic's terms?
Workflows follow predefined code paths; agents let the model direct its own process and tool use.
Name four things a production agent harness needs.
Any four of: budgets, durability/checkpoints, observability/tracing, human approval for irreversible actions, sandboxing, error recovery, context management.