epochs

Learn · Module 10 · Agents · Lesson 2 of 6

Workflows or agents?

Most problems don't need an agent. A fixed sequence of steps is cheaper, faster and easier to trust.

4 minute read

In short
  • Workflows follow steps you define; agents choose steps at run time.
  • If you can draw it as a flowchart, use a workflow.
  • Common patterns: chain, router, parallel, evaluate and retry.

In plain words

A workflow is a sequence of steps that you define in code, with model calls at some of them: classify the email, then pick a template, then fill it in. An agent decides its own steps at run time.

The rule of thumb: if you can draw the steps as a flowchart in advance, build a workflow. Use an agent only when the path genuinely depends on what's discovered along the way.

Worked example: two support tasks

workflowagent
Steps decided byyour codethe model, as it goes
Predictabilityhigh: same path every timelower: path varies
Cost and speedfixed and lowvaries, often higher
Testingtest each step on its owntest whole runs
Best forknown processesopen-ended tasks
  1. 1
    Task A: tag and route incoming tickets

    Always the same: classify the ticket, look up the team, assign. A workflow with one model call for classification.

    classify → lookup → assign
  2. 2
    Task B: investigate why a customer was charged twice

    The steps depend on what's found: check payments, then maybe refunds, then maybe a bug report. An agent with read-only tools fits.

    ?

Common workflow patterns

patternwhat it does
ChainStep 1's output feeds step 2, and so on.
RouterClassify first, then send to a specialised prompt or model.
ParallelRun several calls at once (for example, check five rules) and combine.
Evaluate and retryOne call drafts, another checks, redo if it fails.
Your turn

You need to extract fields from invoices, validate them, and save them. Which is a better fit?

What to remember

Start with the simplest thing that works: one well-designed call, then a workflow, and only then an agent. Many 'agent' products in production are mostly workflows, with an agent used for one open-ended step.

Common mistakes

  • Starting with an agent because it sounds more advanced, when a fixed workflow would be more reliable.
  • Giving an agent a task whose steps are always the same.
  • Not measuring whether the agent actually beats a simpler workflow.
Check yourself

Answer in your own words, out loud or on paper, before you open the model answer.

When would you use an agent instead of a fixed workflow?

I'd start with a fixed workflow whenever the steps are known in advance, like classify, then retrieve, then answer, because it's more predictable, cheaper, faster and easier to test. I'd use an agent when the path genuinely depends on what's discovered along the way, so the number and order of steps can't be written down ahead of time, for example researching a question across several sources, or fixing a failing test where each step depends on the last error. Even then, I'd constrain it: a small set of tools, step and budget limits, and checkpoints. I'd also keep the workflow as a baseline and only switch if the evaluation shows a clear improvement.

More to think about
  • Describe a router pattern and when it helps.
  • How would you design a system to triage support tickets?

Go further

Was this lesson clear?