Skip to content
Oris Docs

Configure policies

Goal

Define a tight spending envelope for an agent. Verify it blocks the wrong payments and allows the right ones. Roll it out.

Prerequisites

  • A registered agent at KYA Level 1 or higher.
  • API key and Ed25519 signing key.

Step 1: Compose the policy

policy = client.policies.create(
agent_id=agent.id,
max_per_tx=50.00,
max_daily=500.00,
max_monthly=5000.00,
allowed_categories=["cloud_compute", "api_consumption"],
counterparty_whitelist=["0xA1b2...", "0xC3d4..."],
escalation_threshold=200.00,
)
print(policy.id, policy.version)

The Merkle root commits to OrisL2PolicyRegistry within the minute.

Step 2: Pre-evaluate before sending

cases = [
(10.00, "api_consumption", "0xA1b2..."), # should allow
(75.00, "api_consumption", "0xA1b2..."), # should deny per_tx
(10.00, "marketing_ads", "0xA1b2..."), # should deny category
(10.00, "api_consumption", "0xUnknown..."), # should deny counterparty
]
for amount, category, to in cases:
v = client.policies.evaluate(
agent_id=agent.id, to_address=to, amount=amount, category=category,
)
print(amount, category, to, "->", v.allow, v.deny_reason)

Step 3: Update a rule

client.policies.update(policy.id, max_daily=750.00)

The Redis cache is invalidated atomically. The next transaction sees the new rule.

Verification

The current policy version appears on every signed bundle. Read result.policy_version on a payment to confirm the rules in effect at payment time.

Troubleshooting

  • OrisPolicyDeny with deny_reason="counterparty_not_allowed" — the destination is not in counterparty_whitelist. Add it or remove the rule.
  • OrisPolicyDeny with deny_reason="amount_cap"max_per_tx exceeded. Use escalation if the payment is legitimate.
  • Policy update has no effect — verify policy.version incremented. A no-op update returns the existing version.

Where to go next