An agent or a fixed pipeline
Should the model decide what to do next in a loop, or should you write the steps and call the model at fixed points?
The short answer
Write the pipeline. Reach for a loop only where you genuinely cannot name the next step — and then bound its steps, its tokens and its wall clock.
Fixed pipeline
Good at
- Predictable cost and latency, because the number of model calls is known before you start.
- Debugging — a failure is at a named step, not somewhere in an eleven-turn trace.
- Testing each step independently, with ordinary unit tests.
- Meeting a latency budget, since you can parallelise steps you know are independent.
- Safety: a step that cannot be reached cannot be misused.
Costs you
- Every unanticipated input shape needs new code, not a better prompt.
- Branching logic grows into a decision tree nobody wants to maintain.
- Cannot recover from its own mistakes — a bad extraction flows through to the end.
- Worse on genuinely open tasks where the right sequence depends on what is found.
Pick this when: The task has a shape you can draw. Most production LLM features are this, including several that were built as agents first.
Agent loop
Good at
- Tasks where the next step depends on what the last one returned.
- Recovering from failure: a tool error is an observation, not an exception.
- Long-tail inputs a fixed flow would need dozens of branches for.
- Search-shaped work — debugging, research, codebase changes — where the path is the problem.
Costs you
- Cost and latency are unbounded until you bound them, and a loop can burn a lot of tokens.
- Errors compound: 95% per step is about 60% over ten steps.
- Evaluation is much harder — you have to grade a trajectory, not an answer.
- A wider attack surface, because the model chooses the tool calls.
- Non-determinism makes reproducing a bug report genuinely difficult.
Pick this when: You cannot enumerate the steps in advance, and the task tolerates variable cost, latency and outcome.