Topic 3 of 4 · 5 min read
Cost, latency and risk of autonomy
Goal: Estimate the token and latency cost of a workflow versus an agent for the same task and state which risks the agent adds.
Every step an agent chooses for itself adds tokens, seconds and a chance of error, so autonomy must buy something that a fixed path cannot. Estimate the cost before you build, not after the first bill.
Check yourself · 1 of 3
Why does the cost of an agent loop grow faster than its number of turns?
Why loops cost more
In a loop, each turn sends the whole conversation so far: the goal, the tool list, and every earlier result. Turn 10 re-reads what turns 1 to 9 produced. So cost grows faster than the number of turns. Anthropic reported in its multi-agent research system write-up that agents used about four times the tokens of a chat interaction, and multi-agent systems about fifteen times. Treat those as one team's measurement, not a law, and measure your own task.
A back-of-envelope estimate
Take a task done two ways. Assume a prompt of 2,000 tokens and an answer of 500 tokens.
| Workflow | Agent | |
|---|---|---|
| Model calls | 3 (fixed) | 8 to 15 (varies) |
| Input tokens | about 6,000 | 20,000 to 60,000, since context repeats |
| Wall-clock | about 6 seconds | 30 to 90 seconds |
| Variance between runs | small | large |
The workflow's cost is a number you can quote. The agent's is a range, and its worst case is whatever your limits allow. Replace these figures with your own: count calls and tokens from a few real runs.
Latency
Calls in a loop run one after another, because the next call needs the last result. Ten turns at 4 seconds each is 40 seconds before any tool time. A person waiting in a chat window feels that; a nightly job does not care.
Risks an agent adds
- Compounding errors. If each step is right 95 percent of the time, ten steps in a row are right about 60 percent of the time (0.95 to the power of 10). A workflow with three checked steps has fewer chances to drift.
- Side effects. A loop with write access can send, delete or pay. A wrong guess is no longer just a wrong answer.
- Harder debugging. The same input can take a different path on the next run. You need logs of every turn.
- Prompt injection. A web page or file the agent reads can contain instructions. More freedom means more exposure.
Before and after
Weak plan: "Let the agent figure out the refund process." No limits, write access to the payment tool, no estimate.
Better plan: a workflow classifies the request, code checks the order and amount, and a person approves refunds above a set limit. If an agent is used for the messy cases, it gets read-only tools, 8 turns at most and a spend cap per ticket.
What goes wrong
- Budgeting from one good run instead of the worst case.
- Ignoring latency for user-facing features.
- Giving write tools to a loop that only needs to read.
Examples
Estimating a triage task
A workflow classifies, looks up the customer and drafts a reply: 3 calls, roughly 6,000 input tokens, about 6 seconds. An agent doing the same work averages 9 turns in a test of ten tickets, with input growing each turn to a total near 35,000 tokens and 50 seconds. At 1,000 tickets a day the agent is nearly six times the input volume, and the slowest tickets took 4 times the median. The numbers, not the architecture's appeal, decide whether this is acceptable.
Capping the damage
A deploy-helper agent may read logs and propose a rollback command but cannot run it. It has a limit of 10 turns and a token budget. The proposal appears as a diff-like plan that an engineer approves. If the agent loops or guesses wrong, the cost is a rejected proposal, not an outage.
Key points
- Each turn re-sends the growing conversation, so loop cost grows faster than the number of turns.
- A workflow's cost is a known number; an agent's cost is a range whose upper end is set by your limits.
- Calls in a loop run one after another, so latency adds up turn by turn.
- Errors compound: ten steps at 95 percent each succeed together about 60 percent of the time.
- Autonomy adds side-effect and prompt-injection risk, so cap turns and spend and prefer read-only tools.
Common mistakes
- Estimating agent cost from one successful run instead of the spread across many runs.
- Forgetting that context is re-sent on every turn, so late turns cost the most.
- Multiplying step accuracy by nothing: assuming ten steps are as reliable as one.
- Granting write or delete tools to an agent whose task only needs reading.
Check yourself · 2 of 3
An agent step is right 90 percent of the time. About how often are five such steps in a row all right?
Check yourself · 3 of 3
A user-facing chat feature must answer in under 5 seconds. Which design problem does an 8-turn agent loop create?
Practice items, not counted towards your mastery.
Start here
- Building effective agents (Anthropic) (opens in a new tab)ArticleFree
Defines workflows versus agents and says to find the simplest solution first; the source of this skill's framing.
- A practical guide to building agents (OpenAI) (opens in a new tab)DocsFree
A second vendor's view on when a use case justifies an agent and how to design the loop.
- Workflows and agents (LangGraph docs) (opens in a new tab)DocsFree
Code-level side-by-side of fixed workflows and agent loops, with runnable examples.
More for this topic
- How we built our multi-agent research system (Anthropic) (opens in a new tab)ArticleFree
Gives the measured 4x and 15x token multipliers used in this lesson.