Guardrail Node
Learning to Use Nodes — Guardrail Node
The Guardrail node checks text against a policy. It handles items that can be checked quickly with regular expressions — forbidden keywords, secret keys, URL allowlists — together with items that need an LLM to judge, such as prompt injection, NSFW content, and topic drift, all in one node. The Guardrail node only judges; it doesn't modify the text, and branching on the result is handled by a Branch node.
In this tutorial, you'll build a customer support Ability that checks a customer inquiry with the Guardrail node, generates an LLM response for inquiries that pass, and blocks inquiries that violate policy with a notice message. Along the way, you'll see actual test results that show how regex checks and LLM-based checks behave differently.
Before You Begin
Before starting this tutorial, you need to create an Ability in your project and enter the Canvas. For instructions on entering the Canvas, see the 🔗3-Step Core Guide.
After completing this tutorial, you will be able to:
Configure the Guardrail node's
Checksto combine regex checks with LLM-based checks.Understand the
Forbidden Keywords,Allowed Topic Scope,Judgment Threshold, andEvaluate Alloptions and set them for your use case.Branch on the Guardrail node's
passedoutput to handle the pass and violation paths differently.Read
violationsandshort_circuitedin the test results to see which checks ran and how.
Workflow Overview

The core of this tutorial is the Guardrail node.
The Guardrail node checks Text to check using the methods set in Checks. keywords, secret_keys, and url_allowlist run as regex, so they're free and instant. prompt_injection, nsfw, topical, and custom are judged by the model connected through the LLM Model edge. The result is returned as passed (whether it passed) and violations (the list of violation details). By default, once a regex check finds a violation, the remaining checks are skipped and the node returns immediately (short_circuited).
The nodes that appear alongside it work as follows:
Guardrail LLM: the dedicated model that performs the Guardrail node's LLM-based checks. For detailed settings, see the 🔗LLM Node document.Pass / Violation Branch: splits the flow in two based on the Guardrail Check'spassedvalue.Customer Service Response: an LLM generates a response from the text that passed. See the 🔗LLM Node document.Block Message Setup: stores a notice message in an Ability Variable when there's a violation. See the 🔗Set Value Node document.Merge Response: combines the results of the pass path and the violation path into one. See the 🔗Merge Node document.
Guardrail Node Basic Info
The Guardrail node provides the following fields and options.
Field/Option | Required | Description |
|---|---|---|
| Required | The text to check for policy violations. |
| Required | Add one or more of |
| Optional | For the |
| Optional | For the |
| Optional | An LLM check at or above this score is confirmed as a violation (0.0–1.0). |
| Optional | When on, the LLM checks still run even after a regex check has already failed (more cost and latency, but |
| Optional | Connects the model used for the |
Its outputs are passed (whether it passed), violations (the list of violations, each with name, score, and reason), short_circuited (whether a regex violation caused the remaining checks to be skipped), and checked_text (the actual text that was checked).
In this tutorial, you'll set Text to check, Checks, Banned keywords, Allowed topic scope, and Decision threshold, and leave Evaluate all checks at its default, Off.
Step 1: Configure the Start Node

Double-click Start Node to enter the Node Editor, and rename it User Input. Add a String input variable named user_text. This variable holds the user input text that the Guardrail Check will examine.
Step 2: Add the Guardrail Node
Click +Add Node → add a Guardrail node from the Security / Privacy category, rename it Guardrail Check, and double-click it to open the Node Editor.
Step 3: Configure the Guardrail Node

Drag and drop
user_textfrom the Start Node ontoText to check.Add all four values —
keywords,nsfw,prompt_injection,topical— toChecks. This example combines a regex check (keywords) with LLM-based checks (nsfw,prompt_injection,topical).Under
Optional Variables, addbomb,hacking,illegal, anddrugstoBanned keywords.Set
Allowed topic scopeto "Customer service and product inquiries." Thetopicalcheck treats text outside this scope as a violation.Keep
Decision thresholdat0.7.Keep
Evaluate all checksat its default, Off. In this example, once a regex check finds a violation, the LLM checks are skipped and the node returns immediately.
The LLM Model edge port needs an LLM node connected to run the prompt_injection, nsfw, and topical checks. Click +Add Node to place an LLM node, rename it Guardrail LLM, and connect it to the Guardrail Check node through the LLM Model edge.
Note — Leave the prompts empty on the node connected through the LLM Model edge
Step 4: Add and Configure the Pass / Violation Branch Node

Click +Add Node to place a Branch node on the canvas, rename it Pass / Violation Branch, and connect it after the Guardrail Check node. Double-click it to open the Node Editor.
Drag and drop
passedfrom the Guardrail Check node onto the condition, and set it topassed == true.Anything that doesn't match flows into the
Elsebranch.
Step 5: Add and Connect the Customer Service Response Node

Click +Add Node to place an LLM node, rename it Customer Service Response, and connect it to the Branch node's pass pin.
For
System Prompt, write the customer service agent role and response guidelines. This tutorial starts with "You are a friendly customer service representative. Please respond to customer inquiries sincerely and concisely," and adds guidelines such as using Markdown formatting and keeping answers concise but complete.Drag and drop
checked_textfrom the Guardrail Check node ontoUser Prompt. The key point is passing the text the Guardrail node actually checked, not the originaluser_text.Select a model that fits your needs. This tutorial uses
Anthropic-claude-4.5-sonnet V1, a maximum token count of1024, and aSampling Temperatureof0.7.
Step 6: Add and Connect the Block Message Setup Node

First, add a String Ability Variable named block_message under the Global Variable tab. Then click +Add Node to place a Set Value node, rename it Block Message Setup, and connect it to the Branch node's Else pin.
Select
block_messageforGlobal Variable.Enter
'We apologize, but your request violates our service policy and cannot be processed.'forValue.
Step 7: Configure the Merge Response and End Nodes

Click +Add Node to place a Merge node, rename it Merge Response, and connect it after both the Customer Service Response node and the Block Message Setup node. Drag and drop output from Customer Service Response and the block_message Ability Variable onto Variables To Be Merged.

Double-click End Node to enter the Node Editor, and rename it Return Final Result. Add the output variables you want to check, and bind each one by drag and drop.
violations:violationsfrom the Guardrail Check nodepassed:passedfrom the Guardrail Check noderesult:mergedfrom the Merge Response node
Note — The number of items in the
resultarray can vary between runs
Step 8: Run the Test

Click RUN TEST and enter each of the two sentences below into user_text to check both the pass and violation paths.
Pass case
Output | Result |
|---|---|
|
|
|
|
| The LLM-generated order status response (asking for an order number and the email or phone number on the order) |
The Guardrail Check took 5.9 seconds. Since the regex check (keywords) found no violation, the prompt_injection, nsfw, and topical LLM checks all ran as well.
Violation case
Output | Result |
|---|---|
|
|
|
|
|
|
The Guardrail Check finished in 0.07 seconds. The banned keyword hacking was found immediately, short_circuited became true, and neither the remaining LLM checks nor the Customer Service Response node ran.
Next Steps
🎉 Congratulations! You've successfully built the "Guardrail Check" workflow using Agentria.
Place this node in front of any customer-facing chatbot or support workflow to filter out risks — forbidden words, prompt injection, off-topic requests — before the LLM generates a response. You can apply the same pattern of passing only verified text to the next node in other workflows too.
Agentria is a place where ideas become reality—your workflow can expand infinitely with your creativity.
For more node examples, visit the 🔗Node Usage page.
Frequently Asked Questions
What does the Guardrail node do?
The Guardrail node checks text against a policy. Forbidden keywords, secret keys, and URL allowlists are checked with regex, while prompt injection, NSFW content, and topic drift are judged by an LLM. It outputs the result as passed (whether it passed) and violations (the violation details), and it only judges — it doesn't modify the text itself.
When should I use the Guardrail node?
Use it whenever you want to filter risky content before passing untrusted text to an LLM, or before showing an LLM-generated response to a user. Common places include customer chatbots, public form input, and before or after an agent's tool calls.
How are regex checks different from LLM-based checks?
keywords, secret_keys, and url_allowlist run as regex, so they're judged instantly at no cost. prompt_injection, nsfw, topical, and custom are judged by the model connected through the LLM Model edge, which costs more time and money. With Evaluate all checks off (the default), the node skips the LLM checks and returns as soon as a regex check finds a violation.
Does the Guardrail node automatically block a request when it finds a violation?
No. The Guardrail node only judges — it doesn't branch on its own. Connect its passed output to a Branch node's condition and build the pass (true) and violation (false) paths yourself in the workflow.