Skip to main content

Benchmark content safety guardrails with automated test suite & reports

Workflow preview

Workflow preview
100%
Benchmark content safety guardrails with automated test suite & reports preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

️ Evaluate Guardrails Node Accuracy with Automated Test Suite This workflow benchmarks the n8n Guardrails node across multiple safety categories including PII, NSFW, jailbreak attempts, secret ke...

Best for

  • Engineering automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.manualtrigger, n8n-nodes-base.splitinbatches, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.guardrails, n8n-nodes-base.code, n8n-nodes-base.merge, n8n-nodes-base.gmail, n8n-nodes-base.markdown

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Patrick Siewert.

Original n8n.io source

1.1 Workflow description

Title
Benchmark content safety guardrails with automated test suite & reports
Workflow name
Benchmark content safety guardrails with automated test suite & reports

🛡️ Evaluate Guardrails Node Accuracy with Automated Test Suite

This workflow benchmarks the n8n Guardrails node across multiple safety categories -including PII, NSFW, jailbreak attempts, secret keys, and unsafe URLs.
It runs 36 structured test cases, classifies each as PASS or VIOLATION, calculates accuracy metrics, and emails a detailed HTML report.

🔄 How it works

  1. The workflow loops through 36 predefined test prompts.
  2. Each prompt is checked by the Guardrails node for violations.
  3. Results are recorded as PASS or VIOLATION.
  4. The system calculates metrics (accuracy, precision, recall, F1).
  5. A formatted Markdown → HTML report is generated and sent via Gmail.

⚙️ Set up steps

  1. Add your OpenAI and Gmail credentials in n8n.
  2. Replace YOUR_MAIL_HERE in the Gmail node with your own address.
  3. (Optional) Change the model in the OpenAI Chat Model node.
    • Default: gpt-4o-mini
    • You can switch to gpt-5 or another available model if needed.
  4. Click Execute Workflow: test cases will run automatically.
  5. Check your inbox for the results.

🧠 Who it’s for

  • AI safety testers and workflow developers
  • n8n users experimenting with the Guardrails node
  • Teams validating LLM moderation, filtering, or compliance setups

🧩 Requirements

  • n8n v1.119+
  • Guardrails node enabled
  • OpenAI credentials (optional but recommended)
  • Email integration (Gmail or SendGrid)

💡 Why it’s useful

Use this test suite to understand how accurately the Guardrails node identifies unsafe content across different categories. The generated metrics help you fine-tune thresholds, compare models, and strengthen AI moderation workflows.

Example result

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When clicking ‘Execute workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 2 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 3 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.3

Block 4 - Check Guardrails

Type / Role
@n8n/n8n-nodes-langchain.guardrails - guardrails
Config choices
Version 1

Block 5 - Format Pass Result

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Format Fail Result

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 7 - Combine Result

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 8 - Calculate Metrics

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 9 - Format Report

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - Preserve Original Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - Send a message

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 12 - Set Test Data (code)

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 13 - Markdown

Type / Role
n8n-nodes-base.markdown - markdown
Config choices
Version 1

Block 14 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note9

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note10

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Benchmark content safety guardrails with automated test suite & reports
Complexity advanced
Nodes 24
Categories Engineering, AI Summarization
Author Patrick Siewert
Published 11 Nov 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/10729/10729.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Benchmark content safety guardrails with automated test suite & reports do?

️ Evaluate Guardrails Node Accuracy with Automated Test Suite This workflow benchmarks the n8n Guardrails node across multiple safety categories including PII, NSFW, jailbreak attempts, secret ke...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, AI Summarization use case.