Agent Budget Vault

Fund AI agents — without giving them a wallet.

Define exactly how much an agent can spend.
Every payment is pre-approved, limited, and reversible.

Agents don't hold funds.

They receive permissions to spend them.

Example — $10 budget
You deposit$10 USDC into a vault
Agent gets10 permissions ($1 each)
Each API calluses 1 permission
Unused fundsreturn to you automatically

Why this exists

Without Agent Budgets
✗ agents need wallets
✗ agents can overspend
✗ compromised agents can drain funds
✗ no automatic recovery
With RelAI Budget Vault
no wallets
strict spending limits
zero risk of full fund loss
unused funds auto-return

How it works

01You deposit USDC into a vault
02Funds are split into fixed-size permissions (one per payment)
03Each permission = one payment of a fixed amount
04Agent uses permissions to pay for API calls — no wallet needed
05Unused permissions expire and funds return to you automatically

Secrets are generated client-side and never stored on the server. Save them immediately after preparation — if lost, funds remain locked until expiry.

Key concept

Each payment is pre-approved.

Agents cannot spend more than what was allocated. There is no way for an agent — or an attacker who compromises one — to exceed the committed budget.

Security guarantees

No private keys — Agents cannot sign transactions — they only know spending secrets, not wallet keys.
Capped exposure — Max loss = allocated budget. The owner's main wallet is completely untouched.
Reversible — Owner can call cancelBatch() at any time to reclaim unspent USDC before redemption.
Expiry safety net — Every permission has an expiry. After expiry, reclaimExpired() returns funds — no secrets needed.
No partial spending — Each permission unlocks exactly one fixed-amount payment. Choose denomination at deposit time.

Compared to traditional approaches

ModelAgent needsRiskReversible
WalletsPrivate keyFull drain possible✗
API billingAccount credentialsUnlimited chargesPartial
RelAI Budget VaultNothingMax = allocated budget✓

Works with

Using the app

Available at /app/send under the Agent Budget tab.

01Set amount per permission (e.g. 1.00 USDC), number of permissions, and expiry hours
02Click "Prepare budget" — permissions are generated. Copy all secrets now
03Click "Deposit to vault" — MetaMask prompts to switch to SKALE Base Sepolia, approve USDC, then deposit
04Hand the secrets to your AI agent (env var, system prompt, API call)
05To reclaim unused funds: click "Withdraw all" (calls cancelBatch in one tx)
06After expiry: "Reclaim expired" button appears — recovers USDC without needing secrets

API Reference

POST/facilitator/agent-budget/prepare

Generate N (secret, hashlock) pairs. Returns secrets + deposit calldata. Requires auth.

POST/facilitator/agent-budget/redeem

Reveal a secret to redeem a commitment to a payee address. Called by the agent.

POST/facilitator/agent-budget/cancel

Cancel an unused commitment by hashlock (owner only). Returns USDC to owner.

Prepare 3 × 1 USDC permissions
curl -X POST https://api.relai.fi/facilitator/agent-budget/prepare \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ "items": [
    { "amount": 1000000, "expiry": 1735000000 },
    { "amount": 1000000, "expiry": 1735000000 },
    { "amount": 1000000, "expiry": 1735000000 }
  ]}'

→ {
    "secrets": ["0xabc123...", "0xdef456...", "0x789xyz..."],
    "totalHuman": "3.00",
    "vaultAddress": "0xA570faFC8128792fD71503026cC683A3d54369Eb"
  }
Agent redeems a permission
curl -X POST https://api.relai.fi/facilitator/agent-budget/redeem \
  -H "Content-Type: application/json" \
  -d '{ "secret": "0xabc123...", "payee": "0xApiProviderAddress" }'

→ { "success": true, "txHash": "0x...", "amount": 1000000 }

Contract Reference

AgentBudgetVault · SKALE Base Sepolia (chainId: 324705682)
0xA570faFC8128792fD71503026cC683A3d54369Eb
deposit(address usdc, Item[] items)

Lock USDC for each item. Item = { hashlock, amount, expiry }.

redeem(bytes32 secret, address payee)

Reveal preimage — if hash(secret) matches, transfers amount to payee.

cancel(bytes32 hashlock)

Owner cancels a single unused commitment and recovers USDC.

cancelBatch(bytes32[] hashlocks)

Owner cancels multiple commitments in one transaction.

reclaimExpired(bytes32[] hashlocks)

Reclaim expired, unused commitments — funds returned to owner. Anyone can call after expiry.