← All docs

Policy DSL

Plain JSON rules that gate agent actions inline. 11 operators. Sub-50ms decisions.

Anatomy of a policy

{
  "name": "no-external-email",
  "description": "Customer-support bot may never email outside the company.",
  "match": {
    "agent_name": "customer-support-bot",
    "tool_name":  "send_email"
  },
  "where": {
    "metadata.recipient": {
      "domain_not_in": ["company.com"]
    }
  },
  "decision": "block",
  "enabled": true
}

match filters which actions this policy applies to. where evaluates per-field conditions. If both pass, decision is returned. Otherwise the policy doesn't fire.

Operators

OperatorMeaning
equalsExact match
not_equalsAnything but the value
inValue is in the list
not_inValue is not in the list
containsSubstring contains
not_containsSubstring does not contain
gt / ltNumeric greater / less than
regexJS-style regex match
domain_inEmail/URL domain in list
domain_not_inEmail/URL domain not in list

Field paths

Use dot notation to walk into inputs, outputs, or metadata:

{ "metadata.recipient": { "domain_not_in": ["company.com"] } }
{ "inputs.amount":       { "gt": 10000 } }
{ "outputs.error":       { "contains": "PII" } }

Example library

Block writes to production tables

{
  "match": { "tool_name": "database_write" },
  "where": { "metadata.table": { "in": ["users","payments","secrets"] } },
  "decision": "block"
}

Review any agent action over $1

{
  "match": {},
  "where": { "cost_usd": { "gt": 1 } },
  "decision": "review"
}

Block all model calls containing 'ignore previous instructions'

{
  "match": { "action_type": "model_call" },
  "where": { "inputs.messages": { "regex": "ignore (all )?previous instructions" } },
  "decision": "block"
}

Manage policies via the /policies UI or the REST API.