The choice is not “pipeline or agent.” Reliable AI systems usually combine deterministic production pipelines with a few bounded model-driven decisions. The architectural task is deciding where variability is valuable and where it becomes operational risk.
Anthropic distinguishes workflows, where models and tools follow predefined code paths, from agents, where the model dynamically directs its process and tool use. A production pipeline is broader: it coordinates repeatable work, side effects, retries, data movement and operational guarantees, whether or not a model is involved.
Three Control Styles
Deterministic pipeline
Code defines the steps and transition conditions. Given the same accepted inputs and environment, the control path is intended to be reproducible.
Examples: validate a file, transform records, render approved assets, publish a release or reconcile a transaction.
Coded AI workflow
The path is predefined, but selected steps use a model. Common patterns include prompt chains, routing, parallel evaluation and evaluator–optimizer loops.
Examples: classify a request, extract structured fields, generate three candidates and score them before review.
Dynamic agent
The model decides which action or tool is appropriate based on intermediate observations. The number and sequence of steps may not be known in advance.
Examples: investigate an unfamiliar software defect, research an open-ended question or navigate a changing environment.
Comparison
| Dimension | Production pipeline | Coded AI workflow | Dynamic agent |
|---|---|---|---|
| Control path | Predefined | Predefined around model steps | Selected during execution |
| Best for | Stable repeatable process | Known process with fuzzy transformations | Open-ended adaptive tasks |
| Replay | Usually straightforward | Requires model/version capture | Requires checkpoints and observation history |
| Cost predictability | High | Medium to high | Lower |
| Error boundary | Step and exception | Step, output validation and model error | Run, plan, tool and state transition |
| Observability | Step metrics | Step plus model traces | Full decision and tool trajectory |
| Human approval | Fixed gate | Fixed or conditional gate | Dynamic request within policy |
Use a Pipeline When the Rule Is Known
If a condition can be expressed and maintained reliably in code, an agent should not rediscover it on every run. Schema validation, access control, accounting rules, file movement and publishing gates belong in deterministic components.
This is not hostility to AI. It protects the parts of the process where variability adds no value.
Use a Workflow When the Task Is Known but a Step Is Fuzzy
Many production tasks benefit from models without requiring agent autonomy. A content workflow can extract topics, propose headlines, check claims and generate a draft along a predefined route. Each model call remains probabilistic, but the process around it stays inspectable.
Workflows are especially strong when:
- the sequence is stable;
- inputs can be classified into known routes;
- outputs have clear schemas or rubrics;
- latency and cost need bounds; and
- approvals occur at known stages.
Use an Agent When the Next Step Depends on Discovery
An agent is justified when useful actions cannot be enumerated economically before the run. A coding agent may need to inspect different files depending on the fault. A research agent may follow a source trail that only becomes visible after the first query.
Even then, the agent should operate inside a production envelope:
pipeline starts run
→ agent explores within budget and permissions
→ agent returns plan, evidence or artifact
→ deterministic validators check result
→ approval gate accepts or rejects
→ pipeline performs consequential side effect
Retries Reveal the Difference
Pipelines commonly retry failed steps. Repeating a pure transformation is usually safe. Repeating a model call may produce a different result. Repeating an agent step may select a different tool. Repeating a side effect may send, charge or publish twice.
Therefore an agentic pipeline needs several retry policies:
- technical retry for transient infrastructure failure;
- regeneration for an invalid candidate;
- replanning after changed state;
- compensation after partial side effects; and
- escalation when uncertainty exceeds policy.
Do not represent all five as “try again.”
State Is the Integration Boundary
A pipeline step should receive a versioned input and produce an observable result. An agent should read the same explicit state, add observations and propose transitions. It should not keep the only copy of progress inside its chat history.
Checkpointing makes an agent run resumable. Authoritative domain state makes the production process correct. Stateful AI Agents explains why these are separate concerns.
A Practical Decision Test
For each planned step, ask:
- Can the correct transition be expressed reliably in code?
- Does model interpretation materially improve the result?
- Must the model choose the next step, or only complete a known step?
- What is the cost of a wrong or repeated action?
- Can the output be validated before it changes external state?
- What evidence must exist for replay or audit?
If the rule is known and the cost of variation is high, use a pipeline. If the route is known but content is ambiguous, use a workflow. If discovery genuinely determines the route, use a bounded agent.
The strongest production architecture does not maximize autonomy. It places autonomy exactly where it earns its operational cost.
