AutomationFlowsAI & RAG › Evaluation Guardrails Mode Check Text for Violations

Evaluation Guardrails Mode Check Text for Violations

evaluation_Guardrails_mode_check_text_for_violations. Uses chatTrigger, agent, lmChatOpenAi, googleSheetsTool. Chat trigger; 13 nodes.

Chat trigger trigger★★★★☆ complexityAI-powered13 nodesChat TriggerAgentOpenAI ChatGoogle Sheets ToolOutput Parser StructuredGmailChatGuardrails
AI & RAG Trigger: Chat trigger Nodes: 13 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "evaluation_Guardrails_mode_check_text_for_violations",
  "nodes": [
    {
      "parameters": {
        "options": {
          "responseMode": "responseNodes"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        -624,
        -128
      ],
      "id": "9ed296cb-c5b6-40fa-a595-d4331ed7cd41",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.guardrailsInput }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "You are an AI Flight Booking Assistant supporting users with travel booking.\n\nThe user will provide travel details such as:\n- source city\n- destination city\n- budget\n- and sometimes preferred travel time.\n\nYour task is to:\n1. Search available flights from the provided flight database.\n2. Identify the most suitable flight based on the user's budget and travel route.\n3. Internally select the best flight option including:\n   - flight name\n   - source\n   - destination\n   - ticket price\n   - departure time\n   - available seats\n4. Generate professional booking details for the selected flight.\n5. Generate a professional flight booking confirmation email.\n6. Generate a professional confirmed flight booking email.\n7. Assume the email is sent only after human approval is completed in the workflow.\n8. The email should sound like a real confirmed airline reservation email.\n\nConstraints:\n\u2022 Do NOT perform payment or final reservation.\n\u2022 Do NOT explain your reasoning.\n\u2022 Do NOT ask unnecessary follow-up questions.\n\u2022 ONLY generate the booking details and email content.\n\nGuidelines:\n\u2022 Always try to select flights within the user's budget.\n\u2022 If multiple flights match, prefer the cheapest suitable option.\n\u2022 Keep the response short, clear, and professional.\n\u2022 Mention flight details clearly.\n\u2022 Use priyangbhatt321@gmail.com as the booking email for all generated bookings.\n\u2022 Write the email in a natural and professional airline confirmation style.\n\u2022 Keep the email short, clean, and realistic.\n\u2022 Avoid robotic wording.\n\u2022 Make the email look like a real airline booking confirmation email.\n\nOutput requirements:\n\u2022 Respond ONLY with structured data that matches the expected output schema.\n\u2022 Do NOT include any extra text, commentary, or formatting."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        -208,
        -192
      ],
      "id": "59f801bb-ec99-49d0-9f91-9d8416c0606c",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        -352,
        16
      ],
      "id": "6ec47869-d152-4c59-b0b4-a352ddb0abb7",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1jzANiSO_ke1o-CbofwYqd371qb3_hvdhk1wz1ZUEAes",
          "mode": "list",
          "cachedResultName": "flight",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jzANiSO_ke1o-CbofwYqd371qb3_hvdhk1wz1ZUEAes/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1301746240,
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jzANiSO_ke1o-CbofwYqd371qb3_hvdhk1wz1ZUEAes/edit#gid=1301746240"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        -192,
        16
      ],
      "id": "f8b2a419-efe1-4c85-bdbb-4b213c60f6ae",
      "name": "Get row(s) in sheet in Google Sheets",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"name\": \"flight_booking_email\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"booking_email\": {\n      \"type\": \"string\",\n      \"description\": \"Email address where the flight ticket confirmation should be sent\"\n    },\n    \"email_subject\": {\n      \"type\": \"string\",\n      \"description\": \"Subject line for the flight booking confirmation email\"\n    },\n    \"email_body\": {\n      \"type\": \"string\",\n      \"description\": \"Professional flight booking confirmation email body with ticket details\"\n    }\n  },\n  \"required\": [\n    \"booking_email\",\n    \"email_subject\",\n    \"email_body\"\n  ]\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        -48,
        16
      ],
      "id": "9de54fc3-c437-406c-a36c-c9ccbdd11ca0",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "sendTo": "={{ $('AI Agent').item.json.output.booking_email }}",
        "subject": "={{ $('AI Agent').item.json.output.email_subject }}",
        "emailType": "text",
        "message": "={{ $('AI Agent').item.json.output.email_body }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        496,
        -208
      ],
      "id": "5e39c7a5-1a4d-4ce9-be69-d87bcf2c51ba",
      "name": "Send a message",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "sendAndWait",
        "message": "=Type approve if you want to continue with the selected flight booking, if not, type reject\n\nSubject : \n\n\n {{ $json.output.email_subject }}\n\nBody:\n\n{{ $json.output.email_body }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chat",
      "typeVersion": 1.3,
      "position": [
        224,
        -304
      ],
      "id": "566c24b4-0871-4efe-827e-9abb943a7300",
      "name": "Chat"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "68988263-4685-4cf9-867e-070c045816b0",
              "leftValue": "={{ $json.chatInput }}",
              "rightValue": "approve",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        336,
        -64
      ],
      "id": "24275acd-30a3-473d-a64f-a3b24f14f604",
      "name": "If"
    },
    {
      "parameters": {
        "text": "={{ $json.chatInput }}{{ $json['User Input'] }}",
        "guardrails": {
          "keywords": "idiot",
          "pii": {
            "value": {
              "type": "selected",
              "entities": [
                "EMAIL_ADDRESS"
              ]
            }
          }
        }
      },
      "type": "@n8n/n8n-nodes-langchain.guardrails",
      "typeVersion": 2,
      "position": [
        -400,
        -288
      ],
      "id": "89ea1d96-7761-4bb7-9dad-cd95c063802b",
      "name": "Guardrails1"
    },
    {
      "parameters": {
        "message": "your request was blocked by the guardrails policy because it contains restricted or unsafe content. Please verify your message and try again.",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chat",
      "typeVersion": 1.3,
      "position": [
        -176,
        -384
      ],
      "id": "3b905724-b49f-41e6-a84f-5871b198abbe",
      "name": "Chat1"
    },
    {
      "parameters": {
        "source": "googleSheets",
        "documentId": {
          "__rl": true,
          "value": "1zwsW4Tia7cKKotkMljNUUE0tMQBBhE7SJfhhJIawR_s",
          "mode": "list",
          "cachedResultName": "Flight_Eval_Dataset",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1zwsW4Tia7cKKotkMljNUUE0tMQBBhE7SJfhhJIawR_s/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 324016220,
          "mode": "list",
          "cachedResultName": "sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1zwsW4Tia7cKKotkMljNUUE0tMQBBhE7SJfhhJIawR_s/edit#gid=324016220"
        }
      },
      "type": "n8n-nodes-base.evaluationTrigger",
      "typeVersion": 4.7,
      "position": [
        -656,
        -384
      ],
      "id": "dc0d3250-363e-40c7-b50b-226887a09d56",
      "name": "When fetching a dataset row",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "checkIfEvaluating"
      },
      "type": "n8n-nodes-base.evaluation",
      "typeVersion": 4.8,
      "position": [
        64,
        -112
      ],
      "id": "1851da8a-7e3d-4c18-a72f-11ccaa7ac3fc",
      "name": "check if Evaluation"
    },
    {
      "parameters": {
        "operation": "setMetrics",
        "expectedAnswer": "={{ $('When fetching a dataset row').item.json['Expected Email'] }}{{ $('When fetching a dataset row').item.json['Expected Subject'] }}{{ $('When fetching a dataset row').item.json['Expected Body'] }}",
        "actualAnswer": "={{ $('AI Agent').item.json.output.booking_email }}{{ $('AI Agent').item.json.output.email_subject }}{{ $('AI Agent').item.json.output.email_body }}",
        "options": {}
      },
      "type": "n8n-nodes-base.evaluation",
      "typeVersion": 4.8,
      "position": [
        240,
        48
      ],
      "id": "3d9e9527-8ef1-4109-9b41-d42edf441fec",
      "name": "Evaluation"
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "Guardrails1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Evaluation",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "check if Evaluation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chat": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Guardrails1": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Chat1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When fetching a dataset row": {
      "main": [
        [
          {
            "node": "Guardrails1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check if Evaluation": {
      "main": [
        [
          {
            "node": "Evaluation",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Chat",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "f34c4f12-7034-42b5-8e31-4d70d9bcb080",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "3AC9RfvsCgqblxba",
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

evaluation_Guardrails_mode_check_text_for_violations. Uses chatTrigger, agent, lmChatOpenAi, googleSheetsTool. Chat trigger; 13 nodes.

Source: https://github.com/DataThinkers/N8N-WORKFLOWS-JSON/blob/main/evaluation_Guardrails_mode_check_text_for_violations.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Who is this workflow for? This workflow is designed for SEO analysts, content creators, marketing agencies, and developers who need to index a website and then interact with its content as if it were

Agent, OpenAI Chat, Memory Buffer Window +10
AI & RAG

This Chatbot automates the process of discovering job openings and generating tailored job application emails.

Chat Trigger, OpenAI Chat, Mcp Client Tool +12
AI & RAG

Job Application PredictLeads & ScrapeGraph AI. Uses chatTrigger, lmChatOpenAi, mcpClientTool, memoryBufferWindow. Chat trigger; 32 nodes.

Chat Trigger, OpenAI Chat, Mcp Client Tool +12
AI & RAG

Streamline the final stage of your content production workflow by automating publishing, formatting, metadata generation, and approval routing. This AI-powered subworkflow pulls optimized drafts from

Google Sheets Tool, Memory Buffer Window, Agent +6
AI & RAG

Standardize Daily Construction Reports (DCR) with AI by capturing raw site inputs via chat and automatically generating structured Work Performance Data.

Chat Trigger, Guardrails, Gmail +4