Agent Guardrails
Every turn of the on-page agent passes through a set of guardrails. They protect the agent against prompt injection, tool abuse and data exfiltration, whether the attempt comes from a visitor, a page, a remote agent or a tool result.
- On by default. You don't add anything:
<nxis-agent>and the headless harness both run the standard preset. - Loaded separately. The guardrails are their own entry point,
@nxisai/agent-harness/guardrails, fetched when the chat is first opened or the first message is sent. A turn waits for them. - Fail closed. If the guardrails can't load, no turn runs and nothing is sent, to the model or to a remote agent.
The guardrails are available from @nxisai/agent-harness 0.13.0.
What they are, and what they aren't
Screening is a signal, not a boundary. Matching phrases catches the obvious attempts. Paraphrases, other languages and other encodings get past it, so nothing important depends on it.
What enforces is code outside the model:
- Data blocks. Untrusted text reaches the model only as labeled data, never as instructions.
- Tool tiers. Code, not the model, decides how risky a tool is and whether the visitor has to confirm it.
- Approvals bound to the call. A confirmation covers one tool, with those exact values, in that conversation, once.
- Link and handoff rules. Code decides where the agent may send the visitor and what leaves the page.
The model never decides its own permissions.
The guardrails decide what the agent attempts. They run in the visitor's browser, and a visitor can call your forms and endpoints without the agent at all. Your server must still check every request: who is asking, whether they may do it, and whether the values are valid.
Where they sit in a turn
Each check belongs to a stage. The stage is the first part of every rule's name, such as tool/tier.
| Stage | Runs | Checks |
|---|---|---|
input | Before a message reaches the model or a remote agent | Length, send rate, invisible characters, injection phrases |
context | Each time the model is asked | Untrusted text is put in data blocks and screened |
model | Each time the model is asked | The turn's generation and token budget |
tool | Before a tool call is shown or run, and again just before it runs | Lists, risk tier, approval, arguments, limits, timeout |
output | On the model's reply, and before a link opens | Canary, secrets, length, navigation, exfiltration URLs |
handoff | Before a handoff is shown to the visitor | What the model wrote to send with it |
The defaults
These rules make up the standard preset. They follow two OWASP cheat sheets: the AI Agent Security Cheat Sheet and the LLM Prompt Injection Prevention Cheat Sheet.
Untrusted content is data
| Rule | What it does |
|---|---|
| Data blocks (always on) | Tool results and failures, a remote agent's hand-back, session errors, the visitor's saved details and tool descriptions reach the model only inside delimited data blocks. The delimiter is random and new for each conversation, and text that contains it is escaped, so it can't close its block early. The system prompt says that a block's contents are information, never instructions. |
| Untrusted labels (always on) | Results from a remote MCP server, from your site's actions, and from any tool that declares untrustedContentHint are also labeled untrusted. |
context/injection-phrases | Flags injection phrases in untrusted text as it arrives. |
Tools
Every tool gets a risk tier, assigned by code from what the tool declares and where it came from:
| Tier | Which tools | What it requires |
|---|---|---|
low | A read (readOnlyHint) registered by the page itself | Runs without review |
medium | A read from a remote MCP server or your site's actions, or one that declares untrustedContentHint | Runs, and is reported as a tool/tier flag |
high | A write, a tool with no annotations, or a tool nothing is known about | The visitor confirms it first |
critical | A tool with destructiveHint or consequentialHint; a write whose name says it pays or changes an account (checkout, refund, delete_account, update_password); every handoff | The visitor confirms it first |
| Rule | What it does |
|---|---|
tool/tier | Applies the tiers above. A tool that says nothing about itself is treated as a write. It can't be turned off. |
tool/approval | The visitor's press approves one call: that tool, with those exact values, in that conversation. The approval is single-use, lasts 2 minutes, and is checked and used up just before the call runs. An approval for other values, a used one or an expired one doesn't count. |
tool/policy | A tool whose tier can't be worked out is refused, and so is a tool name the model makes up that no page has registered. |
tool/not-listed | With tools.allow or tools.deny set, a tool the lists leave out is never offered to the model and never run. |
tool/arg-secret, tool/arg-size | Refuses a call whose arguments hold something that looks like a password, a key or a token, or whose arguments are over 10,000 characters as JSON. |
tool/arg-encoded | Flags arguments that carry a long Base64 or hex blob. |
tool/per-turn, tool/per-minute | 3 tool calls a turn, and 30 a minute for each conversation. |
tool/failures | 5 failed calls in a row stop the rest of the turn's calls. |
tool/timeout | The turn stops waiting for a call after 20 seconds. |
model/budget | A turn ends after 8 generations or 16,000 output tokens, where the model provider reports them. |
Input
| Rule | What it does |
|---|---|
input/length | Refuses a message over 4,000 characters. |
input/rate | 10 sends a minute for each conversation. Messages typed to a remote agent during a handoff count too. |
input/invisible-characters | Flags zero-width, bidirectional-control and Unicode tag characters. |
input/injection-phrases | Flags phrases that try to override the agent's instructions or reveal its prompt, in English, Spanish, French and German. It also checks what Base64 and hex in the message decode to. |
Screening runs on a normalized copy of the message. The visitor's text is never changed. A flagged message still goes through, and counts twice toward the send rate.
Output
| Rule | What it does |
|---|---|
output/canary | Each conversation's system prompt carries a private marker. A reply or tool call that contains it is blocked, and it never streams to the screen. This catches a reply that leaks the system prompt. |
output/secret | Blocks a reply that holds something that looks like a key, a token or a password. |
output/redact | Replaces matches of your own output.redact patterns with [redacted]. |
output/length | Cuts a reply over 8,000 characters. |
output/navigation | The agent may open your page's own origin, and the origins in link-origins, without asking. Any other origin is confirmed with the visitor first. Anything but http: or https: never opens. |
output/exfiltration-url | Flags a URL whose query, fragment or path carries a long encoded or high-entropy value. |
Handoff
| Rule | What it does |
|---|---|
handoff/secret | Replaces secret-looking text in the reason and summary the model wrote with [withheld], before the visitor sees them and so before they leave the page. |
| Always confirmed | A handoff is always critical, whatever tier you set for it. The visitor sees who the conversation goes to and what goes with it, and presses Send. |
| Hand-backs are data | What a remote agent says when it hands back reaches the model in a data block, like a tool result. It can't make a tool run outside the tier rules. |
A2A Setup covers the handoff itself: the relay, the targets and what each one receives.
The strict preset
For regulated sites, turn on the strict preset with the attribute or the property:
<nxis-agent guardrails="strict"></nxis-agent>
agent.guardrails = { preset: 'strict' };
Strict changes three behaviors:
- Input screening blocks instead of flagging. A message with invisible characters or an injection phrase is refused.
mediumtools need the visitor's confirmation too.- Remote MCP tools are off unless
tools.allowlists the tools you want.
It also tightens every limit:
| Limit | Standard | Strict |
|---|---|---|
| Message length | 4,000 characters | 2,000 characters |
| Sends a minute | 10 | 6 |
| Tool calls a turn | 3 | 2 |
| Tool calls a minute | 30 | 15 |
| Tool call timeout | 20 s | 15 s |
| Failed calls in a row | 5 | 3 |
| Tool arguments | 10,000 characters | 4,000 characters |
| Reply length | 8,000 characters | 4,000 characters |
| Generations a turn | 8 | 6 |
| Output tokens a turn | 16,000 | 8,000 |
| How long an approval lasts | 2 minutes | 1 minute |
A preset in the guardrails property wins over the attribute.
Configuring
Set agent.guardrails to change the defaults. Every field is optional.
import type { GuardrailsConfig, GuardrailRule, Verdict } from '@nxisai/agent-harness/guardrails';
const noRivalLinks: GuardrailRule = {
id: 'acme/no-competitor-links',
stage: 'output', // 'input' | 'context' | 'tool' | 'output' | 'handoff'
check: ({ text }): Verdict => (/rival\.example/.test(text) ? { action: 'block' } : { action: 'allow' }),
};
agent.guardrails = {
preset: 'standard', // or 'strict'
input: { maxLength: 4000, sendsPerMinute: 10 },
tools: {
allow: ['search_*', 'book_appointment'], // optional allowlist; deny wins
deny: ['delete_*'],
tier: { book_appointment: 'high', check_availability: 'low' },
maxPerTurn: 3, perMinute: 30, timeoutMs: 20_000,
},
output: { redact: [/\bACCT-\d{8}\b/g], maxLength: 8000 },
handoff: { screenSummary: true },
rules: [noRivalLinks],
classifier: async ({ stage, text }) => ({ action: (await myGuard(text)) ? 'block' : 'allow' }),
overrides: { 'input/injection-phrases': 'off' },
onDecision: (d) => analytics.track('guardrail', d),
};
The configuration is read live: a change applies from the next check, for every agent on the element, and each conversation keeps its counters and approvals. Assigning an object merges its top-level fields over what you set before, so a new tools replaces the old tools as a whole. Assign null to go back to the defaults, which also lifts a lockdown.
| Option | Purpose |
|---|---|
preset | 'standard' (the default) or 'strict'. |
input.maxLength, input.sendsPerMinute | The message length cap and the send rate. |
tools.allow, tools.deny | Tool names, where * matches anything. With allow set, a tool not on it is never offered or run. deny wins over allow. |
tools.tier | Your own tier for a tool, by name (* matches anything). It wins over what the tool declares, with two exceptions: a handoff is always critical, and a tool the defaults make critical (destructive, consequential, a payment or an account change) can't go below high, so the visitor always confirms it. A value that isn't a tier refuses the tool. |
tools.maxPerTurn, tools.perMinute, tools.timeoutMs | The tool limits. |
output.maxLength, output.redact | The reply length cap, and extra patterns to replace with [redacted]. |
output.linkOrigins | For headless use: the origins the agent may open without asking. The element reads its link-origins attribute. |
handoff.screenSummary | false stops withholding secret-looking text in a handoff's reason and summary. Defaults to true. |
rules | Your own rules. See Custom rules. |
classifier | Your own model-based guard. See A classifier. |
overrides | Built-in rules turned off by name. See Overrides. |
onDecision | Called with every decision except allow. See Observing decisions. |
locked | The kill switch's state. See The kill switch. |
Custom rules
A rule has an id (its name in events), a stage and a check. Rules run in order, after the built-in rules of their stage. check can be synchronous or async, and receives:
| Field | Value |
|---|---|
stage | The stage the rule is running at. |
text | The text at hand: the visitor's message, a reply, untrusted data, or a handoff's reason and summary. Empty for a tool call. |
tool, args, tier | The tool's name, its arguments and its risk tier, at the tool and handoff stages. |
It returns a Verdict: { action, reason? }, where action is 'allow', 'flag', 'confirm' or 'block'. reason is for your own logs and is never put in an event.
Rules can only tighten. allow leaves the built-in decision as it was; a rule can't approve something a built-in rule refused.
| Verdict | Effect |
|---|---|
flag | Reported, and nothing else changes. |
confirm | At the tool and handoff stages, the call needs the visitor's approval. At the output stage, the reply is blocked. At the input and context stages there's nothing to confirm, so it's reported like flag. |
block | The message, call or reply is refused. A context rule that blocks keeps that text from the model. |
A rule that throws, or takes longer than 5 seconds, fails closed at the tool and handoff stages (the call is refused) and fails open, with an event, at the others.
A classifier
classifier is a function with the same signature as a rule's check. It's asked at the input and output stages, after your rules, and reported under the rule name classifier. Use it to call a model-based guard that you host. None ships with the package. Like a rule at those stages, a classifier that throws or takes longer than 5 seconds fails open, with an event.
Overrides
overrides turns a built-in rule off by its name:
agent.guardrails = { overrides: { 'input/injection-phrases': 'off' } };
Only the value 'off' turns a rule off. Each rule you turn off is logged once per page with console.warn, so loosening is always visible.
These checks can't be turned off: tool/tier, tool/approval, tool/policy, tool/not-listed and the kill switch (tool/lockdown, input/lockdown). Data blocks have no override either. An override of one of them is ignored, and the warning says so: [nxis-guardrails] override: tool/tier can't be turned off; ignored.
So no override removes the confirmation and the approval for a high or critical tool or a handoff. To change how one tool is treated, set its tier with tools.tier.
Observing decisions
Every decision except allow is reported twice: as an nxis-guardrail event on the element, and to onDecision. The event bubbles and crosses the shadow boundary, so you can listen on document.
agent.addEventListener('nxis-guardrail', (e) => {
const { stage, rule, action, severity, tool, tier } = e.detail;
analytics.track('guardrail', e.detail);
});
| Field | Values |
|---|---|
stage | input, context, model, tool, output or handoff |
rule | A built-in rule as <stage>/<name>, such as tool/tier; your own rule's id; or classifier |
action | flag, block, confirm or rewrite |
severity | info, warning or critical |
tool | The tool's name, when the decision is about one |
tier | That tool's risk tier, when one was assigned |
The payload never carries what the visitor wrote, what a tool returned, or a tool's arguments. It says only which rule decided what, and where. That makes it safe to send to your analytics.
An onDecision callback that throws doesn't stop the turn.
debug. With the element's debug attribute or property on, each decision is also drawn as a line in the thread, such as guardrail · tool/tier → confirm (book_appointment, high). Use it while developing, not in production.
The kill switch
lockdown turns off the agent's tools, or the whole agent, at once. Use it from your remote config or during an incident.
agent.guardrails.lockdown('incident 42'); // tools off (the default scope)
agent.guardrails.lockdown('incident 42', 'tools'); // the same
agent.guardrails.lockdown('incident 42', 'agent'); // the whole agent off
agent.guardrails.locked = null; // lift it
| Scope | Effect | The visitor reads |
|---|---|---|
'tools' | No tool is offered to the model, and any tool call is refused. The agent can still talk. | "I can't take actions right now, but I can still answer questions." |
'agent' | Every message is refused as well. | "The assistant isn't available right now. Please try again later." |
The reason is for your own logs. lockdown is always present on agent.guardrails, and works before the guardrails have loaded. You can also set the state directly, for example from a config you fetch:
agent.guardrails = { locked: { reason: 'incident 42', scope: 'tools' } };
The kill switch can't be turned off with overrides.
Enforcing at the model proxy
The guardrails above run in the visitor's browser, and a visitor who controls their browser can skip them. If your agent uses a remote model through createProxyProvider, your model proxy is the one point on the agent's path that you control and the visitor doesn't. Give the proxy a guardrails policy, and it enforces the guardrails on every request too. You can change the policy without redeploying your site.
With the default on-device model, the conversation never leaves the visitor's device, so there's no proxy and nothing in this section applies. The browser guardrails are all there is. Keep sensitive actions behind your own server checks, as you should anyway.
What the proxy enforces, and what stays in the browser
| At the proxy, on every request | Only in the browser |
|---|---|
| Message length | Confirmations, and the approval bound to each call |
| Send rate, per conversation and per visitor | Confirming a link to another site |
| Generations and output tokens, per turn and per conversation | Screening what the visitor typed, and tool results |
| Which tools a request may declare (your allow and deny lists), and that a reply only calls a declared tool | Tool tiers, which decide what the visitor confirms |
| The kill switch: tools off, or the whole agent off | Your own custom rules and classifier |
| The reply, checked as it streams for the private marker and for secrets, and cut before it's sent | Cutting long replies, and your output.redact patterns |
| The system prompt, if you keep it at the proxy |
The proxy can't see the visitor's click, so confirmations stay in the browser. What it does is refuse anything the policy doesn't allow before your model is called, so a script that skips the page can't run up your bill or reach a tool you haven't allowed.
The policy document
The policy is a JSON document with a version. Every field except schema and version is optional:
{
"schema": 1,
"version": "2026-11-10.1",
"preset": "standard",
"input": { "maxLength": 2000, "sendsPerMinute": 8 },
"tools": { "deny": ["delete_*"], "tier": { "book_appointment": "critical" } },
"model": { "maxSteps": 6, "maxTokens": 8000 },
"conversation": { "maxGenerations": 80, "maxOutputTokens": 60000 },
"output": { "maxLength": 6000, "linkOrigins": ["https://help.example.com"] },
"lockdown": null
}
| Field | What it does |
|---|---|
version | Any string that changes when the policy does. |
preset | "strict" turns the strict preset on. "standard" never turns it off. |
input | Message length, and sends a minute per conversation. |
tools | allow and deny lists (* matches anything), a minimum tier per tool, and the tool limits. |
model | Generations and output tokens per turn, enforced at the proxy. |
conversation | Generations and output tokens over a whole conversation, enforced at the proxy. |
output | Reply length, and linkOrigins, which narrows where links open without asking. |
overrides | Built-in rules turned off, as you could in code. The checks that can't be turned off stay on. |
lockdown | The kill switch: { "scope": "tools" } or { "scope": "agent" }, with a reason. |
systemPrompt | Optional: a system prompt the proxy keeps. See below. |
A policy can only tighten. The built-in defaults are the floor: a policy can lower a limit, add to the deny list, narrow the allow list and the link origins, raise a tool's tier, and turn on the strict preset or the kill switch. It can't raise a limit past the default or past your page's own setting, lower a tier, or lift a lockdown you set on the page. When the policy and the page disagree on a tool's tier, the stricter one wins. The approval, policy, list and lockdown checks can't be turned off by a policy any more than by overrides.
A document with a field in the wrong shape is refused as a whole, and the built-in defaults apply.
Changing it without a deploy
The proxy reads the policy from a store on your host on every request, so a change applies to the next request:
| Host | Where the policy lives |
|---|---|
| Netlify | Netlify Blobs: netlify blobs:set agent-guardrails policy --input guardrails.json |
| Vercel | Edge Config |
| Cloudflare | A KV namespace |
| Docker | A mounted file |
An environment variable works too, but on most hosts a changed variable only takes effect after a redeploy. The agent-model-proxy skill sets the proxy up for your host.
If the proxy can't read the policy, it enforces the built-in defaults. It never runs with no guardrails.
Setting it up
The agent-model-proxy skill adds the guardrails to the proxy it builds for your host. You need three things:
-
The policy, in your host's store from the table above. Start from a small one, such as a lower
input.maxLength, so you can see it work. -
A conversation secret of 32 characters or more, in your host's secret store, never in your repository:
openssl rand -base64 48The proxy signs each conversation's id with it, and counts the per-conversation limits by that id. Without a secret, every limit is counted by IP address and origin only.
-
GETallowed on the endpoint, since that's how the page reads its copy of the policy.
If you write your own proxy, @nxisai/agent-harness/policy exports what it needs: the policy parser, the presets and their limits, the allow and deny list check, and the secret patterns. Follow the proxy contract below.
The page reads a copy
Point the element at your proxy with guardrails-src:
<nxis-agent guardrails-src="/api/agent"></nxis-agent>
The page fetches a copy of the policy (without the system prompt), caches it, and merges it over its own configuration, tighten-only. Each request to the model carries the version the page holds, and when the proxy holds a newer one the page fetches it again. If the copy can't be fetched, the page runs with the built-in defaults, and the proxy still enforces the policy.
When the proxy refuses a request, the visitor reads the same message the page shows for the same rule, and the element raises the same nxis-guardrail event, with stage, rule, action and severity. Nothing the visitor wrote is in it.
A system prompt at the proxy (optional)
Put your prompt in the policy's systemPrompt, and the proxy uses it for every request and ignores any prompt a request carries. A visitor who edits the page's prompt in their browser changes nothing. The proxy adds its own private marker to catch a reply that leaks the prompt, and the copy the page reads never includes the prompt or the marker.
Keep the prompt on the page instead if:
- your agent runs on-device, since there's no proxy;
- your page runs several agents with their own prompts, since the proxy's prompt replaces all of them;
- the model should see the visitor's saved details, which the page puts in its own prompt. The page still fills forms from them either way.
Testing it locally
Run your site and its proxy on your host's local runtime, such as netlify dev, vercel dev, wrangler dev or docker compose up, with a policy in the local store. The first checks use curl and never reach the model, so they cost nothing. Replace the origin and port with your own, and the origin must be on your proxy's allowlist.
-
The page's copy.
GETthe endpoint. You get the policy back, with itsversionand withoutsystemPrompt:curl -s -H 'Origin: http://localhost:8888' http://localhost:8888/api/agent -
A refusal. Send a message longer than the policy's
input.maxLength. You get a413, a"rule": "input/length"refusal and anNxis-Guardrail: input/lengthheader:long=$(printf 'a%.0s' $(seq 1 3000))
curl -s -i -X POST -H 'Origin: http://localhost:8888' -H 'Content-Type: application/json' \
-d "{\"messages\":[{\"role\":\"user\",\"content\":\"$long\"}]}" \
http://localhost:8888/api/agent -
A change with no deploy. Lower
input.maxLengthin the store, changeversion, and send a shorter message. The next request is refused at the new limit, with no restart. -
The kill switch. Set
"lockdown": { "scope": "agent", "reason": "test" }and send any message. You get a503. Set it back tonullafterward. -
In the browser. Add
guardrails-src="/api/agent"anddebugto the element, and open the page. Repeat steps 2 to 4 from the chat. The visitor's message appears for each refusal, and the thread shows a guardrail line. To see that the proxy enforces the policy without the page's help, block the page'sGETin your browser's developer tools and send an over-length message: the page runs on the defaults, and the proxy still refuses.
Steps 1 to 4 need no model credential. Step 5 calls the model for each message the policy allows.
The proxy contract
What the page and the proxy send each other. You only need this if you write your own proxy.
GET the endpoint | The policy copy, without systemPrompt, with an ETag, Cache-Control: no-cache, and a 304 on If-None-Match. |
Request header Nxis-Conversation | The conversation id the proxy issued, sent back. Optional. |
Request header Nxis-Guardrails-Version | The policy version the page holds. Optional. |
Response header Nxis-Conversation | A new id, when the request had no valid one. |
Response header Nxis-Guardrails-Version | The current version, when it differs from the one the page sent. The page then fetches the copy again. |
| A refusal | { "error": "…", "refusal": { "stage", "rule", "action": "block", "severity" } } with an Nxis-Guardrail: <rule> header, and never the visitor's text. |
| Status | Rules |
|---|---|
413 | input/length |
429 | input/rate, model/budget |
403 | tool/not-listed |
422 | tool/policy, output/canary, output/secret |
503 | input/lockdown, tool/lockdown |
A proxy on another origin than the page must list the request headers in Access-Control-Allow-Headers, list the response headers in Access-Control-Expose-Headers, and allow GET.
Headless use
The headless harness takes the same configuration. As with the element, the guardrails are on with the standard preset when you pass nothing.
import { AgentHarness } from '@nxisai/agent-harness';
const guardrails = { preset: 'strict', output: { linkOrigins: ['https://help.example.com'] } };
const harness = new AgentHarness({ provider, renderer, guardrails });
There's no element to dispatch events on, so use onDecision. Harnesses given the same configuration object share its counters and approvals.
For a custom engine, createGuardrails builds the runtime that the harness uses:
import { createGuardrails } from '@nxisai/agent-harness/guardrails';
const guard = createGuardrails({ preset: 'strict' });
guard.lockdown('incident 42', 'agent');
The runtime exposes one method for each hook: input, tool, approve, exec, model and nav, with lockdown and counts(conversation), which returns how many flag, block, confirm and rewrite decisions a conversation has had. See Headless use on the On-Page Agent page for the harness itself.
What a visitor sees
Most turns look the same with the guardrails on. A visitor notices them in three places:
- A confirmation before a risky tool. A
highorcriticalcall is shown as an action card with what will be sent, and runs only when the visitor presses Send. A handoff is confirmed the same way. - A confirmation before a link to another site. Opening a card's link to an origin outside your page's own and
link-originsasks first: "Open help.example.org? It's another site, not this one." When the agent itself wants to open a page on another origin, the visitor confirms it on a card. - A short message when something is refused. The message says what happened, never which rule matched:
| The visitor reads | Rule |
|---|---|
| "That message is too long (over 4,000 characters). Please shorten it." | input/length |
| "You're sending messages quickly. Wait a moment, then try again." | input/rate |
| "I can't help with that here." | Input screening in strict, or your own rule or classifier |
| "I can't use that here." | tool/not-listed, a link that isn't http(s), or your own tool rule |
| "I can't tell how safe that is, so I won't do it." | tool/policy |
| "I picked an unknown tool (…). Try rephrasing." | tool/policy, for a tool name the model made up |
| "That needs your confirmation first." | tool/approval |
| "That looks like a password or a key, so I won't send it. Please don't share secrets here." | tool/arg-secret |
| "That's too much to send at once." | tool/arg-size |
| "That's as many steps as I can take for one message. What next?" | tool/per-turn |
| "I've done a lot in the last minute. Give it a moment, then try again." | tool/per-minute |
| "That keeps failing, so I stopped. What would you like to do instead?" | tool/failures |
| "That took too long (over 20 s), so I stopped waiting for it." | tool/timeout |
| "I've gone round too many times on this one. What next?" | model/budget |
| "I can't share that." | output/canary |
| "I can't show that reply: it looked like it held a password or a key." | output/secret |
| "The assistant isn't available right now. Please try again later." | The kill switch, for the whole agent (input/lockdown) |
| "I can't take actions right now, but I can still answer questions." | The kill switch, for tools only (tool/lockdown) |
Troubleshooting
- "The agent could not be downloaded. Check the connection and try again — nothing was lost." The model's files or the guardrails failed to load. Without the guardrails no turn runs. Check that your bundler or CDN serves the package's
guardrailsentry point and its chunks. - A read asks for confirmation. The tool has no
readOnlyHint, so it's treated as a write. Annotate the tool, or set its tier withtools.tier. - A read from your site's MCP server shows up as a
tool/tierflag. That's themediumtier: the call ran and was reported. In strict it's confirmed instead. - Remote MCP tools disappeared in strict. Strict turns them off until
tools.allowlists them, for exampleallow: ['nxis_*']. - A link asks before opening. Its origin isn't your page's own. Add it to
link-origins. - "That needs your confirmation first." The approval was used already, expired (2 minutes, 1 in strict), or the values changed after the visitor confirmed. The visitor confirms again.
- An honest message is flagged as an injection. Flags don't stop a message in the standard preset. To find which rule matched, listen for
nxis-guardrailor turn ondebug. - A valid value is refused as a secret. The patterns match common key and token formats and
password=…style pairs, so a value that only looks like one is refused. Collect such values in your own form rather than through the agent. console.warn:[nxis-guardrails] override: … is off. A built-in rule was turned off withoverrides. It's logged once per page for each rule.console.warn:[nxis-guardrails] override: … can't be turned off; ignored. The override names a check that always stays on. Remove it fromoverrides.- A policy change doesn't apply. Check that the store holds valid JSON with
schema: 1: a document with a field in the wrong shape is refused as a whole, the proxy logs it, and the built-in defaults apply. On hosts where the policy is an environment variable, a change needs a redeploy. - A policy setting has no effect. A policy can only tighten. A higher limit than the default or your page's own setting, a lower tier, or turning off a check that always stays on is ignored.
- The page never reads the policy. Check that
guardrails-srcpoints at the proxy and that the endpoint allowsGET. On another origin, check its CORS headers as the proxy contract says. The proxy still enforces the policy without the page's copy. - The per-conversation limits act per visitor instead. The proxy has no conversation secret, so it counts by IP address and origin. Add one of 32 characters or more.
- A destructive tool is still confirmed after you set its tier to
low. A tool the defaults makecriticalcan't go belowhigh. That's intended: the visitor confirms anything that deletes, pays or changes an account.
An adversarial test suite ships with the package. It covers prompt override, indirect injection, tool misuse, approval bypass and replay, cost loops, exfiltration and system-prompt extraction, each with benign controls.
Related
- On-Page Agent: mounting the element, its tools and models, and
createProxyProvider - A2A Setup: handoff, the relay and
link-origins - Support Agent: the screening the Support Agent runs for itself
- WebMCP: the page tools the agent calls