AutomationFlowsAI & RAG › Demo: RAG in N8n

Demo: RAG in N8n

Demo: RAG in n8n. Uses formTrigger, documentDefaultDataLoader, vectorStoreInMemory, agent. Event-driven trigger; 13 nodes.

Event trigger★★★☆☆ complexityAI-powered13 nodesForm TriggerDocument Default Data LoaderIn-Memory Vector StoreAgentChat TriggerOllama EmbeddingsOllama ChatVector Store Pgvector
AI & RAG Trigger: Event Nodes: 13 Complexity: ★★★☆☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #rag-starter-template — we link there as the canonical source.

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
{
  "updatedAt": "2026-02-04T23:33:39.609Z",
  "createdAt": "2026-01-23T23:04:15.366Z",
  "id": "yUalubL2RY9cmka1",
  "name": "Demo: RAG in n8n",
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "formTitle": "Upload your data to test RAG",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Upload your file(s)",
              "fieldType": "file",
              "acceptFileTypes": ".pdf, .csv",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        -128,
        0
      ],
      "id": "f7a656ec-83fc-4ed2-a089-57a9def662b7",
      "name": "Upload your file here"
    },
    {
      "parameters": {
        "dataType": "binary",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        336,
        240
      ],
      "id": "94aecac0-03f9-4915-932b-d14a2576607b",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "content": "### Readme\nLoad your data into a vector database with the \ud83d\udcda **Load Data** flow, and then use your data as chat context with the \ud83d\udc15 **Retriever** flow.\n\n**Quick start**\n1. Click on the `Execute Workflow` button to run the \ud83d\udcda **Load Data** flow.\n2. Click on `Open Chat` button to run the \ud83d\udc15 **Retriever** flow. Then ask a question about content from your document(s)\n\n\nFor more info, check [our docs on RAG in n8n](https://docs.n8n.io/advanced-ai/rag-in-n8n/).",
        "height": 300,
        "width": 440,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        -64
      ],
      "typeVersion": 1,
      "id": "0d07742b-0b36-4c2e-990c-266cbe6e2d4d",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "### \ud83d\udcda Load Data Flow",
        "height": 460,
        "width": 1068,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        -64
      ],
      "typeVersion": 1,
      "id": "d19d04f3-5231-4e47-bed7-9f24a4a8f582",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "mode": "insert",
        "memoryKey": {
          "__rl": true,
          "value": "vector_store_key",
          "mode": "list",
          "cachedResultName": "vector_store_key"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.2,
      "position": [
        512,
        -16
      ],
      "id": "bf50a11f-ca6a-4e04-a6d2-42fee272b260",
      "name": "Insert Data to Store",
      "disabled": true
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolName": "knowledge_base",
        "toolDescription": "Use this knowledge base to answer questions from the user",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.2,
      "position": [
        1312,
        208
      ],
      "id": "09c0db62-5413-440e-8c13-fb6bb66d9b6a",
      "name": "Query Data Tool"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        1312,
        -16
      ],
      "id": "579aed76-9644-42d1-ac13-7369059ff1c2",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        1088,
        -16
      ],
      "id": "9c30de61-935a-471f-ae88-ec5f67beeefc",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "content": "### \ud83d\udc15 2. Retriever Flow",
        "height": 460,
        "width": 680,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        -64
      ],
      "typeVersion": 1,
      "id": "28bc73a1-e64a-47bf-ac1c-ffe644894ea5",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "### Embeddings\n\nThe Insert and Retrieve operation use the same embedding node.\n\nThis is to ensure that they are using the **exact same embeddings and settings**.\n\nDifferent embeddings might not work at all, or have unintended consequences.\n",
        "height": 240,
        "width": 320,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        448
      ],
      "typeVersion": 1,
      "id": "0cf8c647-418c-4d1a-8952-766145afca72",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "model": "nomic-embed-text:latest"
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "typeVersion": 1,
      "position": [
        800,
        592
      ],
      "id": "f425b6e3-1b80-40a9-8d5f-811c4613b33f",
      "name": "Embeddings Ollama",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "glm-4.7:cloud",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        1104,
        224
      ],
      "id": "6a472bb9-6d93-4a7c-b2d6-1b701ac8a897",
      "name": "Ollama Chat Model",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "insert",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "typeVersion": 1.3,
      "position": [
        160,
        16
      ],
      "id": "b647f5fd-67a6-4dfe-90cd-29238dbd95fe",
      "name": "Postgres PGVector Store",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Upload your file here": {
      "main": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Query Data Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Ollama": {
      "ai_embedding": [
        [
          {
            "node": "Query Data Tool",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Postgres PGVector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Postgres PGVector Store": {
      "main": [
        []
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "staticData": null,
  "meta": {
    "templateId": "rag-starter-template",
    "templateCredsSetupCompleted": true
  },
  "versionId": "e43c9354-34e4-42f1-99d5-b2bce2b3cb7e",
  "activeVersionId": null,
  "triggerCount": 0,
  "shared": [
    {
      "updatedAt": "2026-01-23T23:04:15.366Z",
      "createdAt": "2026-01-23T23:04:15.366Z",
      "role": "workflow:owner",
      "workflowId": "yUalubL2RY9cmka1",
      "projectId": "aRJv9cLftn98cx8V"
    }
  ],
  "activeVersion": null,
  "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

Demo: RAG in n8n. Uses formTrigger, documentDefaultDataLoader, vectorStoreInMemory, agent. Event-driven trigger; 13 nodes.

Source: https://github.com/ATHARVISM2804/n8n_workflow_main/blob/main/workflows/demo_-rag-in-n8n-.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

RAG Pipeline. Uses formTrigger, vectorStoreQdrant, embeddingsOllama, documentDefaultDataLoader. Event-driven trigger; 13 nodes.

Form Trigger, Qdrant Vector Store, Ollama Embeddings +6
AI & RAG

Click here to view the YouTube Tutorial

Form Trigger, Qdrant Vector Store, Ollama Embeddings +6
AI & RAG

Answers should given only within provided text. Chat interface powered by LLM (Ollama) Retrieval-Augmented Generation (RAG) using Supabase Vector DB Multi-format file support (PDF, Excel, Google Docs,

Document Default Data Loader, Google Drive, Google Drive Trigger +10
AI & RAG

Indexation. Uses formTrigger, embeddingsOllama, textSplitterRecursiveCharacterTextSplitter, modelSelector. Event-driven trigger; 25 nodes.

Form Trigger, Ollama Embeddings, Text Splitter Recursive Character Text Splitter +9
AI & RAG

Local RAG AI Agent. Uses memoryPostgresChat, lmChatOllama, lmOllama, toolVectorStore. Event-driven trigger; 24 nodes.

Memory Postgres Chat, Ollama Chat, Lm Ollama +9