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
| Field | Type | Meaning |
|---|---|---|
| default_effect | allow | deny | Applied when no rule matches. Deny is the shipped default. |
| fail_mode | closed | open | Applies when no policy is published at all. Closed denies. |
| rules[].priority | number | Evaluated ascending; the first match wins. |
| rules[].effect | allow | deny | What this rule decides. |
| when.tools | string[] | Exact tool names, or a prefix ending in *. |
| when.agents | string[] | Restrict to named agents. |
| when.amount_usd_lte / _gt | number | Amount ceilings and floors. |
| when.include_data_classes | string[] | Match only if the action touches one of these. |
| when.exclude_data_classes | string[] | Match only if it touches none of these. |
| when.risk_score_gte | number | Risk 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. |
| explanation | string | Plain-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.
