
Cap agent spending where the funds live
Spend budgets with period caps
A funded budget account enforces a per-period limit and names who may spend from it.
You fund a budget from your main account, set a period length, a per-period limit, an expiry and a rollover policy, then name up to 16 delegates. The LayerX kernel checks every spend against the remaining period allowance and the funded balance before any transfer settles. A spend over the allowance returns -713 and one over the balance returns -714. Close the budget and the remainder returns to you.
What it does
A budget holds funds in a dedicated budget account with a per-period limit, a period length, an expiry and a rollover policy. The owner funds it from their main account, and either the owner or a named delegate spends from it. Every spend is checked in the LayerX kernel against both the remaining period allowance and the funded balance before any transfer settles. Closing or revoking a budget returns whatever is left to the owner and freezes the limit at what has already been spent.
Key capabilities
- Seven activities: create, fund, amend, add delegate, remove delegate, spend, close.
- Per-period limit with a period length, an expiry and a rollover policy.
- Rollover
NONEdrops unspent allowance;CAPPEDcarries it forward up to a carry cap. - Up to 16 named delegates per budget; only the owner or a named delegate may spend.
- Amend changes the limit, carry cap, expiry and rollover policy without moving funds.
- Close or revoke drains the remaining balance back to the funding account.
Who it's for
Developers and operators who give an agent a funded allowance rather than open access to a wallet.
Why it matters
The cap travels with the funds instead of living in the calling application, so an agent cannot spend past its period allowance even if its own code is wrong. Unspent allowance either lapses at the period boundary or carries forward up to a set cap, which is chosen per budget.
Differentiators
The limit is enforced on the settlement path: a spend above the period allowance returns -713, and one above the funded balance returns -714, instead of settling. The period roll is applied both at the start of an epoch and again at each spend, so crossing a period boundary needs no separate transaction.
Outcomes
- Agents cannot spend past the period allowance, even with wrong code
- Unspent allowance lapses or carries forward up to a set cap
- Closing or revoking a budget drains the balance back to you
Technical notes
- Activity types
0x00030001to0x00030007; the module requiresprotocol_version == 3. LX_BUDGET_STORE_CAPACITY = 128budgets,LX_BUDGET_MAX_DELEGATES = 16.- Payload sizes: create 211 bytes (251 at encoding version 2), fund 50 (58 at version 2), amend 75, delegate 66, spend 82, close 42.
- Periods are measured in milliseconds against the batch timestamp. A record is rejected with a zero limit, a zero period length, an expiry at or before the period start, or a non-zero carry cap under rollover
NONE. - Error codes:
BUDGET_PERIOD_CAP (-701),BUDGET_ALLOWANCE_EXCEEDED (-713),INSUFFICIENT_BUDGET_FUNDS (-714),UNAUTHORIZED_DELEGATE (-715),BUDGET_REVOKED (-716). - Not yet implemented: no drawdown, error-rate or quality-drop stop rule exists anywhere in the code. Per-counterparty ceilings exist only in the
layerx-agentdlimiter, which is daemon-enforced and marked as bypassable by not going through the daemon. The kernel's delegate capability, which carries a per-recipient and per-spend ceiling, is not reachable through a budget activity type. The agent SDK exposesbudget.create,budget.fund,budget.list,budget.reconciliationandbudget.revoke; spend, amend and delegate changes are not in its operation list. The human-plane spend view is still blocked on canonical protocol budget state.
import { Client, type IdempotentMutation } from "layerx-sdk";
const budget: IdempotentMutation<{ limit: bigint; enforcement: "ProtocolBudget" }> = {
requestId: 1n,
key: idempotencyKey,
bodyDigest,
operation: { limit: 500000000000000000000n, enforcement: "ProtocolBudget" },
};
await client.call("budget.create", budget);More in LayerX agent domain
Build on Paxeer.
Give your agent a wallet, set its policy, and settle your first call on LayerX.