# An AI agent is an LLM that directs its own tool use; a workflow follows code paths you defined

> A workflow orchestrates LLMs and tools through predefined code paths, an agent lets the LLM decide its own steps and tool use, and a chatbot (this wiki's working term) is a single model call without a tool loop.

## Answer

A **workflow** is a system where LLMs and tools are orchestrated through predefined code paths. An **agent** is a system where the LLM dynamically directs its own process and tool usage. Most tasks need neither: a single, well-prompted model call is enough until you can show that more structure improves results. Definitions checked 2026-09-28 against Anthropic's "Building effective agents".

## Details

### The three terms

The first two definitions come from Anthropic's engineering post. The third is not defined there, so it is this wiki's working definition.

- **Workflow.** Your code decides the order of steps. The model fills in each step, but never chooses the next one.
- **Agent.** The model decides which tool to call next and when to stop. Your code provides the tools and the loop, see [[tool-calling-loop-explained]].
- **Chatbot (working definition).** One model call, or a conversation of such calls, with no tool loop. "Chatbot" has no primary-source definition, so treat this as a convention for this wiki, not a standard.

### The five workflow patterns

Anthropic's post names five patterns. All of them are fixed code paths.

1. **Prompt chaining:** sequential calls, each processing the previous output.
2. **Routing:** classify the input, then send it to a specialized follow-up.
3. **Parallelization:** run tasks at the same time, or the same task several times, and aggregate.
4. **Orchestrator-workers:** a central LLM delegates subtasks to worker LLMs.
5. **Evaluator-optimizer:** one LLM generates, another gives feedback in a loop.

### Decision table

Ask the first four questions in order and stop at the first row that fits. The last two rows are modifiers that apply on top.

| Question | If yes | Build |
|---|---|---|
| Can one prompt do it and meet your quality bar? | Stop here | Single call |
| Are the steps known and fixed in advance? | Encode them in code | Workflow: chaining, routing or parallelization |
| Are the subtasks unknown until the input is seen, but the overall shape is bounded? | Let one LLM split the work | Workflow: orchestrator-workers |
| Is the number of steps unpredictable and the problem open-ended? | Give the model the loop | Agent |
| Do the steps have side effects (writes, payments, deletes)? | Add human approval and a sandbox | Any of the above, more guarded |
| Is your cost and latency budget tight? | Prefer fewer model decisions | Move one row up |

### One task, three builds

Task: "Answer customer emails about invoices."

| Build | What it looks like |
|---|---|
| Single call | Paste the email and a policy text into one prompt, return the draft. |
| Workflow | Code classifies the email (routing), fetches the invoice by number, then a second call drafts the reply. |
| Agent | The model searches invoices, asks for a missing number, checks payment status and decides when the case is resolved. Worth it only if emails vary so much that no fixed path covers them. |

### Why not default to an agent

The post says agentic systems often trade latency and cost for better task performance, and to add complexity only when it demonstrably improves outcomes. Anthropic's multi-agent write-up reports that agents use about 4x the tokens of chat (vendor-reported, 2025-06-13). The post also warns that the autonomous nature of agents means higher costs and the potential for compounding errors, and recommends extensive testing in sandboxed environments with appropriate guardrails.

### Common mistakes

- Calling any prompt with a tool "an agent". If your code fixes the order of calls, it is a workflow.
- Starting with an agent because the demo looked good, without measuring a single call first.
- Giving an agent side-effecting tools with no approval step or sandbox.
- Skipping evaluation. See [[how-to-evaluate-an-ai-agent]].

## See also

- [[tool-calling-loop-explained]]
- [[when-to-use-multi-agent]]
- [[how-to-evaluate-an-ai-agent]]
- [[agent-stuck-in-loop-troubleshooting]]

## Sources

- [Anthropic — Building effective agents (published 2024-12-19)](https://www.anthropic.com/engineering/building-effective-agents)
- [Anthropic — How we built our multi-agent research system (published 2025-06-13)](https://www.anthropic.com/engineering/multi-agent-research-system)

## Sources

- [Anthropic — Building effective agents (published 2024-12-19)](https://www.anthropic.com/engineering/building-effective-agents)
- [Anthropic — How we built our multi-agent research system (published 2025-06-13)](https://www.anthropic.com/engineering/multi-agent-research-system)