Policies

The policy document, field by field.

A policy is versioned JSON. Publishing creates a new version; the previous one is archived and stays readable, so every record can be explained against the policy that was live when it was decided.

A complete policy

policy.json
{
  "name": "agency-refunds",
  "version": 7,
  "status": "active",
  "default_effect": "deny",
  "fail_mode": "closed",
  "rules": [
    {
      "id": "spend-under-500",
      "name": "Refunds under 500 USD",
      "priority": 10,
      "effect": "allow",
      "when": {
        "tools": ["refund.create"],
        "amount_usd_lte": 500,
        "exclude_data_classes": ["health", "payment_card"]
      },
      "explanation": "Refund of {{amount}} is under the automated ceiling and touches no restricted data class."
    },
    {
      "id": "large-refund-gate",
      "name": "Refunds over 500 USD",
      "priority": 20,
      "effect": "deny",
      "when": { "tools": ["refund.create"], "amount_usd_gt": 500 },
      "explanation": "Refund of {{amount}} exceeds the automated ceiling for this agent."
    }
  ]
}

Fields

FieldTypeMeaning
default_effectallow | denyApplied when no rule matches. Deny is the shipped default.
fail_modeclosed | openApplies when no policy is published at all. Closed denies.
rules[].prioritynumberEvaluated ascending; the first match wins.
rules[].effectallow | denyWhat this rule decides.
when.toolsstring[]Exact tool names, or a prefix ending in *.
when.agentsstring[]Restrict to named agents.
when.amount_usd_lte / _gtnumberAmount ceilings and floors.
when.include_data_classesstring[]Match only if the action touches one of these.
when.exclude_data_classesstring[]Match only if it touches none of these.
when.risk_score_gtenumberRisk floor supplied by the caller.
when.hours_utc[from, to]Allowed window in UTC; outside it the rule does not match.
when.velocity{count, window_seconds}Matches when the agent exceeded the count in the window.
explanationstringPlain-language reason, stored on the record.

Evaluation order

Rules are sorted by priority ascending. The first rule whose conditions all match decides the outcome, and evaluation stops. No match falls through to the policy default. No active policy falls through to the client fail mode. Nothing else can produce an allow.

Simulate before publishing. The console runs a candidate policy against a request you construct and shows which rule would fire, so a threshold change is testable without touching the live version.

Templates

Starter policies for refunds, support replies, deployments and read-only research ship in the console and can be duplicated. See the policy library.

A decision you can verify right now
permanent demo decisionALLOW
action
refund.create · $180
rule
Refunds up to 250 USD
record
seq 1
sha-256
078506dc86…8a5948
statement
anchored
receipt
moment-j5xx23u1
dec_demo_permanent

Cite: Aprve decision dec_demo_permanent, seq 1, sha-256 078506dc868d5413af74db8267801c4bf602dea47d0446ef97ca517d5e8a5948