Spend Limits and Budgets

Brain's policy engine provides granular spend controls from global account budgets to per-agent daily limits, asset restrictions, and per-merchant caps. All limits are enforced at the smart account level, not just in the backend.

Budget Hierarchy

Budgets are enforced at two levels:

  • Account level — a global cap that applies across all agents under a BrainAccount

  • Agent level — per-agent limits that must also satisfy the account-level constraint

An agent can never spend more than the lesser of its own limit and the account's global limit.

Setting a Daily Spend Limit

const policy = new PolicyBuilder()
  .setSpendLimit('500 USDC/day')    // Daily rolling window
  .setSpendLimit('2000 USDC/week')  // Weekly cap (additive constraint)
  .setAssetCap('ETH', '1 ETH/day') // Per-asset cap
  .build();

Per-Merchant Limits

const policy = new PolicyBuilder()
  .setMerchantCap('0xMerchantA', '100 USDC/day')
  .setMerchantCap('0xMerchantB', '50 USDC/day')
  .setMerchantBlocklist(['0xUntrustedMerchant'])
  .build();

Checking Remaining Budget

Budget Reset Windows

Period
Reset Behaviour

day

Resets at 00:00 UTC each day

week

Resets at 00:00 UTC each Monday

month

Resets at 00:00 UTC on the 1st of each month

Approval Thresholds for Large Transactions

For actions above a certain value, you can require multi-party approval:

On-Chain Enforcement

circle-exclamation

Limits are not advisory. They are hard constraints enforced on-chain before any funds can move.

Last updated