Guardrails
Check a piece of content against JSON, regex or your organization's DLP policy and branch on the result
The Guardrails block checks a piece of text and reports whether it passed. Use it as a gate in front of an LLM, in front of a downstream system, or before a human sees the content. The block never rewrites the text: it only answers pass or fail.
Configuration
- Validation Type — which check to run. Defaults to Validate JSON.
- Input — required. The content to validate. Type it, or reference an upstream value such as
<agent1.content>. - Regex Pattern — required, and shown only for Validate Regex.
Validation types
| Validation type | What it checks |
|---|---|
| Validate JSON | The input parses as JSON. The block checks that it is well-formed, not that it matches a schema. |
| Validate Regex | The input matches your pattern. The pattern is not anchored: it passes if the pattern matches anywhere in the input, so add ^ and $ to require a full match. |
| PII Detection | The input contains none of the sensitive data your organization's DLP policy looks for. |
PII Detection runs your organization's policy
PII Detection does not have its own settings. It runs the rules your organization administrators maintain under Settings → Governance → DLP, as a tool_call scan, and it passes only when no rule matches. A workflow cannot narrow, widen or replace that rule set. Entity lists, detection methods and PII actions saved on the block by older workflows are ignored.
The validation fails, rather than passes, when it cannot be evaluated: the organization policy is unavailable, the policy is disabled, or the policy does not scan the tool_call channel. In that case evaluated is false and error says why, so an outage never reads as "clean".
See Data loss prevention for how the organization policy is configured.
Regex safety limits
Before a pattern is used, it is checked. A pattern is refused, and the validation fails with passed: false and an error, when it:
- is empty;
- is longer than 512 characters;
- is not valid regular-expression syntax (the error carries the syntax error);
- is rated unsafe for matching, for example nested repetition that could take exponential time on crafted input.
Each case reports its own reason, so a typo is not reported as a security problem.
Inputs and outputs
| Field | Type | Description |
|---|---|---|
input (input) | string | Content to validate. |
regex (input) | string | Pattern for Validate Regex. |
passed (output) | boolean | true when the content passed the check. |
validationType (output) | string | json, regex or pii. |
error (output) | string | Why the check failed or could not run. Absent when the content passed. |
PII Detection adds these outputs:
| Field | Type | Description |
|---|---|---|
evaluated | boolean | false when the policy could not be applied. |
policyMode | string | The organization policy mode, or unavailable. |
findings | array | One entry per match: ruleId, entityType, detector, confidence, channel, and the character span start and end. The matched text itself is never returned. |
Branching on the result
A failed validation is a successful run with passed: false. The block does not stop the workflow and does not take an error path. Add a Condition block after it and branch on the result:
<guardrails1.passed>A block named Guardrails 1 is referenced as <guardrails1.passed>: whitespace is removed and the name is lowercased. Send the true branch onward and the false branch to a rejection, a retry or a human review. Use <guardrails1.error> in the rejection message when you want to show the reason.
If you do not add a Condition block, the workflow continues exactly as if the content had passed.
Hallucination checks are not available
The Guardrails block has no hallucination check: it was removed (the Model and Knowledge Base fields went with it), and Validation Type offers only PII, JSON and Regex. Do not rely on Guardrails as a grounding gate. To score an answer for quality, use the Evaluator block.
Example
Validate an LLM answer before it is returned:
- An Agent block named
Agent 1writes the answer. - A Guardrails block set to PII Detection takes
<agent1.content>as its input. - A Condition block tests
<guardrails1.passed>. When true, a Response block returns the answer; when false, the workflow sends the answer to a review step instead.