Spending Policies

Spending policies define guardrails for agent transactions. Every payment passes through the policy engine before reaching compliance screening or on-chain submission. Policies are evaluated in Redis with sub-10ms latency.

Rule Types

RuleFieldDescription
Per-Transaction Limitmax_per_transactionMaximum amount for a single payment
Daily Limitmax_dailyMaximum cumulative per 24-hour rolling window
Weekly Limitmax_weeklyMaximum cumulative per 7-day rolling window
Monthly Limitmax_monthlyMaximum cumulative per 30-day rolling window
Counterparty Whitelistcounterparty_whitelistOnly these addresses can receive payments
Counterparty Blacklistcounterparty_blacklistPayments to these addresses are rejected
Velocity Limitsvelocity_limitsMax transactions per hour, max unique counterparties per day

Advanced Rules

RuleFieldDescription
Allowed Chainsallowed_chainsRestrict to specific chains
Allowed Stablecoinsallowed_stablecoinsRestrict to USDC, USDT, or EURC
Category Restrictionscategory_restrictionsAllow or block payment categories
Time Restrictionstime_restrictionsLimit to specific hours, block days
Escalationescalation_rulesRequire human approval above threshold

Enforcement Modes

ModeBehavior
enforceViolations blocked. Payment rejected with POLICY_VIOLATED.
warnViolations logged but payment proceeds. Response includes policy_result: "violated".
audit_onlyViolations silently logged. No impact on payment.

Violation Actions

ActionBehavior
rejectPayment rejected (HTTP 403)
flagPayment proceeds, flagged for review
escalatePayment held for human approval (HTTP 202)
suspend_agentPayment rejected and agent suspended

Evaluation Flow

StepActionLatency
1Load active policies from Redis cache<1ms
2Sort by priority (lower = higher priority)<1ms
3Evaluate each rule against the transaction<5ms
4Aggregate: if any enforced rule fails, violation<1ms
5Write to oris_policy_evaluations hypertableasync

SDK Usage

Python
policy = agent.set_policy( max_per_tx=50, max_daily=500, max_weekly=2000, counterparty_whitelist=["0xabc...", "0xdef..."], enforcement_mode="enforce" ) # Simulate before sending sim = agent.simulate_payment(amount=75) print(sim.passed) # False print(sim.violated_rules) # ["max_per_transaction"] print(sim.verdict) # "reject"

See Policies API for endpoint details.