Lesson 4.2 · 7 min read · about 50 min to master at a very slow pace
Workflows versus Agents
An agent lets the model choose its own steps; a workflow fixes the steps in code. The common workflow patterns (chaining, routing, parallel, evaluator loop), when a true agent is worth it, and why most client systems should start as workflows.
Two ways to combine LLM calls
- A workflow: your code decides the sequence of steps; the LLM does the work inside each step. Predictable, testable, cheap.
- An agent: the LLM decides the next step in a loop, choosing tools until it judges the task done. Flexible, but less predictable, slower and costlier.
The question is not "agent or not" but how much control to hand to the model. Hand over only as much as the task needs.
Workflow patterns
| Pattern | How it works | Client example |
|---|---|---|
| Chaining | Step 1's output is step 2's input, with checks between | Extract facts from a contract → draft a summary → check it against the facts |
| Routing | Classify the input, send it to a specialised path | Support email → billing, technical or returns prompt (each with its own tools) |
| Parallel | Run independent calls at once, combine results | Review a document for legal, financial and tone issues simultaneously |
| Orchestrator–workers | One LLM splits the task; workers do the parts | Update documentation for every module touched by a change |
| Evaluator loop | One call drafts, another critiques; repeat until it passes | Translate marketing copy, check terminology, revise |
When an agent earns its place
Use an agent when the steps cannot be known in advance: open-ended research, debugging, multi-system investigations ("why was this customer charged twice?"). Check three things first:
- Is the task valuable enough to justify higher cost and latency?
- Can mistakes be caught and undone (draft, not send; read, not write)?
- Can you tell when it has succeeded, so you can evaluate it?
Same client, two designs
An accounting firm wants help with incoming invoices.
- Workflow: extract fields → validate against the supplier list → route exceptions to a human. 95% of invoices, fully testable, cents per document.
- Agent for the exceptions: given read-only tools (supplier database, past invoices, email search), it investigates a mismatch and writes a note for the accountant. It never posts anything itself.
Start simple
A single well-prompted call with retrieval solves more than people expect. Add a workflow when one call is not enough, and an agent when the workflow's fixed steps are the bottleneck.
Stuck? Common doubts
Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.
First passIs a RAG chatbot an agent?
Not if retrieval always runs once and the model just answers: that is a workflow. It becomes agentic when the model decides whether and what to search, and can search again based on what it found.
Going deeperDo I need an agent framework?
Not to start. An agent is a loop: call the model with tools, run requested tools, append results, stop on a final answer or a limit. Frameworks help with tracing, durable state and multi-agent setups; adopt one when you need those, and make sure you can see the exact prompts it sends.
Cheatsheet
Workflow vs agent
Workflow patterns
Agent checklist
Check your understanding
Score 75% or more to master this lesson and earn XP. Answer first, then check.