Workflows Versus Agents

Time: ~10 minutes. Tangible win: given a task, classify it as a single call, a workflow, or an agent, and justify the choice in one sentence.

Lesson 0001 showed the loop. This lesson decides whether you need it. The most useful question in agent design is who decides the next step. If your code decides, you have a workflow. If the model decides, you have an agent. Choosing the wrong one costs you latency, money, and debugging time.

Primary source Building effective AI agents, Anthropic: read the sections "What are agents?" and "When (and when not) to use agents." It defines workflows and agents and recommends the simplest solution that works.

Three options, not two

Most tasks do not need an agent. Start from the bottom of this table and move up only when the simpler option fails on real inputs.

OptionWho decides the next stepGood forCost profile
Single LLM callYour codeClassification, extraction, draftingLowest
WorkflowYour code, with LLM steps insideKnown steps in a known orderPredictable
AgentThe model, in a loop with toolsOpen-ended tasks with an unknown number of stepsHighest and least predictable

Anthropic's guidance is direct on this point. Agentic systems trade latency and cost for better performance on hard tasks, so you should only pay that trade when the task requires it. Anthropic also notes that frameworks can hide the prompts and responses underneath, which makes debugging harder. Build the first version with direct API calls, then adopt a framework if it earns its place.

A useful test Write down the steps a competent engineer would follow. If you can write them as fixed steps, build a workflow. If the number and order of steps depends on what the tools return, an agent may be justified.

Practice

  1. Pick three tasks from your current work. For each, classify it as a single call, a workflow, or an agent.
  2. For every workflow, list its fixed steps in order. For every agent, name the decision the model must make at each step.
  3. For any task you classified as an agent, ask whether a workflow with one LLM step would meet the same need. Write down your answer.

Retrieval check

A nightly job extracts fields from invoices, checks that the totals add up, and writes valid rows to a database. Which design fits best?

Correct. The steps are known in advance, so your code should own the sequence. The LLM does the extraction inside one step.

Not quite. The steps and their order are fixed, so a workflow is the simplest design that works. Adding autonomy here adds cost and risk without a benefit.

What trade-off do agentic systems usually introduce?

Correct. Agents make more model calls and wait on tools, so they cost more and run slower. You accept that trade only when the task needs it.

Not quite. Agents make more model calls and wait on tools, which increases latency and cost. Anthropic frames that as a trade for better results.

Ask the agent: "Classify this task for me: [describe a task from your work], and tell me what would change my answer." Next lesson covers tools, the part of an agent that touches the real world.