Agent Cost Engineering

Subagent Fleets: Price the Run Before It Starts

Claude Haiku 5.5 arrived on 7 October at a tenth of the old Haiku price, with every rate five times higher once a prompt passes 100,000 tokens. The worker in the example below gets there in six turns. Bound its context, budget the run, and report the bill per completed task.

Cloud X Ops TeamDevOps & AI Integration
October 10, 2026
15 min read

Ten cents per million input tokens and fifty cents per million output: Anthropic's price for Claude Haiku 5.5, published on 7 October, for any prompt up to 100,000 tokens. Past that line every rate is five times higher, $0.50 in, $2.50 out, $0.05 for a cache read. Give eight Haiku 5.5 workers a 160,000-token filing each, which they read through a tool in 20,000-token sections with the conversation cached between turns, and each crosses the line on its sixth turn. Priced from that list, one worker costs about 9.8 cents, 86% of it on the four turns past 100,000. The Opus 5.5 orchestrator, reading 40,000 tokens and writing 6,000, costs 28 cents. The eight workers cost 79 cents.

The model went into GitHub Copilot and Claude Code 2.1.293 the same day. OpenAI had priced the yes-or-no step a day earlier: the Decisions API, in public beta from 6 October, charges $0.10 per million input tokens on gpt-6-luna and nothing for output. An orchestration design now has a price column with steps in it.

The chart price ends at 100,000 tokens

Anthropic's pricing page spells out the step. A prompt's length counts every input token, cache reads and writes included, and each request is priced on its own. An agent loop resends its whole conversation every turn, which is how the worker above comes to pay the high rate on four of its nine.

Prompts up to 100,000 tokens made up around 90% of requests to the previous Haiku, Anthropic says. And Haiku 5.5 counts the same text as approximately 30% more tokens than Haiku 4.5, which turns last month's 80,000-token prompt into about 104,000. The token counting endpoint is free and counts under the model you name; recount before you route.

OpenAI's cheap tier steps elsewhere. gpt-6-luna costs the same $0.10 in, $0.01 cached and $0.50 out, and its long-context prices start above 272,000 input tokens, at double for input and one and a half times for output. Priced on the same assumptions, the uncompacted worker costs about 2.7 cents on Luna. Under 100,000 tokens the list prices match, apart from Haiku's 25% premium on cache writes; the step is what differs.

  • Set the ceiling below the cliff. Compact before the next tool result can carry a prompt over 100,000 tokens: the cliff, minus the largest result you allow, minus headroom. At 75,000 tokens the worker above compacts twice and finishes for 3.3 cents, a third of the price.
  • Keep the prefix static. System prompt, then tools, then the conversation, byte for byte, and each turn reads what the last one wrote. GitHub's account of porting the Copilot runtime to Rust, dated 16 September, reports a 96.22% cache hit rate and 5,116 compactions from a loop shaped to keep that prefix.

A cache hit does not keep you under the line

Cache reads and writes count toward the prompt length, and a request over 100,000 tokens pays the higher prices even when part of its prompt is a hit. Caching lowers the bill on either side of the line; only a shorter prompt moves you across it.

One tier per step, proved by the eval gate

The routing table belongs to the workflow, one row per step, and a row names a tier rather than a vendor. Planning and final verification stay on a frontier tier, because a wrong turn there is paid for by every worker downstream. Bounded extraction, classification and browsing go to a Haiku-class tier, from either vendor.

Which model counts as the frontier tier moves; as of 10 October it is Fable, with Opus one row down. Cockroach Labs described on 9 October a five-month agent pipeline that has consumed just over $135,000 in Claude tokens, around $84 for the average GitHub issue by its own count. The same pipeline merged 1,238 pull requests. It now plans on Fable, the plan picks the implementing model, and it escalates back to Fable where a Sonnet or Opus implementer struggles. Block, in an Anthropic case study of 8 October, has Fable design and then direct “up to dozens of smaller, more cost-effective models like Opus or Sonnet”. Both put the expensive model in charge of the cheap ones.

A demotion is proved before it ships. LangChain's harness router experiment of 1 October put a decision model in middleware to pick a tier per thread. The median routed thread cost $0.94 against $2.61 on control, 64% less, while 29.2% of routed threads ended in a merged PR against 27.3% (p = 0.49): quality, in LangChain's reading, did not measurably change. That is the bar for a cheaper row; the eval gate article shows how to hold it.

Budgets belong inside the run, where the money leaves

Simon Willison argued on 3 October that hard budget caps need to be the default. Anthropic's Managed Agents sessions have had one at run level since August: the platform checks the cap before each model request, and a session that reaches it pauses with a budget_reached stop reason, history and sandbox kept. Anthropic's automations guide says to start the cap at three to five times the cost of a normal run and tighten it from real numbers.

The shape to copy is the pause. A budget that kills the process throws away work it has paid for; one that stops before the next call and writes a checkpoint keeps it, and the durable runtime article covers the checkpoint itself. Three budgets, enforced where the spend happens:

  • Per run, in tokens and seconds. Count the prompt before each call, price it at the tier the count implies, and stop if the estimate would cross the cap. The orchestrator resumes the checkpoint with a higher cap or a smaller task.
  • Per tenant, per day, at the gateway. Every call passes one place, which keeps a daily ledger per tenant and returns a budget error in place of a model response when the ledger is full.
  • Per tool, per run. An allowlisted tool has no call budget unless you give it one. Cap calls per tool, fingerprint each call by name and arguments, and open a breaker when the same fingerprint comes back three times.

Budgets need tests of their own. Docker Agent's 1.150.0 release on 9 October fixes manifest-level budgets that were not enforced on native runtimes created through its API server. A limit without a test is a limit one code path forgets, and the problem predates agents. A $10,811.41 Cloudflare bill written up on Serverless Horrors on 8 October came from one Durable Object alarm that kept rescheduling itself forever. The developer blames vibe coding for the bug, and the only thing running up the bill was that loop. “Cloudflare has no hard spending limit, so the loop ran until the invoice came.”

Here is the gate for one worker, built on the Anthropic Python SDK. run is the harness object holding the spend, the tokens added since the last call, and the compaction and checkpoint routines; compact returns the summarised conversation and resets that token count to the size of the summary.

worker.py
# worker.py: price each call first
import anthropic
client = anthropic.Anthropic()
MODEL = "claude-haiku-5-5"
CLIFF = 100_000   # 5x past here
CEILING = 75_000  # compact here
BUDGET = 0.05     # USD, whole run
# per token: cache read, write, out
LOW = (.01e-6, .125e-6, .5e-6)
HIGH = (.05e-6, .625e-6, 2.5e-6)
class BudgetStop(Exception): pass
def price(n, new, out):
    hi = n > CLIFF
    r, w, o = HIGH if hi else LOW
    return (n-new)*r + new*w + out*o

def call(run, system, msgs, tools,
         out=500, compacted=False):
    n = client.messages.count_tokens(
        model=MODEL, system=system,
        messages=msgs, tools=tools
    ).input_tokens
    # COMPACT below the cliff
    if n > CEILING and not compacted:
        msgs = run.compact(msgs)
        return call(run, system,
                    msgs, tools, out,
                    True)
    est = run.spent + price(
        n, run.new, out)
    if n > CEILING or est > BUDGET:
        # STOP with a checkpoint
        cp = run.checkpoint(msgs)
        raise BudgetStop(cp)
    cc = {"type": "ephemeral"}
    r = client.messages.create(
        model=MODEL, max_tokens=2048,
        system=system, messages=msgs,
        tools=tools,
        cache_control=cc)
    u = r.usage  # RECONCILE vs bill
    w = u.cache_creation_input_tokens
    c = u.cache_read_input_tokens
    new = u.input_tokens + (w or 0)
    n = (c or 0) + new
    run.spent += price(
        n, new, u.output_tokens)
    return r

count_tokens settles the tier before any money moves. The stop raises before the call, messages and spend in hand, and the orchestrator gets a checkpoint rather than a stack trace; a worker still over the ceiling after one compaction stops the same way. The count is an estimate; the ledger is corrected afterwards from the usage block on the response, with uncached input priced at the write rate, a small overestimate on the safe side. Haiku 5.5 thinks by default and bills the thinking as output: leave headroom in out.

Watch a worker cross the cliff

Press Run worker below. One Haiku 5.5 worker reads a 160,000-token filing in eight 20,000-token sections, then writes its table. The sums assume an 8,000-token system prompt and tool set, 500 output tokens a reading turn and 2,000 for the table, 5-minute cache writes, and a 4,000-token summary each time it compacts. Set the ceiling and the budget before you press. With neither, the prompt crosses 100,000 tokens on turn six and every rate steps up five times. With the budget alone, the run stops before the call that would pass $0.05 and shows the checkpoint it saved. With the ceiling, it compacts twice and finishes for 3.3 cents.

Haiku 5.5 worker · worker.py
context0 tokens
tier$0.10 in · $0.50 out · $0.01 cache read
spend$0.0000
per completed taskawaiting run

One worker, nine turns: 9.8 cents with four turns past the cliff, 3.3 cents under a 75,000-token ceiling, and a $0.05 budget that pauses before turn seven.

A swarm buys time and pays for it in tokens

Toby Ord's swarm scaling analysis, in Import AI 475 on 5 October, found that a 4-agent swarm needed about twice the total tokens for the same result as one agent. Each agent used half as many, which in theory finishes the job in half the time. Ten times the agents bought only what three to five times the tokens would have bought a single agent, and the shortfall grows with the swarm. Vals AI's case study of 9 October found agent teams cost 1.8 to 5.1 times as much as a single agent, with only one of the four team configurations improving significantly. Fan out when the deadline is the constraint, and budget every worker, since one worker in a loop can spend the whole fleet's budget.

Report cost per completed task

Cost per call is a vanity metric for agents; a cheaper call that needs a retry is not cheaper. The unit is the completed task, and in production it comes out of spans.

  • Tokens and cost on every span. Mastra's core 1.75.0 queries spans with filters and model cost, “every failed tool_call in the last hour”, and aggregates token and cost measures for top-spender queries. Record model, tier, tokens by kind, dollars, run and tenant.
  • Per-run cost in the eval. CrewAI 1.15.27 tracks per-run cost and time in crewai eval --models. Run the eval at the tier you ship and the cost column becomes the budget's test.
  • A token budget check in CI. Replay a workflow's golden runs on every prompt or tool change and fail the build when the median run's tokens regress. Cockroach found 23% of the words in its agent instruction files removable without changing a single gate.
A token has a list price. A run has a bill.

Takeaways

  • Haiku 5.5 and gpt-6-luna list the same $0.10 and $0.50 per million under 100,000 tokens; past it Haiku's prices quintuple on the whole request, while Luna's step comes above 272,000 input tokens, where input doubles and output rises by half.
  • Recount prompts against the model you will call: Haiku 5.5 counts the same text as roughly 30% more tokens than Haiku 4.5.
  • The example worker costs 9.8 cents at 172,000 tokens of context and 3.3 cents under a 75,000-token ceiling, and a per-run budget checked before each call stops it as a checkpoint.
  • A step moves down a tier only when the eval gate shows the completion rate held, which is how LangChain cut median thread cost 64% with no measurable change in merged-PR rate.
  • Fan out for the deadline rather than for quality, and put tokens, cache reads and dollars on every span so the report reads cost per completed task.

Do you know what one completed task costs?

We put a routing table, in-run budgets and an identical-retry breaker in front of your agent fleet, and report cost per completed task from the first week.

Budget the fleet
budgets.sh
SECURE
cloudxops@agents:~$ ./price-run.sh ./workflow
# Pricing the run before its first call...
[OK] routing table loaded, one tier per step
[INFO] ceiling 75K tokens · budget $0.05 a run
[READY] identical-retry breaker in place
$ ▋
Run budget