Spending Policies

Configure spending policies for AI agent accounts with on-chain enforcement via Solana smart contracts. Define amount limits, merchant allowlists, time restrictions, and multi-signature requirements—all validated cryptographically before payment execution.

Overview

Spending policies provide programmable authorization controls for autonomous AI agents:

  • Amount Limits: Per-transaction, daily, weekly, monthly spending caps

  • Merchant Allowlists: Restrict payments to approved Solana addresses

  • Time-Based Rules: Scheduled payment windows and blackout periods

  • Multi-Signature: Require multiple approvals for high-value payments

  • On-Chain Enforcement: Policies enforced by Solana smart contracts

  • Category Restrictions: Spending limits by service category (APIs, compute, data)

Creating Policies

Basic Policy

const policy = await mppfi.policies.create({
  agentId: 'agt_7xK9mN2pQ1',
  name: 'Production Agent Policy',
  rules: [
    {
      type: 'amount_limit',
      period: 'daily',
      limit: { amount: 500.00, currency: 'USDC' }
    },
    {
      type: 'merchant_allowlist',
      addresses: [
        'GHvFFSZ8dDbN9eDeTe3vPqX7jHhgYFLkLGVrHjG6FH2P', // OpenAI
        '8qN5L3kZ9xM2vY7cB4jT6wE1rP9sU5hG3fD8aQ2nK7m', // Anthropic
        'F3xR9vQ2mL7nP5jK8cW4yT6zS1bN9hG2dA5eU8fV3k'  // AWS
      ]
    }
  ],
  enforcement: 'on_chain' // Enforced by Solana smart contract
});

console.log(`Policy ID: ${policy.id}`);
console.log(`Contract address: ${policy.blockchain.contract_address}`);

Response:

Policy Rules

1. Amount Limits

Restrict spending over time periods:

Example with multiple periods:

2. Merchant Allowlists

Only allow payments to approved Solana addresses:

Domain-based allowlist (via MPP):

3. Transaction Amount Limits

Per-transaction maximums:

4. Category Restrictions

Spending limits by service category:

5. Time-Based Controls

Restrict when payments can occur:

Example with blackout periods:

6. Multi-Signature Requirements

Require multiple approvals for high-value payments:

7. Velocity Limits

Maximum number of transactions per time period:

8. Balance Requirements

Minimum balance thresholds:

Complete Policy Example

Policy Management

Update Policy

Note: Updating a policy deploys a new smart contract on Solana. The old contract is deprecated but remains on-chain for audit purposes.

Disable Policy Temporarily

Archive Policy

Policy Enforcement

On-Chain Validation

All policies are enforced by Solana smart contracts before payment execution:

Pre-Flight Validation

Check if payment will pass policy validation:

Response:

Multi-Signature Approvals

Request Approval for High-Value Payment

Sign Approval

Approval Status

Policy Analytics

Spending Summary

Violation History

Policy Compliance Report

Best Practices

1. Start Restrictive, Loosen Gradually

Begin with conservative limits and adjust based on actual usage:

2. Layer Multiple Controls

Use defense-in-depth with complementary rules:

3. Use Metadata for Governance

Tag policies for tracking and audits:

4. Monitor Policy Effectiveness

Set up alerts for policy events:

5. Regular Policy Reviews

Schedule quarterly policy reviews:

Emergency Procedures

Policy Override

Temporarily bypass policies for emergencies (requires elevated privileges):

Policy Freeze

Lock policy to prevent modifications during audits:

Rate Limits

Policy endpoints have the following rate limits:

Endpoint
Limit
Window

Create policy

10 requests

1 minute

Update policy

20 requests

1 minute

Validate policy

1000 requests

1 minute

Get policy

500 requests

1 minute

Next Steps

Last updated

Was this helpful?