{
  "name": "Sentinel - Safe Web Search Agent",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "id": "94e97bc4-e55e-488f-b513-9fc1cdf103c7",
      "name": "Chat Trigger",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -576,
        64
      ],
      "webhookId": "fb9536df-83a8-41aa-ad44-b675420b0404"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.safe_payload }}",
        "options": {
          "systemMessage": "You are a helpful research assistant. Use the 'safe_web_search' tool to find information online when needed. All web results are automatically scanned for prompt injection attacks by Sentinel before you see them. If a result includes a [Sentinel: ...] warning, note the threat was neutralized and the content is safe to summarize."
        }
      },
      "id": "8770e4e6-0f70-42a2-aa41-952d07a7521c",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        144,
        48
      ]
    },
    {
      "parameters": {
        "model": "x-ai/grok-3",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        32,
        256
      ],
      "id": "b4487fee-8b17-445d-ae02-963fb9750e2f",
      "name": "OpenRouter Chat Model",
      "credentials": {
        "openRouterApi": {
          "id": "AYwkfrDmqhLTpHxd",
          "name": "OpenRouter account"
        }
      }
    },
    {
      "parameters": {
        "description": "Call this tool to do a web search",
        "workflowId": {
          "__rl": true,
          "value": "77RU51b33qLI4akzWXir8",
          "mode": "list",
          "cachedResultUrl": "/workflow/77RU51b33qLI4akzWXir8",
          "cachedResultName": "Safe Web Search"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [
            "query"
          ],
          "schema": [
            {
              "id": "query",
              "displayName": "query",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.2,
      "position": [
        304,
        272
      ],
      "id": "1ef16c6c-43e2-4f6d-85d5-eba1606a6377",
      "name": "Call 'Safe Web Search'"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://sentinel.ircnet.us/v1/scrub",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Sentinel-Key",
              "value": "sk_your_sentinel_api_key_goes_here"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { \"content\": $json.content, \"tier\": $json.tier } }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        -240,
        64
      ],
      "id": "a7b6083e-39b2-4822-9321-2ce88317201e",
      "name": "Sentinel Filter"
    },
    {
      "parameters": {
        "jsCode": "const formattedContent = $input.first().json.chatInput\n\nreturn {\n  json: {\n    content: formattedContent,\n    tier: \"standard\"\n  }\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -416,
        64
      ],
      "id": "8fea5759-53de-420c-9449-eab54a299935",
      "name": "Preprocessor"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "64b8d613-110b-44c5-9753-beb644fc7472",
              "leftValue": "={{ $json.security.action_taken }}",
              "rightValue": "clean",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        -64,
        64
      ],
      "id": "e5603b95-cc42-4cb2-9440-d18ca74f11e5",
      "name": "If"
    },
    {
      "parameters": {
        "content": "## Sentinel-Proxy\n*Inbound Request Example*",
        "height": 336,
        "width": 352,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        -48
      ],
      "typeVersion": 1,
      "id": "e57d0cfd-f6e5-4bcd-a23c-44097cb1233d",
      "name": "Sticky Note"
    }
  ],
  "pinData": {},
  "connections": {
    "Chat Trigger": {
      "main": [
        [
          {
            "node": "Preprocessor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Call 'Safe Web Search'": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Preprocessor": {
      "main": [
        [
          {
            "node": "Sentinel Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sentinel Filter": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "16c86b84-8430-404e-85a0-5821788bdb07",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "17223a0b00ae6ae64c3904edd04f536e94a634f6f7132e652bd6dff3904c380e"
  },
  "id": "mlZT-OE6z1Bsvo7Oe3-TY",
  "tags": []
}