Author policies in plain English
You can describe a policy in a sentence and get a draft back. A draft is never saved until you create or publish it, so nothing happens to your agents while you experiment.
Plain-English authoring uses a language model that your Bairav administrator must enable. If it is off, POST /api/policies/author answers with "ok": false and a reason instead of a draft. Everything else on this page works without it.
The flow
- Author.
POST /api/policies/authorwith your sentence returns a draft policy (never persisted).POST /api/policies/compileturns natural language into a structured draft. - Preview.
POST /api/policies/previewshows how many agents the draft would match, with up to six names. Matching zero agents does not stop you saving. - Check conflicts.
POST /api/policies/conflictsruns a deterministic analysis against your existing policies. - Create, then publish.
POST /api/policiessaves it. Policies can be kept as drafts (PUT /api/policies/{id}/draft) and published withPOST /api/policies/{id}/publish. Every version is kept (GET /api/policies/{id}/versions).
These calls need the admin or reviewer role, except preview and conflicts, which any signed-in user can run.
Create a policy directly
curl -X POST "https://$BAIRAV_HOST/api/policies" \
-H "Authorization: Bearer $BAIRAV_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Block prompt injection phrases",
"description": "Refuse requests that try to override instructions.",
"action": "block",
"definition": {
"guardrail": {
"deny_prompt_patterns": ["(?i)ignore (all )?previous instructions"],
"message": "This request was blocked by policy."
}
}
}'
action is block, require_approval, flag or notify, and defaults to block: a policy created without an explicit action stops what it matches rather than merely mentioning it.
Then prove it before it matters
Run the change through Try it out to see the decision for a sample request, and replay past gateway decisions against today's policies with POST /api/policies/replay.