Agents vs. Workflows: When to Use Which
Not everything should be an agent. Learn the spectrum from single prompts to chains to autonomous agents and how to choose.
Once you've seen what agents can do, it's tempting to make everything an agent. Resist that. Many of the most reliable AI systems in production aren't agents at all. They're a few well-placed model calls wired together with ordinary code, and they're cheaper, faster, and far easier to debug than an agent doing the same job.
The real skill isn't building agents; it's knowing how much autonomy a task actually needs. In this lesson you'll learn the spectrum from a single prompt to a fully autonomous agent, the common patterns in between, the trade-offs at each step, and a short set of questions that tell you where any task belongs. You'll also see a small, runnable example of a workflow, so you can feel the difference between code deciding the steps and the model deciding them.
Workflows vs. agents: who decides the next step?
Both workflows and agents use language models. The difference is who controls the sequence of steps.
- In a workflow, your code decides the steps. The model is called at fixed points, for example "summarize this", then "classify that", but the path through the system is written in advance by you.
- In an agent, the model decides the steps. It's given a goal and some tools, and it chooses what to do next, how many steps to take, and when it's finished, using the loop from The Agent Loop.
Anthropic's widely cited engineering guide, "Building effective agents" (December 2024), draws the line in the same place, and makes the same core recommendation this lesson does: find the simplest solution that works, and add autonomy only when it clearly improves results.
| Workflow | Agent | |
|---|---|---|
| Who decides the steps | Your code | The model |
| Number of model calls | Fixed or bounded | Varies by task |
| Predictability | High | Lower |
| Cost and latency | Lower, and easy to estimate | Higher, and varies run to run |
| Debugging | Inspect each fixed step | Read through a trace of decisions |
| Handles surprises | Only the ones you planned for | Can adapt to new situations |