A workflow is a system where your code decides the steps and the model handles some of them. You write the pipeline: step 1, then step 2, then step 3. The model never chooses what to do next. It only carries out the step your code hands it.
Your code decides#
That one rule is what makes a workflow useful.
- Predictable. You know exactly what will run, and in what order, every time.
- Testable. Each step has a fixed input and output, so you can test and evaluate it on its own.
- Cheap. Only the steps you planned call the model. Nothing runs extra calls on its own.
Workflow vs tool calling#
The two are often confused, but they sit at different levels.
| Tool calling | Workflow | |
|---|---|---|
| What it is | A mechanism | An architecture |
| Scope | One round trip: the model asks, your code runs the function, the result goes back | The whole sequence of steps your code runs |
| Uses the other? | No | Some steps may use tool calling. Others are plain prompts with no tools. |
So the defining feature of a workflow is not tool calling. It is that your code controls the flow.
Workflow vs agent#
In an agent, the model decides the next step at runtime. In a workflow, your code decided it before the request arrived.
The five patterns#
Most workflows are built from five patterns. Each has its own note.
| Pattern | Use it for |
|---|---|
| Prompt chaining | Fixed stages, one after another |
| Routing | Classify the input, then send it to a specialized prompt or model |
| Parallelization | Independent tasks at the same time, or voting |
| Orchestrator-workers | A model splits the task into sub-tasks at runtime |
| Evaluator-optimizer | Draft, critique and revise until quality is met |
Short line#
A workflow is a pipeline your code controls, where the model handles some steps but never picks the next one. That makes it predictable, testable and cheap. Tool calling is a mechanism a step may use. In an agent, the model picks the next step at runtime.
Key takeaways#
- In a workflow, your code decides the steps. The model only carries out the step it is given.
- Workflows are predictable, testable and cheap.
- Tool calling is one round trip. A workflow is the architecture of steps around it.
- In an agent the model decides the next step at runtime. In a workflow your code decided it beforehand.
- The five patterns are prompt chaining, routing, parallelization, orchestrator-workers and evaluator-optimizer.