insideout Get Pro
Compare

Compare

Agents vs workflows

If you can write the steps down first, put them in code.

The short answer

In a workflow your code fixes the path, and the model does the work inside each step. In an agent the model chooses each next step in a loop, so the path and its length change with the input. Use a workflow whenever you could write the steps down before seeing the input, and an agent only when the next step really depends on what the last one turned up.

Agent

Use it when

  • The path can't be planned ahead.
  • The next step depends on what the last one found, and the number of steps varies.
  • Errors and test results come back as feedback the model can act on.
What it costs
More model calls per task, and a different number each run. Every turn resends the whole history. Add step limits, traces, permissions and a check before accepting done.
Watch out
Slips multiply. For a 30-step run to finish clean 90% of the time, each step must be right about 99.65% of the time, unless the agent can see its slips and fix them.

Workflow

Use it when

  • The same steps happen every time.
  • You need predictable cost and delay on every request.
  • Someone needs to read and approve the route.
What it costs
A fixed number of model calls per request, so cost and delay are easy to predict. Chains, routers and parallel calls are plain code, with no framework needed.
Watch out
It handles only the paths you wrote. Send inputs that don't fit to a person, or to a small agent with tight limits.

At a glance

QuestionAgentWorkflow
Who picks the next stepThe model, inside a loopYour code
Model calls per requestVaries with the inputFixed
Cost and delayHard to predictPredictable
TestingCheck the final state over repeated runsTest each step, like any other code
AuditingRead the trace of each runRead the route in the code
Good forDebugging, research and other open-ended jobsExtraction, routing, form filling and review loops

How to choose

  1. Start with one well-prompted call, with a schema for the output, and measure it.
  2. If one call isn't enough, split the job into fixed steps: a chain, a router, parallel calls, or a writer and a checker.
  3. Ask whether you could write the steps down before seeing the input; if you could, keep it a workflow.
  4. Reach for an agent only when the path is open, and give it a step limit, scoped tools, approval for anything it can't undo, and a trace of every step.
  5. Score the agent on the real outcome across repeated runs, and compare its cost per task with the workflow's.

When you need both

The two mix well. A workflow step can be a small agent with a tight limit ("look into this booking problem, at most 8 tool calls"), and an agent's tool can be a fixed workflow ("run the refund checklist"). A common shape sends routine cases down a workflow and only the odd ones to an agent.

Learn it properly

Questions

What is the difference between an AI agent and a workflow?

Who decides the route. A workflow strings model calls and tools together along a path your code lays down. An agent gets a set of tools and chooses each next step in a loop until it's done. The models and tools can be exactly the same.

Are agents more reliable than workflows?

Usually less, on tasks a workflow can do. Every extra step is another chance to slip, and slips nobody notices multiply over a long run. Agents earn their place where a script can't work at all, such as reproducing a bug from a two-line description.

Do I need a framework to build a workflow?

No. A chain is a few function calls in a row, routing is an if on a label, and parallel calls are an ordinary async gather. Write it in plain code first, so you can see every prompt that goes out.

When should I use several agents?

Rarely at first, since one agent with good tools handles most tasks. Splitting helps when parts can run side by side, such as separate research jobs that each read a lot, and it costs several times the tokens.