Skip to main content
A per-transaction cap stops one big mistake. It does nothing about the same reasonable-looking $340 charge happening nineteen times, which is the failure agents actually have. A budget is the control that answers that one, and it is the first thing to reach for on any run.

Before you start

The amounts here assume the agent’s starter policy is disabled, as the quickstart does in step 2. Leave it on and it holds anything over $100 for a person before your own rules get a say.

1. Open one for the run

An agent opens its own budget with its own key. Open it where the run starts, not where the process starts:
201 Created
How large a budget an agent may open is capped by the agent’s max_budget_cents, which is set from the console and cannot be raised with an agent key. Ask for more and the call is refused before anything exists:
422 Unprocessable Entity

2. Spend against it

Every authorization names the budget, and an allowed one reserves from it immediately:
201 Created
The reservation is held until you report what happened. complete keeps it, fail gives it back:
200 OK
Nothing sweeps a reservation that was never reported. An agent that dies between the 201 and the complete leaves its budget held for good, so open a budget per run and let it end with the run rather than reusing one across runs.

3. Watch the loop hit the wall

A budget refuses on the total, not on the individual amount, and it refuses before any rule you wrote gets a say. The nineteenth reasonable charge is the one that stops:
403 Forbidden
session_budget is one of three intrinsic rules that run ahead of every policy and cannot be switched off. Give headroom to your agent: one that knows it has $20 left picks a cheaper option, and one that only knows it was refused retries into the same wall. Subscribe to budget.low to hear about it early. It fires when a budget drops to 10% or less of its size, after an executed payment.

4. Split it between sub-agents

A budget can open a child budget, and the child reserves its whole size from the parent when it opens. Children therefore cannot sum past what the parent has left:
201 Created
Hand the child id to the sub-agent and it can spend 200oftheparents200 of the parent's 500, whatever it is told to do. A child that asks for more than the parent has left is refused with parent_budget_exhausted, again before anything exists.

What a budget is not

  • It is not a time limit. A budget has no expiry and no close endpoint, so it stops spend by running out, not by ending. Size it for one run.
  • It is not per counterparty or per action type. Narrow those with a policy rule; the budget counts every authorized action the run makes.
  • It is not shared between agents. A budget belongs to the agent that opened it, and a child budget must belong to the same agent as its parent.
  • It is not money. Kordio holds no funds. A budget is authority to spend on your own rails, and spend on actions and payments draws down the same number.

Next steps

Roll a policy out safely

Add rules to the run once the envelope is in place.

Spend tokens

Narrow one payment inside the budget to one vendor, once.

How a decision is reached

Where the budget sits in the evaluation order.

Errors

budget_ceiling, parent_budget_exhausted, and the rest.