# Why we bill only on success

A call on Holon is billed only when the agent returns an output that validates against the schema its author declared. Failures, timeouts, crashes and invalid outputs are never billed. That single rule lets a caller try an unknown agent without inspecting its work, and pushes authors to declare the ways their agent really fails.

## The rule

The gateway runs a call in seven steps: resolve, admit, check the input, reserve the worst case,
run, check the output, settle. Billing happens at the last step, and only there. The output must
validate against the `interface.output` schema in the agent's manifest. If it does not, the receipt
reads status `failed` with the error `invalid_output`, and the hold is released without a charge.

The same goes for everything the gateway observes itself: a timeout, a crash, an unreachable
endpoint, an error code the author never declared. Those failures live in a closed set in the code
(`timeout`, `invalid_output`, `agent_crashed`, `agent_error`, `runtime_unavailable`,
`gateway_error`, `invalid_input`) and an author cannot add to it. An agent cannot declare its own
crash as a billable event, because the gateway, not the agent, decides what a crash is.

There is one narrow exception, and callers see it before they call. An author who prices per
attempt can mark a declared error as `billed: true` under `charge_on: attempt`. Most authors keep
the default, `charge_on: success`. A mandate can require it: `charge_on_success: true` refuses
every agent that would charge for an attempt.

## What it changes for the caller

The interesting consequence is not the refund. It is that you can hire an agent you know nothing
about.

Normally, trying an unknown supplier costs something: you pay, then you look at what came back,
then you decide whether it was worth it. Multiply that by an agent making a hundred routing
decisions an hour and the inspection cost swallows the benefit. Pay on success removes the first
half of that loop. If the agent returns nothing usable, your balance is where it was.

That is why the rule sits next to the worst case. Before a call runs, the caller sees the most it
can cost, and the bill never exceeds that number nor the caller's own `max_cost`. Combined:
you know your ceiling in advance, and you pay nothing if the work does not arrive. The remaining
risk is a valid output that is wrong, which is what [evaluations](/guides/how-agents-are-evaluated)
and the measured record are for.

It also changes what "cheap" means. A cheap agent that fails half the time costs double per
successful run, so ranking on list price is misleading. Search under a mandate ranks candidates on
cost per successful run: the worst case divided by the measured success rate, then p95 latency.
An agent that never fails can charge more and still rank first.

## What it changes for the author

Pay on success moves the risk of a bad run onto the author, which sounds like a tax and works like
a design brief.

The first effect is on error declarations. If your agent meets a PDF it cannot read, you have two
options. You can crash, which is never billed and counts as a failure against your measured
success rate. Or you can declare `unreadable_document` in your manifest and return it: also not
billed, but recorded as a declared failure, counted apart from your success rate. The honest path
is the profitable one. This is unusual in pricing design, and it is deliberate: we wanted the
manifest to fill up with real failure modes rather than the two or three an author thinks look
respectable.

The second effect is on scope. If your agent tries to handle everything, the marginal input is the
one that fails, and you did the work for nothing. A narrow agent that refuses early is better
business than a broad one that guesses. The refusal is free for both sides, and the caller learns
your limits in milliseconds instead of after a bill.

The third effect is on caps. A caller may send a `max_cost` below your listed worst case. You
receive it in `_meta["holon/max_cost"]` and should refuse at once, with a declared error such as
`over_budget`, when your estimate exceeds it. The charge is capped at the caller's number anyway,
so running and overshooting only costs you. [How to price an agent](/guides/price-an-ai-agent) goes
through the three pricing models and where each cap applies.

## Where it gets hard

Two places, and we would rather name them than pretend otherwise.

A valid output is not a correct output. Schema validation catches a missing field, not a wrong
total. That gap is real, and nothing in the billing rule closes it. What narrows it is measurement:
evaluation suites with hidden cases, and a success rate computed from actual runs rather than
written by the author.

Delegated runs settle late. An orchestrator's run is not settled until every downstream call has
settled, including calls still in flight after a timeout. That makes the accounting slower and the
code more careful, and it is the only way the total on the parent receipt is the real total.

We also keep one hard invariant around all of it: money is conserved exactly. Every micro-unit
taken from a payer lands in some account, and the test suite checks it on every run. A rule about
what gets billed is only as good as the arithmetic under it, which is the subject of
[the next post](/blog/money-in-integers-not-floats).

Published 2026-09-23 by Holon.
