How it works · 30 of 49 Core
AI workflows vs AI agents: what is the difference?
A fixed path or the model decides
Workflows vs agents: A workflow is a path written in code: classify the request, look up the order, check the policy, draft the reply, in that order every time. An agent lets the model choose each next step and tool until it decides it is done. Workflows are predictable: the same steps, cost and tests on every run, but a request the path doesn't cover can only be handed to a person. Agents handle the unexpected, at the price of a different route, cost and time on every run, more chances for one wrong step to spoil the answer, and harder testing. Use a workflow when you can draw the path; an agent when you can't predict the steps.
Loading the animation…
Say it like this A workflow runs steps your code fixed in advance, predictable in cost and easy to test; an agent lets the model pick each next step, flexible for requests you can't predict but different in cost and route every run, so use an agent only where you can't draw the path.
Under the hood — for builders
- The source, in its words
- Erik S. and Barry Zhang ("Building effective agents", Anthropic, Dec 2024): "Workflows are systems where LLMs and tools are orchestrated through predefined code paths"; agents are systems where "LLMs dynamically direct their own processes and tool usage." "The autonomous nature of agents means higher costs, and the potential for compounding errors."
- In our papers
- anthropics-commerce-agents: the shopping assistant is an agent (a "Messages API loop" picks catalogue, cart and order tools), while payment stays a fixed path and every merchant change "waits for a staff member to approve".
- Run here: right, wrong, handed off
- 1,000 refund requests, 80% routine and 20% unusual (also charged twice). Every call is wrong 1.5% of the time; the agent picks a needed tool 60% of the time. Rates are ours.
- Run here: the taxi's meter
- Calls per request for the agent (seed 1). The workflow made exactly 4 every time (2 when it handed off).
- Workflow patterns
- Anthropic names five: "prompt chaining", "routing", "parallelization", "orchestrator-workers", "evaluator-optimizer". Try them before an agent.
- When to use an agent
- Anthropic: "open-ended problems where it's difficult or impossible to predict the required number of steps"; test in sandboxes, with guardrails (F6).
- Measure it
- Success per request type · calls and cost per request (median and worst) · wrong answers, not only solved ones.
- Watch out
- Mix them: a workflow with one agent step, or an agent whose risky actions follow a fixed path. Cap the agent's calls. Our run is a toy.
- Sources
- Erik S. and Barry Zhang, "Building effective agents", Anthropic Engineering, 19 Dec 2024, read in session · paper anthropics-commerce-agents, checked 19 Nov · refund simulation, Python, 19 Nov 2026.
What happens in the workflows vs agents animation, step by step?
Workflow or agent: Workflow
- One request: a refund for a broken kettle. A workflow is a fixed path in code: classify, look up the order, check the policy, reply.
- The train stops at the same four stations every run: 4 calls, the same cost, easy to test.
- An unusual request: the kettle broke and the card was charged twice. There is no track to Payments, so the workflow hands it to a person.
- Your turn: switch to Agent, top right, and send the same requests by taxi.
Workflow or agent: Agent
- An agent is a taxi: the model picks each next street. Same refund, its own route.
- Your turn: tap Run again below. The route and the meter change every run; the train's never do.
- The unusual request: the taxi finds the payments office on its own and solves it. That flexibility is what an agent is for.
- Anthropic's advice: start with the simplest thing that works, and use an agent only where the steps can't be predicted. Next: several agents at once.
What everyday example explains workflows vs agents?
A train on rails vs a taxi. The train is on time and goes only where the track goes; the taxi goes anywhere, and the meter is different every ride.
Why should a team care about workflows vs agents?
"should this be an agent?" is the most common AI design question, and the wrong answer costs either a brittle product or an unpredictable bill. The answer is per step, not per product.