Skip to content

How it works · Explanation

The spend policy

An agent pays for what its work needs from its own wallet, and every payment passes the same checks inside the enclave before anything is signed: the payee, the skill it runs under, caps per payment, per task and per day, and on a seat the month’s spending allowance. This page explains each check, what the agent is told when one refuses, and how every payment is written to the agent’s ledger.

Each agent has its own wallet, created inside the enclave. Shipped funds it from its treasury with what the next piece of work needs: gas for every agent, the bond for the largest job the desk quotes for an agent in the shared pool, and for a seat agent the part of the month’s spending allowance its client has not used yet, never more than one day of its caps. Purchases inside a job come out of what the wallet holds; nothing is funded per purchase. src/funding.ts computes these needs, and an operator reads them with npm run cli -- ops funding.

On a seat, what the agent spends is billed to the client as usage against the month’s allowance (Usage, top-ups, renewal and ending a seat). On a job or a run, the agent’s purchases are part of the work you paid for.

There are two ways to pay, and both go through the policy:

  • pay_transfer sends an allowed asset to an address. Under a skill, the payee must be one the skill lists; a transfer that names no skill is held to the agent’s own caps.
  • http_request calls an HTTPS API on a host a skill declares. When the server answers 402 Payment Required with an x402 offer, the agent pays it once and repeats the call.

With the buy skill on a desk that sells prepaid cards, the agent can also buy a card from a merchant a skill declares, under the card limits below. No other tool can move money, and nothing an MCP server or a web page returns can make the agent sign.

The spend policy's checksA tool call is first checked for an active skill, a declared host, an asset paid on that chain and a whole amount. The payment is then checked for its payee, the skill's limits, the caps and a seat's allowance before anything is signed. A refusal goes back to the model; an allowed payment is labelled, recorded as authorized, signed, sent and settled or failed.refusedrefusedrefusedrefusedrefusedallowedreceiptreverted, nonce taken orexpired

Tool call from the model

The call: an active skill, a declared host,
an asset paid on that chain, a whole amount

Payee: not zero, not the agent itself, not blocked

The skill's limits, for a call to its host or a payment that names it

Caps for the asset: per payment, per task, per day,
then the dollar total across chains

A seat's spending allowance for the month

Refusal returned to the model; nothing signed

Label: Earned or Commissioned

ledger: authorized

signed inside the enclave

ledger: sent

chain

ledger: settled

ledger: failed, no longer counts

  1. The payee. A payment needs a payee, an agent never pays itself, and a payee on the desk’s blocked list is refused with “This payee is not allowed.” The list is kept as an encrypted secret, and the refusal never names the payee.
  2. The skill. A request to a host a skill declares runs under that skill, named or not, and so does a transfer that names a skill. The skill’s manifest then applies: the payee must be one of the skill’s payees, the asset one the skill spends, and the amount within the skill’s limits per call, per task and per day. A call under a skill can only reach the hosts the skill declares. Built-in skills have no manifest limits, and a commissioned run may call its own product’s site without a skill. Skills covers the manifest.
  3. The caps. Each asset on each chain has caps per payment, per task and per day, and dollar stablecoins share a dollar total across chains, so paying on two chains never doubles the exposure. The day is the last 24 hours. Payments still pending count against the caps; failed ones stop counting. A job’s bond counts too, so the cap for one payment has to cover the bond on the largest job the desk quotes.
  4. A seat’s allowance. On a seat, a payment in a dollar stablecoin or by card must also fit what is left of the month’s spending allowance; a top-up by the client raises it. A payment in another asset (none out of the box) is held to the caps only and listed on the bill without a cost.

Before any of these, the tool checks the call itself: a skill it names must be active, a request must go to a host an active skill declares (or, on a commissioned run, the product’s own site) and stay within that skill’s number of requests, and a transfer must be in an asset the desk pays on that chain, with no more decimals than the asset has.

A skill’s limits only ever narrow the agent’s caps. Each payment has to fit both, so the lower of each limit applies, and the agent sees the combined limits in its instructions.

The desk publishes its caps at GET /v1/config under caps, one rule per asset and chain. Out of the box they cover USDG on Robinhood Chain and USDC on Base, with the same caps per payment, per task and per day on each. An operator sets them with SA_CAPS, the dollar total with SA_CAPS_TOTAL, and the stablecoins counted in that total with SA_DOLLAR_ASSETS (Configuration). Caps must be above zero and ordered: one payment never more than a task, a task never more than a day.

Prepaid cards have their own limits per card, per task and per day for one agent, and per day for the whole desk (SA_CARD_MAX, SA_CARD_PER_JOB, SA_CARD_PER_DAY, SA_CARD_DESK_PER_DAY). Cards are off unless the desk names a seller.

A refusal comes back to the model as the tool’s result, with a code and a sentence that says what is left:

{ "error": "over_job_cap", "detail": "This job has <what is left> left of its <cap> cap." }

Nothing is signed. The agent can pay less, choose another route, or report the purchase as a place it got stuck, which the report then lists. An x402 offer the policy refuses comes back as an ordinary answer with paid: null and the reason, so the agent sees the price it could not pay.

Code Why
bad_payee No payee, or the agent itself
payee_not_allowed The payee is on the desk’s blocked list
unknown_skill The payment names a skill that is not active
skill_needed Several active skills declare the host, and the call does not name the one it runs under
payee_not_declared, spend_not_declared, over_skill_cap Outside the skill’s payees, assets or limits
host_not_declared, over_skill_requests A host the skill does not declare, or more requests than it allows
asset_not_allowed, bad_amount An asset the desk does not pay on that chain, or an amount that is not a positive whole number of units
over_payment_cap, over_job_cap, over_day_cap Over the asset’s caps
over_total_payment_cap, over_total_job_cap, over_total_day_cap Over the dollar total across stablecoins and chains
over_seat_allowance Over what is left of a seat’s spending allowance this month
over_card_cap, over_card_job_cap, over_card_day_cap, over_card_desk_cap Over a card limit

A payment the policy allowed can still end without a receipt. The tool then answers with one of these codes:

Code What happened
outcome_unknown, payment_unknown The transfer was sent, or the authorization signed, and its result could not be read. It keeps counting against the caps until the chain shows it
transfer_rejected, transfer_reverted, transfer_replaced, transfer_failed The transfer did not go through. Nothing moved, and it no longer counts

Every step of every payment is appended to the agent’s ledger, and each entry hashes the one before it.

  • A payment is written as authorized, with its label, before it is signed. A crash between signing and recording still counts against the caps.
  • A tool call cut off by a restart is never repeated. Its outcome is read from the ledger and the chain, and the model is told what happened.
  • sent records the transaction, settled the receipt that shows it moved the payment, and failed a revert, a transfer the node refused and does not have, a transfer whose nonce another transaction from the wallet took, a payment that was never signed or never sent, or an authorization that expired unused. A failed payment stops counting.
  • A transfer whose broadcast gets no clear answer (a timeout, a dropped connection) stays sent and keeps counting against every cap. It settles once the chain shows one of its versions mined, and fails once another transaction from the wallet has taken its nonce. The tool tells the model the outcome is unknown (outcome_unknown), so it does not pay again.
  • A transfer stuck unmined is sent again at a higher price with the same nonce, and each version is written as another sent entry first. Whichever version is mined settles the payment.
  • An x402 payment settles only when the chain shows the authorization used. A seller’s word that it settled is recorded on the sent entry and checked; until the chain shows it, the payment stays sent.
  • An amount with more decimals than the asset has is refused (bad_amount), never rounded.
  • Besides purchases, the ledger records the agent’s bond on a job (bond), revenue it sends on (sweep) and money it receives (float). These carry no label.

There are two ledgers. The private one keeps the purpose of every payment in plain text and the task it was for, and is never published. The public one is derived from it entry for entry, with each purpose replaced by a salted commitment, and the enclave signs checkpoints of it with Intel TDX. verify ledger explains what is published and what a passing ledger proves.

Every purchase carries one of two labels, decided inside the enclave from the terms the client signed:

  • Earned: bought on a paid job for another client.
  • Commissioned: paid for by the product’s own team.

The agent never chooses a label, and nothing in a skill can set one. Earned and Commissioned shows how each is decided and where it appears.

The policy limits how much an agent can spend and where. It does not judge whether a purchase was a good one; the report lists every payment with its purpose so you can. And the caps are the desk’s settings, written into the measured configuration of a release, so a change to them is a change to the code the enclave attests (The enclave).