Workflows versus agents
Some AI systems follow steps that code has already fixed. Others let a model choose the next step while the system runs. Knowing which one you are building changes how you test, limit and trust it.

Who picks the next step?
This lesson uses three terms. They are defined here and used the same way throughout.
- Workflow: the code decides which steps run and in what order, using rules written in advance. A model may run inside a step.
- Agent loop: the model chooses the next step while the system runs. The system runs that step, the model reads the result, and it chooses again until it stops.
- Combination: fixed steps around one or more agent loops.
In this lesson, a step is one thing the system does, such as looking up an account. A tool is a function the system runs on the model's behalf. “Run a tool” in the diagram means the system runs that function.
Think of a recipe card. It lists the steps in order. A cook who tastes the dish and decides whether to add salt or simmer longer is making choices as they go. The comparison breaks down in one important way: a model's choice can be wrong, so an agent loop needs limits on how many steps it can take.
A workflow: the code sets the order.
Take one support ticket: “I was charged twice on my latest invoice.” A workflow handles it with three fixed steps. Every ticket runs the same steps in the same order.
- Classify the ticket by topic. This one is billing.
- Check its urgency. The system looks for words such as “urgent”, “outage” or “blocked”. This ticket has none, so its urgency is low.
- Route the ticket to the billing team.

The steps can be keyword rules or model calls. What makes this a workflow is that the code decides what runs next.
An agent loop: the model picks each step.
Now a different ticket: “My account is locked and I cannot log in.” In an agent loop, the model chooses the next step. It might choose to look up the account. The system runs that lookup and returns the result. The model reads the result and chooses again.
- The model picks a step, such as looking up the account.
- The system runs the step and returns the result.
- The model reads the result, then either picks another step or stops.

Because the model chooses, two runs on the same ticket can take different paths. A loop with no limit can keep going, so an agent loop needs a maximum number of steps and a way to stop.
A coded branch is still a workflow.
A workflow can branch. In one version of the ticket system, a rule checks the classification confidence after urgency is assessed. If the confidence is below 0.70, or the category is “other”, the ticket goes to an extra review step. Otherwise it goes straight to routing.
The rule is written in code, so the code still picks the path. That keeps this a workflow. In this example, the classifier is a simple keyword scan, which keeps the rule easy to follow. The confidence is a score from 0 to 1 that the classifier reports for its own answer. Here it comes from that simple scan, so treat it as an illustration, not a measured accuracy.
Quick questions:
- Does a branch make a system an agent? No. A branch chosen by a coded rule is still a workflow.
- Does calling a model make a system an agent? No, not by itself. The question is whether the model chooses the next step.
- If the model picks an action, then reads the result and picks again, is that a loop? Yes. That is an agent loop.
Many systems mix the two.
A common design keeps most steps fixed and gives one step to an agent loop. For the locked-account ticket, the system might:
- Intake (fixed): save the ticket and record the customer's plan.
- Investigate (agent loop): the model looks up login records, asks for more detail if needed, and decides when it has enough.
- File ticket (fixed): write the summary and route the ticket.

The fixed steps are easy to test and audit. The open-ended step handles cases that are hard to specify as rules in advance, and it is the hardest part to test. This is one common pattern, not a rule.
Sort five systems.
Try it in this order:
- Read the description and note what the system does first.
- Ask: does the code or the model choose the next step?
- Choose workflow, agent loop or combination. You can change any answer.
These are short, simplified descriptions written for this lesson. They are not descriptions of any real product. Real systems can mix these patterns in ways this lab does not show.
Check your understanding.
Take this with you.
Ask who picks the next step. If the code does, it is a workflow, even with a branch or a model call inside a step. If the model picks the next step and the system loops, it is an agent loop. Many real systems combine fixed steps with one open-ended part, and they keep that part limited.