SENTINEL Docs

Budget Policies

Configure per-call, per-hour, and per-day spending limits.

Budget policies define spending limits and constraints. Sentinel evaluates every payment against the policy before it settles.

Preset Policies

import {
  conservativePolicy,
  standardPolicy,
  liberalPolicy,
  unlimitedPolicy,
  customPolicy,
} from "@valeo/x402";
PresetPer CallPer HourPer DayUse Case
conservativePolicy()$0.10$5.00$50.00Low-risk, testing
standardPolicy()$1.00$25.00$200.00Typical production
liberalPolicy()$10.00$100.00$1,000.00High-throughput, trusted
unlimitedPolicy()Audit only, no limits

Custom Policy

Override any defaults with customPolicy:

const policy = customPolicy({
  maxPerCall: "5.00",
  maxPerHour: "50.00",
  maxPerDay: "500.00",
  maxTotal: "10000.00",
  spikeThreshold: 5.0,
  allowedEndpoints: ["https://api.trusted.com/*"],
  blockedEndpoints: ["https://*.competitors.com/*"],
  requireApproval: {
    above: "50.00",
    handler: async (ctx) => await askSlackForApproval(ctx),
  },
});

BudgetPolicy Fields

FieldTypeDescription
maxPerCallstringMax USDC per single payment (e.g., "1.00")
maxPerHourstringHourly rolling cap
maxPerDaystringDaily rolling cap
maxTotalstringLifetime total cap
spikeThresholdnumberFlag if payment > N× rolling average (default 3.0)
allowedEndpointsstring[]URL patterns allowed (whitelist)
blockedEndpointsstring[]URL patterns blocked (blacklist)
requireApprovalobjectHuman approval above threshold

Endpoint patterns use glob-style matching. https://api.*.com/* matches https://api.weather.com/v1/current.