{
  "name": "Benchmark content safety guardrails with automated test suite & reports",
  "nodes": [
    {
      "id": "b23019ab-873a-4dee-8ef2-3f6d4a467455",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -176,
        720
      ]
    },
    {
      "id": "c1c72d84-2a36-43e3-8e3d-e068a16fc3a4",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        448,
        720
      ]
    },
    {
      "id": "7c0dfde3-222a-4d49-971b-fe11bbbef1c9",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1120,
        1120
      ]
    },
    {
      "id": "f8e090c5-e052-4bd1-94e5-d177b8c3d49f",
      "name": "Check Guardrails",
      "type": "@n8n/n8n-nodes-langchain.guardrails",
      "position": [
        1120,
        992
      ]
    },
    {
      "id": "d633dc3e-6b5e-41b8-99ba-03d407411b91",
      "name": "Format Pass Result",
      "type": "n8n-nodes-base.code",
      "position": [
        1616,
        976
      ]
    },
    {
      "id": "9221a9f7-b5d3-4bab-84af-d3d9c735f25f",
      "name": "Format Fail Result",
      "type": "n8n-nodes-base.code",
      "position": [
        1632,
        1168
      ]
    },
    {
      "id": "c70feac3-6b49-4cee-9afd-23d6f0ca7838",
      "name": "Combine Result",
      "type": "n8n-nodes-base.merge",
      "position": [
        2096,
        1216
      ]
    },
    {
      "id": "7bdbc6cc-ba8b-4011-baff-f376e76fcd6d",
      "name": "Calculate Metrics",
      "type": "n8n-nodes-base.code",
      "position": [
        912,
        400
      ]
    },
    {
      "id": "7f085e8e-968a-40fa-9a54-ebc9e6cb54a5",
      "name": "Format Report",
      "type": "n8n-nodes-base.code",
      "position": [
        1248,
        400
      ]
    },
    {
      "id": "5b87ed1b-f06b-420e-9eef-38071ba2695f",
      "name": "Preserve Original Data",
      "type": "n8n-nodes-base.code",
      "position": [
        896,
        992
      ]
    },
    {
      "id": "682e254e-991d-4ff1-8729-ecf67444c4d7",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1920,
        400
      ]
    },
    {
      "id": "6bd668ee-94ee-467d-9e30-cdd46ce848c5",
      "name": "Set Test Data (code)",
      "type": "n8n-nodes-base.code",
      "position": [
        80,
        720
      ]
    },
    {
      "id": "5d84ac8f-27c2-4923-a6b4-4dd28f3870aa",
      "name": "Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        1552,
        400
      ]
    },
    {
      "id": "10e3686d-43cf-4892-9550-b63c78492b8d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -480
      ],
      "parameters": {
        "width": 640,
        "height": 896,
        "content": "## 🛡️ Guardrails Evaluation Workflow  \nThis workflow automatically tests the n8n **Guardrails node** against 36 curated prompts covering Jailbreak, NSFW, PII, Keywords, URLs, and Secret Keys.  \nIt ben"
      }
    },
    {
      "id": "6c23b682-618c-4e80-ac88-fd37e7a6ce49",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        448
      ],
      "parameters": {
        "width": 320,
        "height": 480,
        "content": "## 📝 Test Case Generator  \nCreates 36 pre-defined prompts covering all safety categories.  \nYou can extend or modify these cases to test specific guardrail behaviours.\n\n**Why it matters:**  \nA consist"
      }
    },
    {
      "id": "a98ab584-027c-4cb6-bc82-80668ec587e4",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        448
      ],
      "parameters": {
        "width": 288,
        "height": 480,
        "content": "## 🔁 Loop Through Each Test Case  \nIterates through the 36 prompts so Guardrails can evaluate them one by one.  \nThis ensures each test is processed cleanly and results can be matched to the correct t"
      }
    },
    {
      "id": "a67827df-0556-4443-92ba-a3056ec846bb",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        704
      ],
      "parameters": {
        "width": null,
        "height": 640,
        "content": "## 📦 Preserve Original Metadata  \nStores the test case’s ID, expected result, category, and description at the top level.  \nThis is needed because Guardrails replaces the JSON structure — this step ke"
      }
    },
    {
      "id": "5b4e096c-9ef3-40e6-82ad-1ecdf3d6ef4d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        704
      ],
      "parameters": {
        "width": 368,
        "height": 640,
        "content": "## 🛡️ Guardrails Evaluation  \nApplies safety filters to the input text (NSFW, jailbreak, keywords, URLs, PII, secret keys).  \nOutputs triggered checks and confidence scores.\n\n**Why this matters:**  \nT"
      }
    },
    {
      "id": "58482817-4530-45da-87ac-ebbc36197e30",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        704
      ],
      "parameters": {
        "width": 480,
        "height": 640,
        "content": "## 🧮 Normalize Result Format  \nThese nodes convert Guardrails output into a unified structure:  \n- expected  \n- actual  \n- correct (boolean)  \n- score  \n- violation type  \n- timestamp  \n\nThis creates "
      }
    },
    {
      "id": "c0a9420b-f50e-4424-a14f-59d29fc2c98f",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2016,
        960
      ],
      "parameters": {
        "width": 336,
        "height": 544,
        "content": "## 🔗 Merge Results  \nCollects PASS and VIOLATION outputs and reunites them in the correct sequence before final aggregation.\n"
      }
    },
    {
      "id": "57760306-98cc-4a43-bd23-f5c0da6110f1",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        160
      ],
      "parameters": {
        "width": 336,
        "height": 400,
        "content": "## 📊 Build Accuracy Metrics  \nGenerates:  \n- Confusion matrix  \n- Precision / Recall / F1 Score  \n- Category-level accuracy  \n- Per-item results  \n\nThis step turns raw Guardrails outputs into measurab"
      }
    },
    {
      "id": "992e8472-c933-481f-b43d-027f31cf46a4",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        160
      ],
      "parameters": {
        "width": 272,
        "height": 400,
        "content": "## 📝 Build Markdown Report  \nCreates a complete human-readable test report including tables, metrics, and recommendations.  \nThis Markdown is later converted to HTML for email delivery.\n"
      }
    },
    {
      "id": "b103ad0d-0879-4053-9837-cd9d316e17f8",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        160
      ],
      "parameters": {
        "width": 320,
        "height": 400,
        "content": "## 📄 Convert Markdown → HTML  \nTurns the report into HTML, enabling clean formatting inside your email message.\n"
      }
    },
    {
      "id": "b20f030a-d627-464c-9313-dc7cbad1c79f",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1792,
        160
      ],
      "parameters": {
        "width": 368,
        "height": 400,
        "content": "## ✉️ Email Report  \nSends the formatted Guardrails report to your inbox.  \nReplace **YOUR_MAIL_HERE** with your email address.\n"
      }
    }
  ],
  "connections": {
    "Markdown": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Report": {
      "main": [
        [
          {
            "node": "Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Result": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Calculate Metrics",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Preserve Original Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Guardrails": {
      "main": [
        [
          {
            "node": "Format Pass Result",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format Fail Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Metrics": {
      "main": [
        [
          {
            "node": "Format Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Check Guardrails",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Format Fail Result": {
      "main": [
        [
          {
            "node": "Combine Result",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Format Pass Result": {
      "main": [
        [
          {
            "node": "Combine Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Test Data (code)": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Preserve Original Data": {
      "main": [
        [
          {
            "node": "Check Guardrails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Set Test Data (code)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}