Skip to main content
Decide what your agents can never do. Policies are your hard rules; Neon catches what no rule named. Each starts in Monitor, so you see what it would block before you Enforce it. For example, this policy blocks any request that offers the model a tool named delete_database:

Create a policy

1

Open the form

On Policies, click Create policy. If the button reads Create with Nova, open its menu and choose Create manually.
2

Write the rule

Under Start from, choose Blank policy and paste the rule, or start from a template.
3

Name it and pick its stage

Give it a Policy name and set Runs at to Model request or Model response.
4

Pick its agents and mode

Under Agents, add your agents. Starts in defaults to Monitor, which records what the policy would do without acting on it.
5

Create it

Click Create custom policy. A policy that covers an agent is on as soon as it is created.
Create policy form with a blank policy named No delete database, Runs at Model request, Starts in Monitor, and its Rego

The Create policy form

Monitor, then Enforce

Every control in Xenovia can watch before it acts. A policy, a Neon risk family, the agent’s purpose check and each guardrail has a mode:
  • Monitor records what it would have done, on the session and in its counts, and changes nothing.
  • Enforce acts: it blocks, redacts or escalates.
Start in Monitor, read what would have been blocked in Sessions, then switch to Enforce. For a policy, open its Agents tab and set Mode for each agent. When you choose to enforce, the dashboard shows, per agent, how many calls it would have blocked in the last 7 days. For Neon, use the agent’s Neon tab. Testing a policy before you save it is covered in Test a policy; testing a whole agent against attacks is Simulation.

How policies run

Xenovia evaluates Open Policy Agent (OPA) Rego policies on every call to an agent. You write a policy once in the control plane and attach it to one or more agents. Each policy runs at one stage, chosen under Runs at when you create it:
  • Model request: checks the prompt, the tools offered and the tool results before the model is called.
  • Model response: checks the model’s reply and the tool calls it proposes before your app gets them.
Policies run before Neon at the same stage. A policy block stops the call before Neon sees it, and a policy redaction is applied before Neon judges the material. With the Python SDK, request-stage policies also run on model_request checks, and response-stage policies on model_response and tool_call checks. Enabled policies are compiled into each agent’s configuration. Each runtime instance revalidates that configuration at least every five minutes. OPA compiles with a 2-second timeout, and enforced policies get 200 milliseconds per stage to evaluate. If an enforced policy fails to evaluate (an error, a conflict or a timeout), the call is refused with 503. Monitor policies are evaluated on their own budget and never affect the call.

Policies, agents and modes

A policy covers every agent on its Agents tab. Each agent there has its own Mode:
  • Enforce acts on that agent’s calls.
  • Monitor records what the policy would do and changes nothing. Its would-be decision is recorded on the trace.
So one policy can be enforced for some agents and in monitor mode for others. Use monitor mode to trial a policy against live traffic before enforcing it. When you choose to enforce, the dashboard shows, per agent, how many calls it would have blocked in the last 7 days. A policy created in the dashboard starts in the mode you pick under Starts in (Monitor by default). A policy with no agents stays in your library. You can only enable a policy that covers an active agent, and removing its last agent turns it off.

The policy page

Through the API, GET /api/v1/policies/{policy_id}/versions lists the versions, newest first. GET /api/v1/policies/{policy_id}/stats?days=7 returns the decision counts (1 to 30 days), and GET /api/v1/policies/{policy_id}/activity returns the change history.

The decision contract

A policy returns a single decision object. This is the only value the runtime reads. allow/deny rules and a bare redact_fields set are ignored.
  • Write package xenovia. The control plane strips your package line and re-packages the rule under a system namespace, so the package name you choose does not matter.
  • action says what to do. rule is a short identifier recorded on the trace and returned in X-Xenovia-Reason as policy:<rule>. Any other key (including reason) is ignored by the runtime.
  • Multiple complete decision rules must have mutually exclusive conditions. If two can be true at once with different values, OPA reports a conflict and the call fails closed. Guard each rule with distinct conditions, for example on input.sub_agent.name.
  • A policy whose decision is undefined for a call (no rule matched and there is no default) allows it.
When you save, the Rego is compiled with opa check --strict. A policy is also refused if it defines no decision rule, or if it writes an action the runtime doesn’t know. Each of these returns 422 with the diagnostics.

Actions

A refused call gets a 200 refusal, not an error (see What a block looks like to your app). At the response stage, block and redact are read as block_response and redact_response. When several enabled policies run at the same stage, the strongest action wins. At the request stage, block beats escalate, which beats redact, which beats allow. At the response stage the order is block_response, escalate, redact_response, then allow. The redact fields of every redacting policy are combined. An action outside the stage’s list, such as deny or a response action at the request stage, fails closed. The runtime treats it as a block and records the error on the trace.

Redaction

Return the labels to strip in redact_fields:
Supported labels: email, ssn, phone, creditcard (Luhn-validated), ip, url. At the request stage, redaction applies to message text, tool descriptions and the Responses instructions field. At the response stage it applies to the reply text. Streamed replies are buffered and checked before any content is sent, so response redaction applies to them too.

Test a policy

When you create a policy in the dashboard, Test with a sample call runs the rule as written against a sample call in JSON. Nothing is saved. Through the API, pass up to 50 conformance_cases when you create or update a policy. Each case has a name, an input in the policy input shape (a subset is fine) and an expect with an action and, optionally, a rule. The cases run when you save, and a failing case refuses the save with 422.

Policy input

Both stages receive the same base fields, and each stage adds its own. GET /api/v1/agents/{agent_id}/schema/policy-input lists the fields for one agent, with the stage each is available at.
input.tools lists every declared tool. family is function or custom for tools your code runs. For a tool the provider runs, it is the hosted tool family, such as web_search or mcp (see Hosted tools). input.tool_names lists only named tools, so a hosted tool such as web search may be in tools but not in tool_names. The sub-agent fields are described in Sub-agents. With the SDK, input.payload holds the payload your code sent.

Examples

Block a tool

Allow only known-safe tools

input.tool_names lists the names of the tools your app declared, exactly as sent; comparisons are case-sensitive. A hosted tool such as web search may be in input.tools without a name in input.tool_names, so use tool_names for your own tools and the hosted tool allow-list for the provider’s.

Escalate a destructive tool for human attention

A policy escalation refuses the call and records an escalation for review.

Require the agent’s model to be on an allowlist

input.model is the model configured on the agent’s provider, so this rule guards against an agent routed to an unapproved model rather than a client choosing one.

Cap output tokens (request stage)

Block a refusal in the reply (response stage)

Templates

Instantiate a shipped template with its parameters instead of writing Rego. Several cover tool access directly, for example an approved-tool allowlist, tool-argument PII blocking, and tool-argument size caps. Thirteen templates were removed because the runtime never produces the inputs they read, or because they always escalated: pii-pattern-block, rapid-call-rate-block, repeat-denial-escalation, anomalous-tool-pattern-escalation, tenant-boundary-match, external-disclosure-consent-gate, block-shadow-model-fallback, low-confidence-escalation, high-risk-tool-human-approval, financial-threshold-escalation, eu-ai-act-fundamental-rights-review, destructive-tool-confirmation, and workflow-intent-aggregate-escalate. Policies you already created from them are unchanged; review whether they can still fire.

Neon and guardrails

Policies are deterministic rules. Neon, Xenovia’s decision model, judges each stage after them. It checks its trained risks, the guardrails you write in plain language, and the agent’s purpose and capabilities. Set it up on the agent’s Neon tab. See Neon for its stages, settings and what happens when it can’t be reached.

Escalations

escalate is for actions you want flagged for human attention. When a policy escalates:
  1. The call is refused: a request-stage escalation refuses the request, and a response-stage escalation withholds the reply. Your app gets the refusal described above.
  2. An escalation is recorded, carrying the agent and the matched rule.
  3. Any alert rule with the Policy escalation trigger fires.
A Neon guardrail with the action Allow and flag for review records an escalation the same way but lets the call go on. It fires alert rules with the Guardrail escalation trigger. Open escalations are listed under Escalations in Sessions, and a session with one shows Waiting for approval. Choose Resolve escalation to close it with a note. Through the API, use GET /api/v1/escalations (filter with status=open or resolved) and POST /api/v1/escalations/{escalation_id}/resolve with an optional note.
There is no approve/deny queue. Resolving an escalation records your note; it doesn’t release or replay the call. A policy escalation has already refused the call, and a guardrail escalation has already let it through. After review, adjust the policy or guardrail.
  • Least privilege. Blocklist high-risk tools explicitly rather than trusting a broad allowlist, and turn on Restrict hosted tools for agents that don’t need provider-run tools.
  • Separate by environment. Use different agents, or different policies on one agent, for dev, staging, and prod. Never share production credentials.
  • Flag irreversible actions. A policy escalate refuses deletions, financial writes and cross-system state changes and records them for review. A Neon guardrail with Allow and flag for review lets them through and records them. Either way they show up in Sessions.
  • Review from evidence. Traces show which tools are actually called. Remove rules for tools that no longer appear.

What next?

Neon

Catch what no rule named.

Hosted tools

Limit the tools the provider runs.

Sessions

See what a policy blocked, or would have.