Guardrails
A guardrail is a detection rule for AI traffic: a YAML rule in the Sigma format with Netzilo extensions. It looks at prompts and answers, tool calls and tool results, HTTP requests and, on devices, process and file activity, and decides what happens: block, redact, report, allow, or a more specialised action. Typical guardrails stop prompt injection, redact secrets and personal data, and detect an agent that reads credentials and then sends them out.
A guardrail does nothing until a filter binds it. The same guardrail runs on devices when an endpoint filter binds it, and at the Netzilo AI Gateway when a gateway filter binds it.
You manage guardrails under Edge > Governance > Guardrails. Only administrators and owners see this page. This page covers the screen and the lifecycle of a rule. The full rule language, with every field, modifier, action and the scripting builtins, is on Detection Rules.
Every guardrail belongs to your account. There is no catalogue of global or premium rules and no plan gate on guardrails. Ready-made rules for prompt injection, secrets, personal data, path traversal, SSH-key exfiltration and system enumeration are in the public rule library at github.com/netzilo/aidr-sigma: copy one, adjust it, test it. Guardrails were called Scanners in earlier releases.
Watch it work
AI Gateway · 1:59
Redact secrets and personal data
Apply redaction guardrails to a team and watch Claude Code finish its task while the model only sees placeholders.
Detect & investigate · 1:56
Write your own detection rule
Turn a company policy, no agent may read payroll data, into a few lines of rule and enforce it.
How it works
- You write a guardrail, or paste one from the rule library, and test it in report mode on a test device or user.
- A filter binds the guardrail to a population:
- an endpoint filter, to the devices in its groups and operating systems, and with the OS Browser to the Netzilo browser extension of its users;
- a gateway filter, to the users of its groups when they go through the AI Gateway.
- Each Netzilo client, browser extension and AI Gateway loads the guardrails of the filters that apply to it and evaluates them on every matching event.
- The most severe matching guardrail decides the outcome and is the one named in the event. Each decision is recorded in Activity > Events.
Where a guardrail runs decides what it can see:
| Bound by | Runs on | Sees |
|---|---|---|
| an endpoint filter | the Netzilo client on each device, and the browser extension for the OS Browser | prompts and answers of intercepted apps, agent hooks and the browser extension; MCP over HTTP from intercepted apps; HTTP requests; semantic events; process and file activity where the client has those probes |
| a gateway filter | the AI Gateway, per user | prompts and answers, the tool calls a model asks for, every MCP tool call and result through /mcp/<slug>. No process, file or network-connect activity: rules that need it are not loaded at the gateway |
Which of the gateway's API surfaces are scanned is described on the AI Gateway page.
The Guardrails list

| Column | What it shows |
|---|---|
| Name | The guardrail's name and description. |
| Active | Whether the guardrail is enabled. A disabled guardrail is dropped from every filter at the next sync. |
| Level | Critical, High, Medium or Low, from the rule's level. |
| Category | The attack tactics from the rule's tags, for example attack.initial-access shows as Initial Access. Two are shown, then +N for the rest. A dash means the rule has no tactic tag. |
| Used by | The filters that bind the guardrail. No Filters means it runs nowhere. |
The newest guardrail is listed first until you sort by a column. Filter by level with All Severities. Click a row, or its pencil, to edit the guardrail; the play button replays it.
The dashboard does not let you delete a guardrail while a filter uses it: the delete button is disabled with Used by n filters and cannot be deleted. Remove it from those filters first.
Add or edit a guardrail
Click Add Guardrail, or click a row to edit one.

The dialog has two tabs:
| Tab | Field | What to enter |
|---|---|---|
| Guardrail | YAML Rule Definition | The rule. The rule's title and description sync with the name and description on the other tab. A rule that does not parse shows YAML Parse Warning with the reason. |
| Guardrail | Enable Guardrail | Turn the guardrail on or off without unbinding it. |
| Name & Description | Guardrail Name, Description | Both required. They sync with title and description in the YAML. |
The dialog is a window: drag it by its title bar, resize it from any edge, and maximize it. Double-click the title bar to return to the default size. The title bar icons are the AI Assistant panel (sparkle), maximize and close. Click Save, or Save Changes when you edit. Creating, updating and deleting a guardrail are recorded in Activity > Events.
There is no version history and no rollback. Saving replaces the rule, and the previous YAML is kept nowhere. Keep a copy of every rule in your own version control before you edit it.
A minimal rule
title: Block obvious prompt-injection phrases
id: 7d3a2f1e-6b2c-4c1b-9d5e-0a1b2c3d4e5f
status: experimental
level: high
description: Blocks tool inputs containing instruction-override phrases.
logsource: {product: ai_agent, category: tool_input}
detection:
sel:
content|contains:
- "ignore all previous instructions"
- "you are now DAN"
condition: sel
action: block
tags: [attack.initial-access]
idis a UUID that identifies the rule. Use a new one for every rule.levelsets the severity and the default action: critical and high block, medium and low report, whenactionis left out.logsource.categorychooses which traffic the rule looks at, here the input of a tool call. Other categories cover prompts and answers (llm_request,llm_response), tool results, HTTP requests, semantic events and, on devices, processes, files and network connections.detectionholds named selections and acondition. Exclude known-good traffic with a second selection:condition: sel and not excl.actionis one ofblock,report,redact,allow,scanand the other actions listed on Detection Rules.
Two things make a rule fail silently, so check for them:
|reuses RE2. Lookarounds, backreferences and\uescapes do not compile. The rule is saved, but the device or gateway reports it as failed and it never fires.- The wrong category. A rule bound in a gateway filter that needs process, file or connect activity is not loaded at the gateway at all.
The server does not validate the YAML. Read the host's rule load after every save, see Troubleshooting.
Write rules with the AI Assistant
The panel on the right of the dialog is the AI Assistant from the dashboard header. Describe what to detect, or what to change in the rule you have open, and press Enter. The assistant reads the rule in the editor with every message, loads the rule-authoring runbooks, and writes the complete rule into the editor; you watch it being written. Review it and click Save, then test it. The assistant never saves a guardrail itself.

- Threads. The panel opens on a clean thread. + starts a new one, and the history button lists your earlier guardrail threads to continue or delete. One thread can cover several guardrails, so you can refer to an earlier rule ("the same as the leak rule, but for tool results"). Long threads are summarized automatically. The threads also appear in the AI Assistant's history in the header, tagged Guardrail Authoring.
- Undo. After the assistant writes into the editor, Undo above the editor brings back what the editor held before.
- While it answers. The editor, the name and description, the enable switch, Save and Replay are locked. Press Esc to stop the answer; the window stays open. If an answer breaks off in the middle of a rule, the editor goes back to the last rule the assistant wrote in full, or to what it held before your message.
- One answer at a time. If the same thread is answering in another window, a new message waits until it has finished.
The panel uses the model approved for Assistant under Integrations > Artificial Intelligence, and the model picker under the message box chooses among them. Without a model approved for Assistant the panel is not shown. See Artificial Intelligence.
Test a guardrail
Test a new rule on a small scope before it blocks anything:
- Check the rule with the linter of the rule library,
tools/rulelint.pyin aidr-sigma. It reports categories no host produces, fields the engine never fills and|repatterns that do not compile. - Save the rule with
action: reportand bind it in a filter for one test device or one test user: an endpoint filter for device traffic, a gateway filter for traffic through the AI Gateway. - Reproduce the traffic the rule must catch, and the closest legitimate traffic.
- Read Activity > Events, category AI Edge. The traffic you meant to catch shows an AI detected event that names the rule, with the matched excerpt and the content. The legitimate traffic shows none.
Edit the YAML and repeat until the intended traffic, and only that, fires. Then change the action, see Roll out a guardrail.
Before step 2 you can replay the rule over sessions that already happened. What a device or the gateway recorded is in its AI session, under AI Sessions, and its behavior graph, see Behavior Graph & Kill Chains.
Replay a guardrail on recorded sessions
Replay runs guardrails over sessions that already happened and shows what they would have done, without binding or saving anything. Open it with the play button on a guardrail's row, or with Replay in the guardrail dialog, which replays the rule in the editor as a Draft before you save it.
Watch · 1:22
Test a guardrail before you turn it on
Replay a new guardrail on recorded agent sessions and see exactly what it would have stopped.

- Guardrails. Up to three: the one you started from (from the dialog, the draft) and any saved guardrails you add with Add guardrail. Each guardrail is evaluated on its own; on a step, the most severe action wins.
- Sessions. Up to three recorded sessions. Search by user, agent or model, or narrow the list with the user, agent and period filters.
- Click Replay. Each session is replayed alone, step by step in the order it happened, so a rule sees the session as it stood at that step.

Results lists, per session, the steps a guardrail would have acted on: the time, the kind of step, the tool or model, the guardrail, its action and reason, and the step's content with the matched text highlighted. A session where nothing fires shows No match. Under each session: the steps evaluated and the steps without recorded content.
Things to know:
- Content. Prompts, answers, tool arguments and tool results come from what the session's source captured; the AI Gateway and Netzilo clients that record AI sessions capture them. A step that was blocked live never reached the caller, so its content was not captured and it counts as a step without recorded content.
- Files. A file's text is not kept, so a replay judges recorded files on their type facts only: a rule that reads a file's content cannot be proven by replay. Test it on a pilot group in report mode instead.
- AI judge rules cost model calls. Rules with
action: scanor scripts that callllm_call()orsystem_one()make real model calls, one per step they run on. - Nothing else happens. A script's
http()andwebhook()calls are refused during a replay, so nothing is called and no notification is sent again, andraise_control()applies no response action. - Limits. Up to 5,000 steps per session and 500 reported hits per session; a run stops after 5 minutes, and an account runs two replays at a time.
Bind a guardrail with a filter
Go to Edge > Governance > Filters, open a filter, and on its Guardrails tab click Browse Guardrails or New Guardrail. See Filters.
When several filters apply to the same device or user, all their guardrails are evaluated together:
- The most severe matching rule decides, then the rule
idbreaks ties. Its position in a list has no effect. - A block from any rule wins. After a block only
redactandexecuterules still run. - An
allowrule records a match and never lifts another rule's block. To exempt a group, give it a filter that does not bind the rule, and make sure no other filter that matches it binds the rule either.
Files attached to AI requests
At the AI Gateway, guardrails also judge the files a model request carries: a PDF Claude
Code reads, a document or image dropped into a chat, a file part, a file or screenshot a tool
returns. Each file is its own event, file_attachment: its type facts (name, extension, the
type sniffed from its bytes, size, SHA-256) are fields, and its text is the content a rule
matches.
- Which rules apply to files: rules written for
file_attachment, and broad rules (agent_events) that do not require another event type. A personal-data rule written for all traffic therefore also checks file text. - When a file is read: only when such a rule applies to the user. Otherwise the file is recorded and judged on its type facts alone.
- What is read: text files, Word, Excel and PowerPoint (DOCX, XLSX, PPTX) and PDF. Images, archives and other formats are judged on their type facts only. There is no OCR, so a scanned PDF has no text to judge.
- Block refuses the whole request and names the file. Redact rewrites the file in place in the form it was sent; a PDF, a spreadsheet cell value or an embedded document cannot be rewritten, so a redaction there refuses the request instead.
- What never arrives as a file: text a client extracts itself. Claude Code sends the PDFs and images it reads as files, but a CSV or source file arrives as text. Claude Cowork reads every document in its own workspace and sends the text. Text guardrails apply to that text.
- Only the AI Gateway judges files. The Netzilo client, agent hooks, the SDK and the browser extension do not.
title: Executables attached to AI requests
id: 2f0d6c51-7f0b-4f3e-9c2e-5a1b8e7d3c40
status: stable
level: high
logsource:
product: ai_agent
category: file_attachment
detection:
exe:
true_type:
- application/vnd.microsoft.portable-executable
- application/x-elf
- application/x-mach-binary
condition: exe
action: block
A scripted rule can judge what a file is, for one team: bound to the engineering filter, files unrelated to development work refuses a customer export, an HR record or a bank statement while code, logs, specifications and test data pass. The fields, the reasons a file is not read and a complete example are in Detection Rules.
What users see
How a decision shows depends on where it was made:
- At the AI Gateway, a blocked request gets HTTP 400 (
netzilo_policy) with the rule's reason. A blocked MCP tool result answersTool execution failed: Blocked by rule: <name>. A streamed answer is held about 1 KB behind the model so that a match can still be redacted or the stream ended. - Agent hooks return a block decision to the agent, which shows the reason.
- The browser extension refuses the prompt in the chat page or redacts it there.
- A redact rule rewrites only the matched content, for example to
[REDACTED].
MCP tool results
On the Netzilo client and the AI Gateway alike, guardrails judge an MCP call's arguments and its result. Every text in a result that the model or the user can read is judged as a text of its own: each text item, the text of an embedded resource, a resource of a text type sent encoded, a link to a resource, and every text value in structured content. Images, audio and binary data are not judged. A redaction is written back where it came from, so the result keeps its shape, its error flag and its structured content. If a result cannot be rebuilt after the guardrails, the call is refused rather than passed on unchecked. A rule matches within one text, so write a pattern for what one text holds.
Files
A refused file is named in the refusal: Netzilo Guardrail: <file name>: <reason>, for
example Netzilo Guardrail: account_statement.pdf: financial records, not development material. Claude Code shows it as API Error: 400 Netzilo Guardrail: …. The conversation can
go on: the next message is sent with the file replaced by [removed by Netzilo Guardrail].
Sending the same file again with the same request is refused again. A redacted file reaches
the model rewritten, and the user sees nothing.
Events
Every verdict is an event in Activity > Events, category AI Edge: AI blocked, AI redacted, AI redirected or AI detected (a match in report mode). Allowed calls are not events; they are in the session. Each names the rule, the filter, the surface, the agent, model or tool, and the source: the client, a hook, the extension or the gateway. See Event reference.
Guardrails that apply response actions
A guardrail can do more than decide one call: it can apply a response action to the whole AI session, so that Netzilo responds on its own, in seconds. Cruise Control Inspection places a session that Cruise Control Patrol flags Under Inspection, and Cruise Control Containment isolates a session Under Inspection when Cruise Control Gate blocks another of its tool calls.
- The action applies on every host that carries the session: the device, the AI Gateway and the browser.
- On the Actions tab, Applied by shows Guardrail and the guardrail's name, and Activity > Events records Response action applied by a guardrail.
- An action an administrator lifted is not applied again by the same guardrail for that session. Actions applied by guardrails expire after 7 days.
- These guardrails declare
controlsinrequires:and load only on hosts that support response actions.
To write one, use session_control() and raise_control(), see
Detection Rules.
Roll out a guardrail
- Draft in report mode (
action: report), or have the AI Assistant write it, and review it. Replay it over recorded sessions. - Test it on a test device or user, see Test a guardrail.
- Pilot: bind it in a filter for a small group, an endpoint filter for devices or a gateway filter for gateway users. Run it for one or two weeks and review the AI detected events and the AI Agent Activity report.
- Tighten: add exclusions and anchors, then switch to
blockorredact. - Widen the filter's groups.
- Review monthly: AI blocked volumes per rule, on the Dashboard's agentic activity cards and in Activity filtered by AI blocked. Retire noisy rules.
Troubleshooting
The rule is saved but never fires. It is not bound (Used by shows No Filters), the
filter does not match the device or user, the logsource.category does not match where the
content is, it is bound in a gateway filter but needs process, file or connect activity, or a
more severe rule already blocks the same events. Test it in report mode, see
Test a guardrail.
The host reports the rule as failed. The Netzilo client logs Failed rules: [<id>], the
browser extension lists failed rules by name in its popup, and the gateway logs the number of
failed rules in its policy line. The YAML does not parse, or a |re pattern does not compile as
RE2. Fix the rule and save; check the next rule load.
It fires far too often. The contains values are too broad. Add an exclusion selection and
run it in report mode until it is quiet.
The redaction is not visible. Redaction replaces matched content only. A streamed answer at the gateway can only be blocked. An old client or extension may still render the original text: compare the event's content and update the host.
The event names a different rule than the one you expected. The event names the most severe
match across all filters. Correct the level values or narrow the other rule; reordering has no
effect.
scan rules slow the agent down. Classifier or AI-judge calls take time, with a 15-second
timeout on devices and gateways. Narrow the detection first and use on_timeout: report.
The editor does not accept typing, and Save and Replay are greyed out. The AI Assistant is answering. Wait for it, or press Esc to stop it.
The AI Assistant panel is missing. No model is approved for Assistant under Integrations > Artificial Intelligence, or you are not an administrator.
A filter fails to save with guardrail <id> does not exist. The guardrail was deleted through
the API while the filter still named it. Remove it from the filter.
Things to know
- No version history. Keep your rules in your own version control.
- No per-group exemption inside a rule. A rule has no group field. Exempt people with filters.
- Gateway coverage. The gateway scans only some of its API surfaces, see AI Gateway.
- Files at the gateway only. Files are judged as files only at the AI Gateway, and only when the client sends them as files. A PDF cannot be redacted in place, and a file the gateway cannot read in time is sent unread (see AI Gateway).
- No per-rule timing. No overhead figure or per-rule timing is shown. When AI tools feel slow, narrow the rules and move expensive ones to report mode.
- API. Guardrails are managed at
/api/edge/guardrails; the older path/api/edge/scannersanswers the same. Replays run atPOST /api/aidr/replay, which takes any number of sessions and guardrails; keep runs small. See the API reference.
Related Documentation
- Detection Rules - the full rule language, actions and scripting
- Filters - bind guardrails to devices, browsers and gateway users
- Response Actions - isolate or inspect sessions, by hand or autonomously
- Behavior Graph & Kill Chains - what a device records
- AI Gateway - where gateway-bound guardrails run
- Browser Extension - where Browser-OS guardrails run
- Artificial Intelligence - approve a model for Assistant and Threat Analysis
- AI Agent Activity - review detections and blocks

