Skip to main content

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

FieldRequiredDescription
toolyesTool name or * to match any
actionyesAction name, HTTP method, or *
decisionnoallow or deny (default: allow)
require_reasoningnoIf true, call is denied unless reasoning is provided
messagenoHuman-readable message returned on denial
idnoOptional 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 tool
  • action: "*" 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.