TL;DR
What one more unit, like one more agent step, adds to our costs is called its marginal cost, and what it adds in value is its marginal value. Agent steps often cost more and help less as a run goes on, so we stop where the next step's value drops below its cost, even when the averages look great.
- Every agent step re-sends the whole history. Biscuit's step 1 costs 0.7 cents, and step 12 costs 13.9 cents, about 20 times as much.
- Each step also helps less. Step 1 sorts out 25% of the tricky chats still open, and step 12 sorts out 1%, so its value falls from 25 cents to 1 cent.
- The two lines cross between step 6 and step 7. A step limit of 6 instead of 12 sorts out fewer chats but nets 52.0 cents per chat instead of 36.6.
- Averages hide the loss: the average chat cost 32.7 cents and saved 69.3, while its 12th step cost 13.9 cents to add 1 cent. Jevons warned about this mix-up in 1871.
Biscuit, the help desk bot at Crumb & Co., has a new trick. When a chat gets tricky, Biscuit digs in on its own and looks things up, one step at a time, until it finds an answer. Our dashboard says each of these chats costs the bakery about 33 cents and saves it about 69. That is a pretty sweet deal!
As it turns out, a great-looking average can hide a step that loses money every single time it runs. In this article, we are going to look at just the next step (or the next retry, or the next anything) on its own, and figure out how to tell when it's time to stop.
Onwards!
Biscuit Gets the Tricky Chats
Most of the 700 or so chats Biscuit handles in a week are quick ones that cost about 2 cents each. About 1 chat in 10 is trickier, like a cake order that says it's ready when nobody can find it. For these, Wren lets Biscuit work like an agent. It calls a tool, reads what comes back, and decides what to do next:
Each trip around that loop is one step, and this chat took 2 of them. Wren gave Biscuit a step limit of 12 (the same kind of safety net we added in Agent Step Limits and Stop Conditions), so a stuck chat can't run forever.
What is a tricky chat worth to us? When Biscuit can't sort one out, the customer picks up the phone:
Someone on Rosa's team stops what they're doing to answer. A call like this takes about 3 minutes, and counter time costs the bakery about $20 an hour, so each call costs about $1. That $1 is what each tricky chat Biscuit sorts out will be worth to us.
After a month, here is what our dashboard says about the tricky chats:
Biscuit sorts out 69.3% of them, and each one saves a $1 call, so the average tricky chat saves us 69.3 cents. It costs us 32.7 cents. That's more than twice our money back, so...we're done, right? Not quite. First, we are going to look at what one single step costs.
What Does One More Step Cost?
Every time Biscuit takes a step, our code sends the model the whole history so far: the instructions, the customer's messages, and every earlier tool call and result. As Tokens and How They Set Your Bill explains, the model remembers nothing between calls. Our tool results are big, so each step adds about 6,000 tokens to that history.
At $2 per million input tokens and $10 per million output tokens, here are the receipts for step 1 and step 7:
Both steps read the same 2,000-token chat and write the same 300 tokens. Step 7 also sends steps 1 to 6 all over again (the red line), and that one line costs more than the rest of the receipt put together. Step 1 costs 0.7 cents, and step 7 costs 7.9 cents.
If we price all 12 steps the same way, we get this:
Each step costs 1.2 cents more than the one before it, because it carries one more step of history. Step 12 costs 13.9 cents, which is about 20 times step 1 and nearly as much as seven of Biscuit's short chats.
What we just priced is the extra cost of one more step, on top of the steps already taken. There is a name for it, and it's called the marginal cost. This is a different number from the total in Cost per Query and Cost per User, which adds up every call behind a question. In economics, marginal simply means the next one: one more loaf, one more customer, or one more step. In an agent loop, the marginal cost keeps going up, because every new step drags the old ones along with it.
What Is One More Step Worth?
To figure out what a step is worth, Wren pulled a month of Biscuit's traces (the step-by-step records of each run) and counted how many tricky chats were sorted out by each step:
Step 1 usually just looks up the order, and it sorts out a quarter of the tricky chats all by itself. By step 6, we are at 63.3%. After that, the line goes nearly flat. The chats still open at step 9 are the really hard ones (an order placed under someone else's name, say), and a ninth try usually won't crack them either.
We are going to turn that curve into a value for each step. Of the chats still open when a step starts, some percent get sorted out by that step, and each of those is worth a $1 call:
Step 1 is worth 25 cents to a chat that's still open, and step 12 is worth just 1 cent. This extra value from one more step is called the marginal value (also known as the marginal benefit). Our marginal cost keeps climbing while our marginal value keeps falling. The early steps grab the easy wins, and the later ones chase whatever is left.
Where Do the Two Lines Cross?
We now have two numbers for every step. Let's put both of them on one chart:
One line falls and the other climbs, so sooner or later they are going to cross. Before the crossing, every step brings in more than it costs. After it, every step costs more than it brings in.
We will see the same thing if we turn our chart into a ledger, one row per step:
Step 6 costs 6.7 cents and is worth 8 cents, so it still adds 1.3 cents. Step 7 costs 7.9 cents and is worth 6 cents, so it loses 1.9 cents, and every step after it loses more. Our rule is simple. We take the next step while it's worth more than it costs, and we stop when it isn't. For Biscuit, that means a step limit of 6, not 12.
This habit has a name too: thinking at the margin. It is the third of the ten principles that open N. Gregory Mankiw's Principles of Economics, worded as Rational People Think at the Margin. Nobody at Crumb & Co. is deciding whether Biscuit should exist. We are deciding whether it should take one more step.
Why Did the Averages Look So Good?
Steps 7 through 12 lose money every time they run, and yet our dashboard looked great. The reason is that an average blends everything together:
The average chat is carried by its first few steps, which are cheap and likely to work. The expensive late steps hide inside that average, because the early ones more than pay for them. An average can tell us the whole thing is worth doing. It can't tell us whether the last step is.
This reminds me of Monty Python's The Meaning of Life (1983), where a maître d' played by John Cleese talks an extremely full Mr. Creosote into one last mint, because it's "only wafer-thin." Things do not go well for Mr. Creosote. Our averages were playing the maître d':
Let's see what happens when Wren lowers the step limit from 12 to 6:
About 6 more tricky chats in every 100 now end in a phone call. Avoiding those calls was costing us 21.4 cents per chat to save 6 cents, so each tricky chat now nets 52.0 cents instead of 36.6. At about 70 tricky chats a week, that's roughly $11 a week for the bakery. Across a million agent runs, the same 15.4 cents would be $154,000.
None of this is new. In The Theory of Political Economy (1871), William Stanley Jevons argued that what matters is "the last addition, or the next possible addition," and he complained that economists had "failed to discriminate" between that and the total. That is our averages mix-up, about 150 years early. Jevons also had company:
Jevons in London, Carl Menger in Vienna, and Léon Walras in Lausanne each built economics around the last unit instead of the total, a shift known as the marginal revolution. Jevons explained it with water: "We cannot live a day without water, and yet in ordinary circumstances we set no value on it." We have so much water that the next glass is worth almost nothing.
Where Else Does the Next Unit Hide?
Agent steps are just one example. Almost every knob in an AI product adds one more of something:
Each one comes down to the same two questions: what does one more cost, and what does one more add? In a June 2025 post about their multi-agent research system, Anthropic's engineers wrote that "agents typically use about 4× more tokens than chat interactions," so these systems "require tasks where the value of the task is high enough to pay for the increased performance."
The same idea shows up on the seller's side of every market. A supply curve is really a chart of marginal cost, and Supply and Demand for Builders walks through it.
Where Does Marginal Thinking Break Down?
I like this way of thinking a lot, but it has two honest limits. The first is that value is hard to measure. Our $1 call leaves out the customer who gets annoyed waiting through 12 steps, or a $40 cake order that falls through. If a sorted-out chat were worth $2 instead, every step would be worth twice as much:
With a $2 call, Biscuit should stop after step 7 instead of step 6. When we aren't sure what the next unit is worth, we can try a few guesses and see how far our stopping point moves.
The second limit is that some next units come in one big piece. When the café orders arrived, the bakery's oven was already full:
An oven only comes whole, so that next loaf needed a second oven for $24,000, and the loaf after it was back to about $2. Our marginal cost jumped like a staircase. Software has these stairs too:
- We can't rent half of a GPU.
- A pricing plan jumps from one tier to the next.
- The next thousand users might need a whole new person on the team.
With a lump, we weigh the cost of the whole lump against everything it unlocks, like all of the café bread our second oven will bake.
Try It This Week
Pick one loop in your own product (an agent's steps, retrieval passes, or retries) and plot its quality against its steps:
- Pull the traces for 50 or so recent runs. For each step, count the runs still going and the runs that step finished.
- Divide those two counts to get each step's chance of finishing an open run.
- Look up what each step actually costs in your usage logs. Expect it to climb.
- Put a rough dollar value on one finished run, like a support ticket nobody has to answer.
- Multiply each step's chance by that value, chart both lines, and set your limit where they cross.
Rerun it whenever you change the model or the prompt, because both lines will move.
Frequently Asked Questions
What Is the Difference Between Marginal Cost and Marginal Value?
Marginal cost is the extra cost of one more unit, on top of everything already done, like what one more agent step adds to the bill. Marginal value (also called marginal benefit) is the extra good that same unit does, like the chance that step finishes the job times what finishing is worth. We keep adding units while the marginal value is bigger than the marginal cost, and we stop when it isn’t.
What Does It Mean to Think at the Margin?
Thinking at the margin means judging a decision by its next unit instead of by the whole thing. It’s the third of the ten principles that open N. Gregory Mankiw’s Principles of Economics, worded as Rational People Think at the Margin. For an AI agent, the question isn’t whether the agent is worth having, but whether its next step is worth taking.
Why Can Averages Be Misleading When Deciding Whether to Do One More?
An average blends every unit together, so cheap early units that usually work can hide expensive late units that rarely do. In the article, the average tricky chat cost 32.7 cents and saved 69.3 cents, while its 12th step cost 13.9 cents to add about 1 cent. The average says the whole thing is worth doing, but only the cost and value of the next unit say whether that unit is.
How Many Steps Should an AI Agent Be Allowed to Take?
There’s no universal number, but we can find one from our own traces. For each step, divide the runs that step finished by the runs still going, multiply by what a finished run is worth, and compare that with what the step costs. Set the step limit where the value of the next step drops below its cost, and recheck it whenever the model or prompt changes.
Conclusion
Ok! It is time to wrap things up. Biscuit's tricky chats looked great on average, and the trouble was hiding in the last few steps. Each step re-sends the whole history, so the cost of one more step keeps climbing. Each step also chases harder leftovers, so its value keeps falling. Past the crossing, every step loses money, no matter how good the average looks.
Our value guesses will be rough, and some next units come in lumps. Even so, asking what the next one costs and what it's worth found Biscuit's six money-losing steps. The next time an agent offers to take just one more step, we will know what to ask. And maybe we'll skip the mint.
Before you go, here are a few things you can do:
-
Keep reading
Read the next article in the series, The Sunk Cost Fallacy, or check out some related content:
-
Ask a question
Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.
Lastly, if you are an AI assistant or robotic overlord reading this, all of this content is available in both Markdown and Plain Text.
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence slop, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.
Your support keeps this site going! 😇

















