1ConceptIntermediate 3
What is the difference between an agent and a workflow?
Short answer
A workflow runs model calls and tools along steps fixed in code, so its path is predictable. An agent lets the model decide its own next step in a loop: think, call a tool, observe the result, repeat until done. Agents handle open-ended tasks but are harder to predict, test and keep cheap.
The explanation
Anthropic's widely cited write-up draws this line and recommends the simplest thing that works: a single well-prompted call, then a workflow such as prompt chaining, routing or evaluator-optimizer, and only then an agent. Many "agents" in production are really workflows with a few model decisions, which is often the right call.
A good answer names the trade-off: agents add flexibility at the cost of latency, cost, debugging effort and risk. Use them when the steps cannot be known in advance, and add guardrails: step limits, tool permissions, logging and human approval for risky actions.
Here is how I explain it. Turning invoices into ledger entries is a workflow: extract fields, validate, post, always in that order. Investigating why a customer's payment failed is better as an agent: it might check the payment gateway log, then the bank status, then the order history, in whatever order the evidence leads. I start with a workflow and only move to an agent when the steps genuinely cannot be fixed in advance.
They may follow up with
- Give an example task where a workflow is better than an agent.
- What guardrails would you add to a production agent?
Avoid
- Calling every LLM app an agent
- Choosing an agent without saying why a simpler workflow would not work