Workflows
Guardrails in workflows
Check text for PII, prompt injection, toxicity, off-topic content, profanity or your own rules, and branch on Pass or Fail.
Guide2 min readUpdated 23 October 2026
A Guardrail check block tests text before it moves on: a customer's message before an agent sees it, or a draft reply before it is emailed. It has two exits, Pass and Fail, and passes on the reasons for a failure.
Built-in checks
| Check | What it catches | Uses a model |
|---|---|---|
| PII | Emails, phone numbers, card numbers (Luhn-checked) and common tax ID formats. Can redact them instead of failing. | No |
| Prompt injection | Attempts to override or reveal instructions | Yes |
| Toxicity | Abuse, harassment, threats, hate or explicit content | Yes |
| Off-topic | Anything outside a topic you describe | Yes |
| Profanity | Common swear words, from a word list | No |
Your own guardrails
The Guardrails page in the sidebar holds your own rules, usable from any Guardrail check block. Three kinds:
- AI rule: a plain-language rule a model judges, for example "Fails if the reply promises a refund".
- Regex: fails when the text matches a regular expression (300-character pattern limit, 0.25 s timeout).
- Blocked words: fails when any of the listed words appears.
An empty custom rule fails closed: it fails the check rather than letting text through unchecked.
Steps
- 1
Add your own rules (optional)
Open Guardrails in the sidebar and create a rule with a name, its kind and what fails it.
- 2
Add a Guardrail check block
In the workflow designer, drag Guardrail check from the AI group onto the canvas and pick an agent (its model judges the AI checks).
- 3
Choose the text and the checks
Set Text to check, for example
{{steps.agent_1.output}}, then tick the built-in checks and your own rules under Yours. - 4
Connect Pass and Fail
Connect Pass to the next step (for example Send email) and Fail to a fallback (for example a Slack message to a person).
- 5
Test both paths
Run a test with text that should pass and text that should fail, and check each run took the right exit.
You're done when
A test run with clean text goes down Pass, and a test with a phone number, a swear word or an off-topic question goes down Fail with the reason in the block's output.
Cost
A Guardrail check costs 1 credit only when an AI-judged check is selected (prompt injection, toxicity, off-topic or an AI rule). PII, profanity, regex and blocked-words checks are free.
If something goes wrong
A regex rule always fails
A pattern that times out or is invalid fails its check. Simplify it, keep it under 300 characters, and test it on the text from a past run.
Agents in chat aren't checked
Guardrail checks run inside workflows. Agents that use knowledge get a grounding instruction automatically; for other checks on chat, put the agent in a workflow with a Guardrail check block.
Still stuck?
Email us with what you tried and any request id. A person replies.