Skip to content
AI Portal Docs
On this page Rules 1/16

An organisation has one guardrailGuardrailGuardrailA safety check on what goes into and comes out of a model — for example blocking harmful content or sensitive data. Admins set it for the organisation.Open in glossary policy; departments and agents carry none. The policy is off until an administrator switches it on under Guardrails in the Admin console, which needs org.settings.manage.

Key rules

  1. One policy per organisation. Departments and agents have no guardrails of their own.
  2. Text is checked once, where it first enters a conversation. What is stored is what the model saw.
  3. A masked value is kept nowhere. It is replaced by its subject in brackets, such as [EMAIL].
  4. The strongest action wins. Block beats mask, mask beats flag — across every rule and both engines.
  5. A finding never holds the matched text. It names the checkpoint, kind, subject and action only.

Rules

A rule names what to catch, where to look for it, and what to do when it is found.

PartValues
KindPersonal data, topic, harmful content, prompt attack
SubjectOne identifier type, one named topic, one content category, or the single prompt-attack subject
ActionBlock, mask or flag. Only personal data can be masked
CheckpointsAny of messages, tool results, documents and answers
  • A new rule is checked at all four checkpoints — except a prompt attack, which is checked in tool results and documents only, because the same instruction is harmless in the person’s own message.
  • A topic carries a definition and up to five example phrases.

Checkpoints

Each checkpoint sees text at the moment it enters the conversation.

CheckpointCheckedBlockMaskFlag
MessagesBefore a turn opens, and when a message is written into a running turnThe turn fails and no model call is made. The stored message has every value a block or mask rule matched replaced by its subject; later turns never replay it. A blocked message sent mid-turn is refused and not storedThe masked message is stored and sentRecorded
Tool resultsAfter a tool whose output comes from outside the portal returns: web search and reading, MCP applications, custom functions, the code sandboxThe call fails with the reason, and the model carries onThe model and the transcript get the masked resultA prompt attack is passed with a note telling the model to read it as data
DocumentsDuring ingest, on each section before it is cut into passagesThe section is left out of the index and counted on the documentThe section is stored and embedded masked; a table’s header row is checked again on its own, since every chunk of the table repeats itA prompt attack is stored with the same note at its head
AnswersWhile the answer streamsWhat was already shown stays; the turn stops. Later turns still replay its questionThe masked answer is shown, stored, and read by the model’s next callRecorded

What is not checked again as a tool result:

  • Knowledge search, document reads and attachment search — they return sections already checked at ingest.
  • The workspace — it holds files the agent wrote itself.

A document keeps the result it was indexed with. Changing a rule does not re-check indexed documents; re-processing a document applies the rules in force.

What the person sees

Mask chips. A masked value appears in the chat as a chip naming what it was, such as Bank account number, with a tooltip saying the organisation’s guardrails replaced it before it reached the AI.

  • In a message the person sent from the same browser tab, the chip shows and hides the value they typed: the tab keeps what it sent in memory and lines it up against the masked text.
  • After a reload, in another tab, or in an answer the model wrote, the chip has nothing to show — no copy of the value exists anywhere.

Findings lines. Every finding is listed under the message it was found in: what a rule found in the person’s message sits under the question that opened the turn; what it found in a tool result or the answer sits under the turn’s last answer. One line per action and checkpoint names the subjects:

  • Flagged — a flag changes nothing; its tooltip says the finding was recorded for review.
  • Masked before the AI read it
  • Masked in the answer
  • Masked in a tool result
  • Tool result withheld

Also:

  • Findings in a message written into a running turn are filed under the turn’s question.
  • A reload shows the same lines, because the transcript reads them back from the stored findings.
  • An engine that failed is not a finding.
  • A blocked message or answer gets no line. The turn ends on a card instead, drawn apart from an ordinary failure, naming what the rule blocked and what to do next.

How answers are checked

When every rule at the answers checkpoint only flags, the answer streams as usual and each finished block is checked afterwards.

When a rule there may block or mask, the answer is held back and released one check at a time:

  • Each check takes every sentence finished so far, up to a set window of characters — so text reaches the screen one sentence behind the model.
  • Sentences that finish while a check is out go into the next one, so a slower engine simply checks less often.
  • Text with no sentence end — such as a line closing on a colon before a tool call — is checked and released as soon as anything other than text arrives, so it always appears before the tool row that follows it.
  • A sentence end is a full stop, question mark, exclamation mark or ellipsis followed by white space, or a blank line. A single line break is not one, because it can separate a label such as Số tài khoản: from its number.
  • None of the identifiers a rule masks contains a sentence end, so a value is never split between two checks.

Engines

Each engine reports what it found; your organisation’s rules choose the action. The strongest action among the findings wins: block over mask over flag.

Pattern engineBedrock engine
RunsInside the backend, on every checkOnly when switched on in the policy (off for a new organisation)
CostNothingBilled by AWS per 1,000 characters for each policy it runs
SpeedRuns in-processAbout 0.7 seconds per call
CatchesVietnam identifiers and other personal data (below)Topics, harmful content, prompt attacks, and the personal data Bedrock recognises

Pattern engine

Detects, at no cost:

  • email addresses
  • Vietnamese mobile numbers
  • citizen ID numbers (CCCD)
  • tax codes — only with a keyword or a branch suffix, because a bare ten-digit number reads as a phone number
  • payment card numbers that pass the Luhn check
  • bank account numbers that follow a keyword such as STK or số tài khoản

Bedrock engine

Covers topics, harmful content, prompt attacks and the personal data BedrockAmazon BedrockAmazon BedrockAWS's model service, running in your account's region. The portal's models and embeddings come from here, always through LiteLLM.Open in glossary recognises: names, addresses, ages, passwords, usernames, IP addresses, web addresses, card numbers, IBANs and SWIFT codes. It runs in your organisation’s AWS region. Bedrock reports a personal-data value by its text, so every occurrence of that text in the checked passage is masked.

Every Bedrock filter runs in detect mode: Bedrock reports what it found and the portal’s rules decide what happens.

Running both engines

  • Every check runs the pattern engine.
  • With Bedrock off, no check calls Bedrock and nothing is billed. Rules only Bedrock can check are kept and skipped, and a rule for a Bedrock subject cannot be added.
  • Switching Bedrock on publishes your organisation’s Bedrock guardrail before the next check. Until its first version is published, the Bedrock engine checks nothing and the pattern engine runs alone.
  • With both running, the strongest action of either engine’s findings wins.
  • A sync with Bedrock that fails keeps the reason on the policy; the Guardrails page shows it with a retry.

Standard and Classic tiers

In regions starting us-, eu- and ap-, the guardrail uses Bedrock’s Standard tier through the matching cross-region profile, such as apac.guardrail.v1:0. Other regions fall back to the Classic tier, which reads only English, French and Spanish.

In testing, the Standard tier detected a salary topic, hate, violence, a prompt attack and a person’s name in Vietnamese phrases, and flagged neither of two ordinary questions.

AWS permissions

The role attached to the backend needs these grants, with <account-id> replaced by the deployment’s account:

IAM policy
{
  "Sid": "BedrockGuardrails",
  "Effect": "Allow",
  "Action": [
    "bedrock:CreateGuardrail",
    "bedrock:UpdateGuardrail",
    "bedrock:GetGuardrail",
    "bedrock:CreateGuardrailVersion",
    "bedrock:DeleteGuardrail",
    "bedrock:ApplyGuardrail"
  ],
  "Resource": [
    "arn:aws:bedrock:*:<account-id>:guardrail/*",
    "arn:aws:bedrock:*:<account-id>:guardrail-profile/*"
  ]
}

Cost

A Bedrock check is priced from the text units it reports, at AWS list prices:

PolicyPrice
Topics and content filters, prompt attacks included0.15 USD per 1,000 units
Personal data0.10 USD per 1,000 units

Each check that cost anything is added to a daily charge for the person and the department the check ran for — whether or not it found anything.

When a check fails

A check that cannot run is retried once. What happens next is your policy’s choice:

  • Blocked (the default) refuses the text. A refused message or answer fails its turn, and a refused document section fails the ingest — which runs again rather than landing a document with nothing indexed.
  • Allowed lets the text through and records the failure.

Records of findings

Every finding a rule matched writes one record, and every failed check writes one more. A record names:

  • the organisation, department and person
  • the checkpoint, kind, subject, action and engine
  • what was checked: the turn, the tool call or the document

It never holds the text that matched, and records are append-only. The Guardrails tab of the audit log lists them. A message refused before its turn opened also leaves a model-call record with the admission BLOCKED_GUARDRAIL — see Audit and cost tracking.

Why it works this way

Why check text only once, where it enters?

What is stored is exactly what the model saw. Knowledge search, document reads and attachment search return sections that were already checked at ingest, and the workspace holds only files the agent wrote, so none of them is checked again as a tool result.

Why are prompt attacks not checked in the person's own message?

An instruction such as “ignore your previous instructions” is harmless when the person types it — they are the one giving instructions. The same text inside a web page, a tool result or a document is an attack on the agent, so that is where the rule looks.

Why is the answer released a sentence at a time?

A mask or block rule has to see a value whole before the person does. Cutting at sentence ends keeps every identifier inside one check, and sentences that finish while a check is out simply join the next one, so a slower engine checks less often.

Under the hood

Turn failure codes
CodeWhen
guardrail_blockedA message was blocked before its turn opened
guardrail_blocked_outputAn answer was blocked while streaming
guardrail_unavailableA check on a message could not run and the policy refuses on failure
guardrail_unavailable_outputA check on an answer could not run and the policy refuses on failure
Settings and storage
NameWhat it is
GUARDRAIL_OUTPUT_WINDOWWindow, in characters, within which an answer check cuts at the last sentence end
usage.guardrail_eventsOne append-only row per finding and per failed check
usage.guardrail_chargesDaily Bedrock charge per person and department
Live findings in the stream

While a turn runs, the stream carries a guardrail frame for each check that found something. The backend writes one for the person’s message before the agent starts; the agent runtime writes one after each tool result or answer check. Neither frame is stored: the transcript reads every turn’s findings from usage.guardrail_events, by turn. A check records the turn and not the message, which is why findings in a message written mid-turn are filed under the turn’s question.

How the Bedrock guardrail is kept in step
  • The backend calls ApplyGuardrail directly with the AWS SDK, with source OUTPUT for answers and INPUT everywhere else.
  • Each organisation has one Bedrock guardrail named portal-<organisation id>, which the backend creates and keeps in step with the rules Bedrock handles.
  • Adding or removing such a rule updates the guardrail and publishes a new version; the policy points at that version once it is ready, and the previous version is deleted. Changing a rule’s action or checkpoints changes nothing in Bedrock and publishes nothing.
  • A topic reaches Bedrock under a name derived from a hash of the portal’s topic name, because Bedrock accepts only ASCII letters, digits and a few signs in a topic name. The definition and examples travel as written.
  • The backend also syncs every organisation with rules when it starts.
AI Portal Docs
EN VI