# Workflow vs Agent?

> Workflows versus agents: who picks the next step, when each one fits, and why to start simple, explained for your AI interview.

**In short:** A workflow runs fixed steps in an order your code writes down. An agent lets the model choose its own next step and tools until the task is done. Start with the simplest option that works, and add agent freedom only when the task needs it.

AI and LLM interview question Q158, Agents and tool use. Intermediate, very common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/workflow-vs-agent

## Say it in 30 seconds

A workflow runs fixed steps in an order my code sets. With an agent, the model picks its next step and tool, reads the result, and loops until the job is done. Anthropic's advice is to start with the simplest option, often one model call, and move to an agent only when the steps can't be known in advance. Agents cost more and can compound errors, so they need stopping rules and testing.

## Say it in 2 minutes

Here is the simple split. In a workflow, my code decides the order of the steps. The model may do real work inside a step, like summarising a claim, but the path was written in advance. In an agent, the model decides what happens next. It picks a tool, reads what came back, and decides again. The Claude Agent SDK docs describe an agent as an application that plans its own steps and calls tools.

Take a motor insurer with about 4,000 claims a month. Most claims are routine, so a workflow handles them in a fixed order: read the form, check the policy is active, pay small claims that match a template, and send the rest to an adjuster. Every step is easy to test and budget, which matters when a wrong payment costs money.

An agent fits a different job. Imagine a coding agent that runs in a payments team's build pipeline and gets a failing test. The fix might touch three files or thirty, so nobody can write the steps in advance. The agent reads the log, edits code, runs the tests and loops. It needs a stopping rule, a limit on steps, and tests on a safe copy of the system, because one bad edit can compound.

So my default is the simplest thing that works: one model call that is given the right documents first (called retrieval), then a workflow. I would move to an agent only when the steps really can't be known in advance and a person can check the result.

## What is the difference, in plain words?

A workflow is a set of steps that a developer writes in code. A model may handle one of the steps, such as summarising an email, but the code decides what runs next.

An agent hands that decision to the model. It chooses its next step and its next tool, reads the result, and chooses again, until it has an answer or hits a limit.

Anthropic's December 2024 article groups both kinds under agentic systems, then draws the line at who decides the path.

Picture a bank's loan desk. A new clerk works from a checklist: verify ID, check the limit, draft the letter. A senior credit analyst decides her next check based on what she finds. The checklist is the workflow and the analyst is the agent. Both have a place. The job decides how much freedom to give.

- **Workflow:** Steps linked in code. A model can fill a step, but your code picks the next one.
- **Agent:** A model that picks its own steps and tools, in a loop, until the task is done.
- **Tool:** Something your code runs for the model, like a file read, a database lookup or an email send.
- **Stopping rule:** A limit, such as a maximum number of steps, that ends a run before it goes on forever.

## How do the two differ in practice?

- **Workflow: Your code picks the path.** Steps and their order are written in advance. Easy to test, predictable in cost, and right for a job with known parts.
- **Agent: The model picks the path.** Steps and tools are chosen as it runs. Fits open-ended jobs, but costs more and mistakes can pile up.

> "Workflows are systems where LLMs and tools are orchestrated through predefined code paths." (Anthropic, on workflows)
>
> "Agents, on the other hand, are systems where LLMs dynamically direct their own processes and tool usage, maintaining control over how they accomplish tasks." (Anthropic, on agents)

Take a motor insurer's claims desk. It gets about 4,000 claims a month. Most are routine, so a workflow handles them in a fixed order: read the form, check the policy is active, pay small claims that match a template, and send the rest to an adjuster. The monthly cost is easy to predict.

*Diagram, Who picks the next step?: Both paths start from the same task. In a workflow, your code sends the work down steps written in advance. In an agent, the model chooses each step, so the route can differ each time.*
1. On the workflow path, the work follows steps your code set in advance.
2. On the agent path, the model chooses each tool as it goes.
3. The fixed steps finish, and the result is easy to predict and test.
4. An agent may take a different route each time, so it is harder to test.

## What does an agent loop look like?

An agent is usually a loop. The Claude Agent SDK docs (a library for building production AI agents) put it this way: "Claude continues calling tools and processing results until it produces a response with no tool calls." The model asks, your code acts, and the result goes back.

*Diagram, The agent loop: The model and your code take turns: the model asks for a tool, your code runs it and returns the result, and the model decides again. The loop ends when no tool is needed. Because a model can keep asking for tools, an agent needs a stopping rule, such as a maximum number of steps.*
1. Your task goes in, with the rules and the list of tools.
2. The model picks one tool and asks for it.
3. Your code runs the tool and sends the result back to the model.
4. When it needs no more tools, the model stops and answers.

Your code runs the tools you define, so it is the place to check each call before it runs. Anthropic's guide says it is common to add stopping conditions, such as a maximum number of loops, to keep control. Agents can also pause for a person at checkpoints or when they hit a blocker.

## Which one should you build?

Anthropic's rule is to find the simplest solution and add complexity only when needed. In practice that gives this order. Go down it and stop at the first step that solves the job.

1. **One model call:** Give the model the right documents first (retrieval, which means looking up the facts it needs) and a few examples. Anthropic says that is usually enough for many applications.
2. **A workflow:** Write the steps in code when the job splits into fixed parts, like the claims desk.
3. **An agent:** Use one when the steps can't be known in advance. Keep a person in the loop for risky actions.

> "we recommend finding the simplest solution possible, and only increasing complexity when needed." (Anthropic)
>
> "The autonomous nature of agents means higher costs, and the potential for compounding errors." (Anthropic)

Agents suit open-ended problems. Anthropic describes them as fitting work where it's difficult or impossible to predict the required number of steps.

> **Tip:** Name the source and its date when you quote it, and say which parts of the advice are about the idea and which are about a tool that may change.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain split: in a workflow your code picks the path, in an agent the model does.
- [ ] One real example of each, from a team's work.
- [ ] Why start simple: cost, speed and easier testing.
- [ ] Agents need stopping rules, step limits and tests on a safe copy of the system.
- [ ] A person's check before risky actions.
- [ ] The honest trade-off: agent flexibility costs predictability.

**Common traps**

- Trap: "Agents are just chatbots with better models." Better: An agent runs a loop: it picks tools, reads results and decides when it is done.
- Trap: "Always build an agent, it is the smarter choice." Better: Agents cost more and can compound errors. Start simple and add freedom only when the job needs it.
- Trap: "A workflow doesn't use AI at all." Better: Workflows call models too. The difference is who decides the order: your code or the model.

## Can you spot the agent?

**Spot the agent:** Which of these four systems lets the model choose its own next step?

A. A nightly job copies new support tickets into the reporting database.
B. Each incoming refund request is checked for three things, then sent to a human.
C. The assistant decides whether to look up the order, the policy or the shipping status, and keeps going until it can answer.
D. A classifier sorts each customer message into one of four queues.

**Answer:** C. Only the third one lets the model decide its own next step and keep looping. The classifier is a routing workflow: it sends each message to one of four fixed queues. The others run steps that someone wrote in advance, or a job that copies data.

**Quick check:** A bank's loan letter generator always runs the same five steps: read the form, check the credit file, draft the letter, check the tone, send it for approval. What is it?

A. An agent, because a language model writes the letter
B. A workflow, because your code fixes the steps and their order
C. An agent, because it has five steps
D. Neither, because language models are involved

**Answer:** B. The model does some work inside the steps, but your code sets the order. A model inside a step does not make the whole system an agent.

## Can you answer these from memory?

**Flash cards**

- **Workflow in one line?** Fixed steps in code. A model can fill a step, but your code picks the next one.
- **Agent in one line?** A model that picks its own steps and tools in a loop until the task is done.
- **Who picks the next step in a workflow?** Your code, following a path written in advance.
- **What does an agent loop repeat?** The model picks a tool, your code runs it, the result goes back, until no tool is needed.
- **What should you try first?** The simplest option: one model call, then a workflow, then an agent.
- **Main cost of an agent?** Higher cost, and mistakes that can compound across steps.

## Likely follow-up questions

- Q157 What is an AI agent? https://designervenkat.online/interview/ai/what-is-an-ai-agent
- Q159 Name the five common workflow patterns. https://designervenkat.online/interview/ai/name-the-five-common-workflow-patterns
- Q160 What is the agent loop? https://designervenkat.online/interview/ai/what-is-the-agent-loop
- Q161 What is ReAct for agents? https://designervenkat.online/interview/ai/what-is-react-for-agents
- Q162 How do agents plan? https://designervenkat.online/interview/ai/how-do-agents-plan

## Learn it in depth

- [AI Agents](https://designervenkat.online/learn/ai-engineering/ai-agents)
- [Where agents pay off](https://designervenkat.online/learn/ai-engineering/agents-usecases)
