{
  "name": "agent_with_rag",
  "nodes": [
    {
      "id": "Slack Trigger",
      "name": "Slack Trigger",
      "type": "n8n-nodes-base.slackTrigger",
      "typeVersion": 1,
      "position": [
        -560,
        120
      ],
      "parameters": {
        "event": "message.channels"
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "AI Agent",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1,
      "position": [
        -280,
        120
      ],
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.event.text }}",
        "options": {
          "systemMessage": "Route product queries to search_products; use search_web for live web data."
        }
      }
    },
    {
      "id": "Tool - search_products",
      "name": "Tool - search_products",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 1,
      "position": [
        -280,
        -40
      ],
      "parameters": {
        "name": "search_products",
        "description": "Search product knowledge base for specs, prices and IDs.",
        "workflowId": "tool_search_products"
      }
    },
    {
      "id": "Reply",
      "name": "Reply",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2,
      "position": [
        -20,
        120
      ],
      "parameters": {
        "resource": "message",
        "operation": "post",
        "channel": "={{ $('Slack Trigger').item.json.event.channel }}",
        "text": "={{ $json.output || $json.text }}"
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Slack Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tool - search_products": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}