Policy Engine
The policy engine controls what your AI agents are allowed to do. Policies are written in YAML and evaluated in order — the first matching rule wins.
Policy structure
version: "1"
rules:
- tool: github # tool name or "*" for any
action: DELETE # action/HTTP method or "*" for any
decision: deny # allow | deny
message: "DELETE is blocked"
- tool: "*"
action: POST
require_reasoning: true
message: "POST calls must include reasoning"
- tool: stripe
action: charge
decision: allow
Rule fields
| Field | Required | Description |
|---|---|---|
tool | yes | Tool name or * to match any |
action | yes | Action name, HTTP method, or * |
decision | no | allow or deny (default: allow) |
require_reasoning | no | If true, call is denied unless reasoning is provided |
message | no | Human-readable message returned on denial |
id | no | Optional rule name for audit log references |
Matching logic
Rules are evaluated top-to-bottom. The first rule where both tool and action match is applied. If no rule matches, the call is allowed by default.
rules:
- tool: github
action: DELETE
decision: deny # ← matches first for github+DELETE
- tool: "*"
action: DELETE
decision: deny # ← never reached for github+DELETE
Wildcard matching
tool: "*"matches any toolaction: "*"matches any action- Exact strings are case-insensitive
Requiring reasoning
require_reasoning: true means the call is only allowed if the reasoning field (or X-Agent-Reasoning header) is non-empty.
- tool: stripe
action: "*"
require_reasoning: true
message: "All Stripe calls require agent reasoning"
If reasoning is missing, the call is denied with the specified message.
Example policies
Allowlist only (deny everything else)
version: "1"
rules:
- tool: github
action: GET
decision: allow
- tool: "*"
action: "*"
decision: deny
message: "Only GitHub GET calls are permitted"
Read-only (block all writes)
version: "1"
rules:
- tool: "*"
action: POST
decision: deny
message: "Write operations are not permitted"
- tool: "*"
action: PUT
decision: deny
- tool: "*"
action: DELETE
decision: deny
Require reasoning for sensitive tools
version: "1"
rules:
- tool: stripe
action: "*"
require_reasoning: true
- tool: database
action: "*"
require_reasoning: true
Managing policies
Policies can be created and edited in the Policies tab of the dashboard, or via the API:
curl -X POST https://api.agentic-guard.com/agents/{agent_id}/policy \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{"rules_yaml": "version: \"1\"\nrules:\n - tool: \"*\"\n action: DELETE\n decision: deny"}'
Policy hot-reload
Policies are reloaded on every request — no restart required.