跳转到内容
Agentic Workflowdocs
v0.8.2免费安装

节点 / builtin / ai / aiagents

Guardrails

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

AI 扩展程序网页应用

此内容尚不支持你的语言。

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

Guardrails sends Text to the chat model connected to its Model slot, together with your Policy. The model must answer with a short verdict: passed or not, and a reason.

The node then routes the data:

  • When the text complies, the data goes out of Pass.
  • When it does not comply, it goes out of Fail.
  • When the model’s answer cannot be read as a verdict (extra commentary, broken JSON), the node fails closed: the data goes out of Fail. A guardrail never lets text through by accident.
  • 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.

设置项类型作用
Text (必填)Long textThe text to check (bind upstream data with {{ }}).
Policy (必填)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 (必填)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.
编辑此页

最近更新:

Was this page useful?
向 Aria 询问“Guardrails”