Lesson 1.2
Workflows vs Agents: Choosing the Right Level of Autonomy
A decision framework for choosing between code-orchestrated workflows and model-directed agents, with the production consequences of each choice.
Anthropic's own guidance draws a sharp line: a workflow is a system where code decides the sequence of LLM calls and tool invocations, while an agent is a system where the model decides its own next step based on tool results, inside a loop that runs until a stopping condition. The professional exam tests whether you can pick the right point on this spectrum for a given scenario and explain the operational consequences.
The autonomy ladder
| Rung | Who controls flow | Typical use | Failure profile |
|---|---|---|---|
| Single call | Nobody; one request | Classification, extraction, summarisation | Wrong answer, easy to detect and retry |
| Prompt chain | Code, fixed sequence | Draft then review then format | A bad early step propagates; add gates between steps |
| Router | Code, after a classification call | Triage to specialised prompts or models | Misroute; mitigated by confidence thresholds and fallbacks |
| Parallel fan-out | Code, concurrent calls then aggregation | Section-wise analysis, voting, multi-perspective review | Cost multiplies; aggregation logic becomes the quality bottleneck |
| Orchestrator-workers | Model plans, code dispatches | Research, multi-file code changes | Over-decomposition, duplicated work, context loss between workers |
| Evaluator-optimiser | Model generates, model critiques, loop | Writing that must meet explicit criteria | Infinite polishing; needs iteration caps |
| Autonomous agent | Model, until done | Open-ended tasks with verifiable outcomes | Runaway cost, tool misuse, unpredictable latency |
The rungs are not better or worse; they trade predictability for flexibility. Workflows are testable with ordinary unit tests and have bounded cost. Agents handle tasks you could not have scripted, at the price of variance.
Decision criteria
Ask these questions in order. Each "yes" pushes you up the ladder; each "no" tells you to stop.
- Can you enumerate the steps in advance? If yes, a workflow will be cheaper, faster and easier to evaluate. Agents earn their keep only when the path depends on what is discovered along the way.
- Is there a verifiable success signal the model can observe? Tests passing, a schema validating, a document matching a rubric. Agents without feedback signals drift; agents with them converge.
- Is the cost of an erroneous action recoverable? Reading is cheap to get wrong; writing, sending and paying are not. Irreversible actions call for a workflow with an explicit human gate, or an agent whose write tools require approval.
- Does the task value justify variance? A ten-minute agent run that saves a day of analyst time is a bargain; the same run to classify a support ticket is waste.
- Can the organisation operate it? Agents need observability, budget limits and incident playbooks. If the team cannot run them, do not ship them.
Production consequences
Cost. A workflow's cost is roughly the sum of its calls; you can quote it. An agent's cost is a distribution. Use task budgets (where supported), max_tokens, iteration caps and per-session spend limits to bound the tail.
Latency. Workflows can be parallelised by code. Agents are inherently sequential across turns, though a single turn may issue parallel tool calls. For interactive products, this usually means workflows in the request path and agents in the background with progress streaming.
Testing. Workflows are tested step by step with fixed inputs. Agents must be tested on trajectories: did it call the right tools, in a sensible order, and stop at the right time? See the evaluation domain for grader design.
Governance. Every tool an agent can call is a capability you have delegated. Scope tools narrowly, make destructive ones ask for confirmation, and log every call with its inputs.
Hybrid designs are the norm
Mature systems rarely sit on one rung. The common production shape is a workflow skeleton with agentic islands:
[intake] -> classify (single call)
-> route
-> simple case: extraction with structured outputs (workflow)
-> complex case: research agent with read-only tools (agent)
-> human approval
-> write actions executed by code (workflow)
The agent is placed where discovery is required and fenced by deterministic steps on both sides. That gives you the flexibility where you need it and predictability everywhere else.
Signals that you chose wrong
- An "agent" whose prompt enumerates the exact ten steps to follow. That is a workflow wearing a costume; convert it and gain testability.
- A workflow with ever-growing branches to handle edge cases. The path depends on content; consider an agent for that segment.
- Agents retried in a loop until the output validates. Use structured outputs or a strict tool schema instead.
- Human approval bolted on after an irreversible action has already happened. Move the gate before the action.
Exam focus
- Workflow equals code-controlled sequence; agent equals model-controlled loop. Expect scenario questions that hinge on this definition.
- Default to the simplest rung that meets requirements; escalate only when the path cannot be scripted and a feedback signal exists.
- Know the named patterns: prompt chaining, routing, parallelisation, orchestrator-workers, evaluator-optimiser.
- Irreversible actions (send, pay, delete) should sit behind deterministic gates or approval-requiring tools, not inside an unbounded loop.
- Hybrid architectures, with agentic islands inside a workflow skeleton, are the expected production answer for complex cases.
- Agents change the cost and latency profile from a sum to a distribution; bound the tail with budgets and iteration caps.
Check yourself
5 questions
1.A shared-services centre processes 50,000 supplier invoices per day. Every invoice follows the same path: extract fields, validate against the purchase order, apply tax rules, post to the ERP. Posting errors are expensive to reverse and external auditors require a traceable, repeatable processing path. A vendor proposes a fully autonomous agent that decides its own steps and tools per invoice. What should the architect recommend?
2.A software company wants Claude to take a design document and produce a pull request implementing it across a large, unfamiliar codebase. The exact files to change cannot be known up front, the repository has a comprehensive test suite, and every PR will be reviewed by a human before merge. Which pattern is MOST appropriate?
3.A logistics firm wants an agent that autonomously re-routes shipments when disruptions occur. The task is genuinely complex and hard to script, and the value of faster re-routing is high. However, a wrong re-route cannot be reversed once the carrier accepts it, and there is currently no automated way to verify a proposed route before it is committed. Applying the standard criteria for building an agent, what should the architect recommend?
4.A telecom support team built a single agent whose system prompt covers six very different request types (billing disputes, SIM swaps, roaming activation, outage reports, cancellations and upgrades), each with its own procedure and tools. Quality is inconsistent: the agent sometimes follows the billing procedure for roaming requests, and the prompt has grown to 9,000 tokens of conflicting instructions. What is the MOST likely improvement?
5.A marketing team wants product descriptions generated in a strict brand voice. Their reviewers can articulate the voice as a rubric but first-draft outputs usually need two or three rounds of revision. Which orchestration pattern BEST fits this need while keeping the workflow bounded?
