Secure your AI agents against jailbreaking, PII leakage, and toxic content. This advanced n8n workflow implements multiple security guardrails using specialized n8n node logic, ideal for enterprise deployments.
Download this n8n workflow template and start using it instantly.
When deploying large language models (LLMs) in an enterprise environment, security and compliance are paramount. Unrestricted access can lead to data leaks, prompt injection (jailbreaking), and generation of harmful or off-topic content. This robust n8n workflow serves as an AI security firewall, ensuring every prompt passes rigorous checks before interacting with the LLM, or before its output is returned to the user.
This specific n8n workflow uses a suite of specialized n8n node actions (Guardrails) powered by a foundational LLM (Google Gemini) to categorize and mitigate risks related to PII, secret keys, NSFW content, and topical misalignment. Utilizing this n8n template helps you maintain control, ensuring your AI initiatives are safe, predictable, and compliant.
The entire process is initiated by a manual n8n trigger for testing and demonstration purposes.
When clicking ‘Execute workflow’ n8n trigger, which immediately fetches test data (simulated prompts) from the Guadrails Test Data Google Sheets n8n node.Switch n8n node, which routes the input message to the appropriate guardrail n8n node for inspection.Jailbreak: Checks for attempts to bypass system instructions.PII: Scans for Personally Identifiable Information (like names, addresses).Secret Keys: Detects and flags sensitive credentials or API keys.NSFW: Checks for inappropriate or explicit content.URLs: Filters out potentially malicious or unauthorized URLs.Topical Alignment: Ensures the input adheres to defined acceptable topics.Keywords: Blocks predefined forbidden keywords.Sanitize PII, Sanitize Keys, Sanitize URLs). These guardrail n8n nodes attempt to mask or remove the sensitive data, providing secure output, demonstrating the comprehensive capabilities of this n8n workflow structure.To deploy this enterprise-grade n8n workflow and start using these guardrail checks, follow these steps:
Guadrails Test Data n8n node to access your test spreadsheet containing various prompts (safe and malicious).Keywords, PII) and adjust the internal configuration (like allowed topics or blocklists) to match your organization's specific security policies. This is essential for customizing the n8n templates to your environment.When clicking ‘Execute workflow’ n8n trigger to observe how prompts are routed and flagged by the security checks. When clicking ‘Execute workflow’ (Manual Trigger): Acts as the entry point, allowing users to start this n8n workflow on demand for testing.
Guadrails Test Data (Google Sheets): This n8n node retrieves the sample prompts that will be subjected to the various security checks implemented by the n8n workflow.
Switch n8n node: Routes the incoming test data to the appropriate security check guardrail based on criteria (though in this demonstration, it connects all paths for simultaneous testing).
Google Gemini Chat Model (AI Language Model): Provides the underlying large language model engine used by all Guardrail n8n nodes to assess, score, and potentially sanitize the input and output data within this n8n template.
Guardrails n8n node (Jailbreak, PII, NSFW, etc.): These specialized n8n node types are the core security mechanism, defining the rules and constraints for safe interaction with the LLM. They determine if the input passes the security protocols set in this n8n workflow.
Sanitize PII, Sanitize Keys, Sanitize URLs (Guardrails and Set nodes): These nodes demonstrate post-detection actions. The 'Set' nodes (Personal Data, API Keys, URLS) prepare the data for the final Guardrail n8n node, which performs the actual redacting or masking of sensitive information.
Deploy an advanced customer support chatbot using an n8n workflow. It uses GPT-4o agents and n8n node tools to check Google Sheets inventory and process sales orders automatically.

Use an advanced n8n workflow to categorize Lemlist email replies using OpenAI, automatically manage leads in HubSpot (create deals/tasks), and send instant Slack alerts. Leverage these powerful n8n templates.

Use this robust n8n workflow to automate complex job scraping from LinkedIn and Indeed via Bright Data. Trigger searches via an n8n form and save the aggregated job listings directly to Google Sheets for comparison.

Use this foundational n8n workflow template to understand core logic, utilizing the Interval n8n trigger, Function n8n node, and Set n8n node for scheduled data generation and transformation.

Analyze your n8n instance dependency structure. This n8n workflow automatically generates a visual dependency graph and applies tags to subworkflows based on their callers, streamlining maintenance.

Use this robust n8n workflow to capture and log all execution errors to Google Sheets, instantly notify your team via Telegram, and send comprehensive alerts via Gmail. This powerful n8n template ensures high reliability and quick incident response.

AI and automation enthusiast with a strong background in building intelligent workflows. As an AWS Certified Solutions Architect, I design secure, scalable, cost-effective cloud solutions. Passionate about integrating AI to streamline processes and solve real-world challenges. Always eager to collaborate, share knowledge, and empower the community to push the boundaries of cloud and AI.







































