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.

Not startedJump to quiz

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

PatternHow it worksClient example
ChainingStep 1's output is step 2's input, with checks betweenExtract facts from a contract → draft a summary → check it against the facts
RoutingClassify the input, send it to a specialised pathSupport email → billing, technical or returns prompt (each with its own tools)
ParallelRun independent calls at once, combine resultsReview a document for legal, financial and tone issues simultaneously
Orchestrator–workersOne LLM splits the task; workers do the partsUpdate documentation for every module touched by a change
Evaluator loopOne call drafts, another critiques; repeat until it passesTranslate 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:

  1. Is the task valuable enough to justify higher cost and latency?
  2. Can mistakes be caught and undone (draft, not send; read, not write)?
  3. 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: code fixes the steps (predictable, cheap). Agent: the model picks steps in a loop (flexible, costly).

Workflow patterns

Chaining, routing, parallel, orchestrator–workers, evaluator loop.

Agent checklist

Steps unknowable in advance? Valuable enough? Mistakes reversible? Success measurable? Otherwise use a workflow.

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1conceptWhat distinguishes an agent from a workflow?
Q2applySupport emails must go to billing, technical or returns handling, each with different tools. Which pattern fits?
Q3applyA client wants an assistant to find out why a customer was charged twice, across billing, CRM and email systems. Which design is most appropriate?
Q4interpretA workflow handles 95% of invoices reliably at cents each. The team proposes replacing it with an agent "to be more flexible". What is the best response?
Q5conceptWhat does the evaluator loop pattern do?