Skip to content
Agentic Workflowdocs
v0.9.0Install free

nodes / builtin / ai / aiagents

Guardrails

Validate text against policies using a model, and route to pass or fail

AI ExtensionWeb app

Ask a chat model whether a piece of text follows your rules, then send the data down a Pass or a Fail path.

New Guardrails steps (version 2) run quick checks first, with no AI and no network, then an optional AI policy:

  • Personal data: emails, phone numbers, IBANs, card numbers (checked with the Luhn rule), IPv4 addresses, and postal addresses (best effort).
  • Secrets: API keys and tokens, balanced or strict.
  • Links: only allowed sites and schemes, and no passwords inside URLs.
  • Patterns and keywords of your own.
  • AI policy (optional): the chat model in the Model slot judges the text against your policy and answers with { flagged, confidence, reason }. The step fails the text at or above the threshold. The text is sent fenced, with the instruction to judge it and never follow it, so a text can’t talk the model into passing it. An answer that can’t be read fails closed.

The Operation decides what happens:

  • Check: the data goes out of Pass, or out of Fail at the first finding, with what was found.
  • Clean up the text: findings are replaced with [EMAIL], [SECRET], [URL] or your label, and the cleaned text goes out of one Output. The AI policy, if on, only ever sees the cleaned text.

The model is only needed for the AI policy.

They send the Text and your Policy to the model, which answers passed or not, with a reason: Pass or Fail, failing closed. Update in the step’s header turns your policy into the AI policy check (failing above 0.7 confidence) and leaves the quick checks off, so results stay the same until you turn some on.

  • Check an AI-written reply before you post or send it (no personal data, no promises, stays on topic).
  • Screen text a user typed or selected before it reaches another AI step.
  • Stop a workflow when scraped content is off topic or unsafe.

To sort text into more than two groups, use Text Classifier. For a plain rule that needs no AI (a word is present, a number is above a limit), use If.

SettingTypeWhat it does
Text (required)Long textThe text to check (bind upstream data with {{ }}).
Policy (required)Long textDescribe what is allowed / disallowed (e.g. no PII, no profanity, must be on-topic about X).

Fill Text with an expression, for example {{ $input.response }} to check the reply of an earlier AI node.

Write Policy as clear, checkable rules, for example: No email addresses or phone numbers. No profanity. The text must be about our product's shipping times. Vague policies give inconsistent verdicts.

  • Pass
  • Fail

What comes out depends on whether something is connected to the node’s input:

  • With an incoming connection, the incoming items are passed on unchanged to Pass or Fail. The verdict’s reason is not added to them.
  • With nothing connected to the input, the node sends one item { text, passed, reason }, so you can read why the text failed.
SlotAcceptsConnections
Model (required)chat modelOne node.

Connect a chat model such as Chat OpenAI or Chat Anthropic. Guardrails has no credential of its own: the model node holds the API key.

  1. Get Selected Text reads the customer message you highlighted.
  2. Basic LLM Chain drafts a reply with Prompt Write a short, friendly reply to: {{ $input.text }}.
  3. Guardrails with Text {{ $input.response }} and Policy No refunds or discounts may be promised. No personal data., with an Chat OpenAI model on Model.
  4. From Pass, Clipboard Write copies the reply. From Fail, Show Notification tells you to write it by hand.
  • Everything goes out of Fail. The model probably adds text around its verdict, which counts as a failure. Use a stronger model, or make the policy shorter and more precise. Run the node with nothing connected to its input to see the reason.
  • “Dependency model is required”. Connect a chat model to the Model slot.
  • “Model not found”. The connected model node is not set up: open it and choose a model and its credential.
  • Verdicts change from run to run. The policy is open to interpretation. List concrete rules instead of general goals.
Edit page

Last updated:

Was this page useful?
Ask Aria about Guardrails