Spending Policies

Configure cryptographically-enforced spending rules for agent accounts. Define velocity limits, merchant restrictions, multi-sig requirements, and time-based controls—all validated on-chain via x402.


Overview

Spending policies provide programmable authorization for autonomous agent operations:

  • Velocity Limits - Daily/monthly spending caps

  • Merchant Whitelists - Approved payee restrictions

  • Multi-Sig Thresholds - Amount-based approval requirements

  • Time-Based Rules - Scheduled and time-locked controls

  • Cryptographic Enforcement - On-chain validation via x402


Creating Policies

Basic Policy

const policy = await vault.policies.create({
  accountId: 'acc_7k3m9n2p4q1r',
  name: 'Production Spending Policy',
  rules: [
    {
      type: 'velocity_limit',
      period: 'daily',
      limit: { amount: 5000, currency: 'USDC' }
    },
    {
      type: 'merchant_whitelist',
      allowedPayees: [
        'openai.com',
        'anthropic.com',
        'vercel.com',
        'aws.amazon.com'
      ]
    }
  ],
  enforcement: 'cryptographic' // On-chain validation
});

Policy Rules

Velocity Limits

Restrict spending over time periods:

Merchant Whitelisting

Only allow payments to approved merchants:

Multi-Sig Thresholds

Require multiple approvals for large payments:

Time-Based Controls

Restrict when payments can occur:


Complete Policy Example


Policy Management

Update Policy

Disable Policy Temporarily

Delete Policy


Policy Enforcement

Cryptographic Validation

All policies are enforced on-chain via x402:

Policy Validation

Check if payment would violate policies before sending:


Multi-Signature Approvals

Request Approval

Sign Approval


Policy Analytics

Spending Summary

Violation History


Best Practices

1. Start Restrictive

Begin with tight limits and loosen as needed:

2. Layer Multiple Rules

Combine complementary rules for defense-in-depth:

3. Use Metadata for Tracking

Tag policies for easy management:

4. Regular Policy Reviews

Schedule quarterly reviews:


Emergency Procedures

Policy Override

Temporarily bypass policies for emergencies:

Policy Freeze

Lock policy to prevent modifications:


Next Steps


Cryptographically-enforced spending rules

Last updated