30 seconds end-to-end
Step 1 — describe the agent
POST /api/ai/generate-policy-bundle
{
"description": "Customer support copilot. Reads our Zendesk + internal KB.
Drafts replies. NEVER deletes a ticket. NEVER emails outside
@acme.com. Treat any tool call touching billing as HIGH risk.",
"context": {
"tool_inventory": [ /* from `agentguard scan` */ ],
"workflow_graph": { /* LangGraph topology from the scanner */ },
"capability_risk": { "score": 62, "class": "HIGH" }
}
}
Step 2 — N-sample fan-out + self-consistency
AEGIS draws 3 candidates in parallel at temperature 0.7
(self-consistency, Wang 2023). Each is grammar-constrained
to the six templates (forbid_argument / require_pattern /
forbid_pattern / max_length / enum_values / require_https)
via discriminated-union schema validation.
Step 3 — AJV self-test loop
Every candidate compiles to JSON Schema. AEGIS executes
the model's own should_block /
should_allow test cases against the compiled
validator. False negatives (call slipped through the
block-list) and false positives (good call got blocked)
score the bundle.
Step 4 — PerFine repair round (if needed)
If no candidate is clean, the best-scoring bundle gets ONE
targeted repair round at temperature 0 with the failed
assertions in the prompt (PerFine, arXiv 2510.24469).
Usually fixes the last 1-2 false negatives.
Step 5 — verified bundle out
{
"policies": [
{
"id": "no-ticket-delete",
"risk_level": "CRITICAL",
"template": { "kind": "forbid_argument", "field": "ticket_id" },
"tests": {
"should_block": [{ "tool": "zendesk_delete", "arguments": { "ticket_id": "12345" } }],
"should_allow": []
}
},
{
"id": "email-acme-only",
"risk_level": "HIGH",
"template": { "kind": "require_pattern", "field": "to",
"pattern": "^[^@\\s]+@acme\\.com$" },
"tests": {
"should_block": [{ "tool": "send_email", "arguments": { "to": "attacker@evil.com" } }],
"should_allow": [{ "tool": "send_email", "arguments": { "to": "colleague@acme.com" } }]
}
}
/* ... 4-8 more, one per node + sensitive-relay edge ... */
],
"dsl": {
"rules": [
{
"name": "billing-hitl",
"when": { "all": [ { "tool.name": { "matches": "billing_.*" } } ] },
"then": { "decision": "pending", "reason": "billing action requires human review" }
}
]
},
"validation": { "rounds": 1, "score": 1.0, "issues": [] }
}