2.1 Workflows vs Agents
Key Takeaways
- Workflows use predefined code paths; agents dynamically direct their own process.
- Prompt chaining works when the step order is known.
- Routing works when inputs belong to known categories.
- Orchestrator-worker fits tasks where subtasks cannot be predicted ahead of time.
Pattern Selection
A workflow orchestrates model calls and tools through a predefined path. An agent lets the model dynamically decide how to proceed, often with tool calls and looped observations. Agents are more flexible, but they cost more to evaluate and control.
Common Patterns
| Pattern | Use when |
|---|---|
| Single call | Task is direct and bounded |
| RAG call | Answer needs current context |
| Prompt chain | Steps are known in order |
| Routing | Inputs fall into categories |
| Parallelization | Subtasks are independent |
| Orchestrator-worker | Subtasks are dynamic |
| Evaluator-optimizer | Quality can be judged clearly |
Exam Decision Rule
Choose autonomy only when it creates measurable value. If a classification step can route requests reliably, do not build a general agent. If a known sequence can solve the task, do not ask an agent to discover that sequence every time.
Failure Modes
Agents can loop, call the wrong tool, overuse context, or make coordination mistakes between subagents. Workflows can be too rigid and fail when inputs vary. Good architects know both failure modes and select the least complex design that still handles the real input distribution.
A support system classifies requests as billing, technical, or account access, then sends each to a specialized prompt. Which pattern is this?