railguard

n8n node for RailGuard AI Guardrails

Package Information

Downloads: 3 weekly / 15 monthly
Latest Version: 1.0.0
Author: RailGuard

Documentation

n8n-nodes-railguard

This is an n8n community node that lets you use RailGuard AI Guardrails in your n8n workflows.

RailGuard provides enterprise-grade AI safety and compliance guardrails for LLM applications. Validate user inputs, AI outputs, and prevent prompt injection, data leaks, and policy violations.

n8n is a fair-code licensed workflow automation platform.

Installation

Follow the installation guide in the n8n community nodes documentation.

Community Nodes (n8n Cloud & Self-Hosted)

  1. Go to Settings > Community Nodes
  2. Select Install
  3. Enter n8n-nodes-railguard in the Enter npm package name field
  4. Click Install

Manual Installation (Self-Hosted)

cd ~/.n8n/nodes
npm install n8n-nodes-railguard

Then restart n8n.

Operations

Validate

Validate user input and/or AI output against your configured rules.

Parameters:

  • Agent ID (required): Your RailGuard agent ID
  • Input (required): The user input to validate
  • Output (optional): The AI-generated output to validate
  • Metadata (optional): Additional JSON metadata

Returns:

{
  "decision": "allow|block|warn|rewrite",
  "reason": "Explanation of the decision",
  "rule": {
    "id": "rule-id",
    "name": "Rule Name"
  },
  "rewrite": "Rewritten text (if decision is rewrite)"
}

Get Rules

Retrieve all rules configured for an agent.

Parameters:

  • Agent ID (required): Your RailGuard agent ID

Returns: Array of rule objects

Get Validations

Get validation history for an agent.

Parameters:

  • Agent ID (required): Your RailGuard agent ID
  • Limit (optional): Number of validations to return (1-200, default: 50)

Returns: Array of validation records

Credentials

This node requires RailGuard API credentials:

  1. API Key: Your RailGuard API key (starts with rg_)
  2. Base URL: Your RailGuard API URL (default: https://api.railguard.io)

Getting Your API Key

  1. Sign up at RailGuard
  2. Go to Dashboard > API Keys
  3. Create a new API key
  4. Copy the key (it will only be shown once)

Usage Examples

Example 1: Validate User Input Before Sending to AI

Webhook → RailGuard (Validate) → IF (decision = allow) → OpenAI → Respond
                                  ↓
                              (decision = block) → Return Error

RailGuard Node Config:

  • Operation: Validate
  • Agent ID: chatbot-prod
  • Input: {{ $json.userMessage }}

Example 2: Validate AI Output Before Returning to User

Webhook → OpenAI → RailGuard (Validate) → IF (decision = allow) → Return Response
                                          ↓
                                      (decision = block) → Return Safe Message

RailGuard Node Config:

  • Operation: Validate
  • Agent ID: chatbot-prod
  • Input: {{ $json.userInput }}
  • Output: {{ $json.aiResponse }}

Example 3: Monitor and Log Warnings

Webhook → RailGuard (Validate) → IF (decision = warn) → Log to Database
                                  ↓
                              Continue Normal Flow

Use Cases

  • 🛡️ Prevent Prompt Injection: Block malicious attempts to manipulate AI behavior
  • 🔒 Data Loss Prevention: Detect and prevent sensitive data leaks in AI outputs
  • 📋 Compliance: Ensure AI responses comply with policies (PII, GDPR, HIPAA)
  • ⚠️ Content Moderation: Filter toxic, offensive, or inappropriate content
  • 🎯 Custom Rules: Define custom patterns and business logic rules

Resources

Support

For issues or questions:

License

MIT

Discussion