This workflow corresponds to n8n.io template #11468 — 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 →
{
"id": "3kc6gut5vl8rwEhO",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Build a RAG Agent with n8n, Qdrant & OpenAI",
"tags": [],
"nodes": [
{
"id": "2bea4e93-9d7b-4856-9883-6f896cac0b11",
"name": "Detect New Files",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
-368,
-64
],
"parameters": {
"event": "fileCreated",
"options": {
"fileType": "all"
},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1BevhU5qdgNDFbK4D9oAYGeK0Dt5sEaxQ",
"cachedResultUrl": "https://drive.google.com/drive/folders/1BevhU5qdgNDFbK4D9oAYGeK0Dt5sEaxQ",
"cachedResultName": "n8n-RAG-tutorial"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "c19b8fa5-32ed-40f3-81f5-459bd37c3515",
"name": "Download as Markdown",
"type": "n8n-nodes-base.httpRequest",
"position": [
-144,
-144
],
"parameters": {
"url": "={{ $json.exportLinks['text/markdown'] }}",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "googleDriveOAuth2Api"
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "d1f2c1c5-00eb-4c24-9e13-2fccddfaa9c9",
"name": "Add Metadata",
"type": "n8n-nodes-base.merge",
"position": [
-144,
32
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3.2
},
{
"id": "97d84336-e5a1-4d27-8aa9-8c690a774f65",
"name": "Insert into Vector Store",
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"position": [
32,
32
],
"parameters": {
"mode": "insert",
"options": {},
"qdrantCollection": {
"__rl": true,
"mode": "id",
"value": "n8n-rag-tutorial"
},
"embeddingBatchSize": 50
},
"credentials": {
"qdrantApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "e52e7eb5-1a50-446e-8f62-a1f5586bf4a3",
"name": "Load File Content & Metadata",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
176,
240
],
"parameters": {
"options": {
"metadata": {
"metadataValues": [
{
"name": "file_name",
"value": "={{ $('Add Metadata').item.json.name }}"
},
{
"name": "file_id",
"value": "={{ $('Add Metadata').item.json.id }}"
},
{
"name": "created_time",
"value": "={{ $('Add Metadata').item.json.createdTime }}"
},
{
"name": "=size",
"value": "={{ $('Add Metadata').item.json.size }}"
},
{
"name": "owner",
"value": "={{ $('Add Metadata').item.json.owners[0].emailAddress }}"
}
]
}
},
"jsonData": "={{ $('Add Metadata').item.json.data }}",
"jsonMode": "expressionData",
"textSplittingMode": "custom"
},
"typeVersion": 1.1
},
{
"id": "ecdd2d91-dbac-4c24-ae1a-f67e23fe7ed2",
"name": "Split into Chunks",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
176,
400
],
"parameters": {
"options": {},
"chunkSize": 1500,
"chunkOverlap": 300
},
"typeVersion": 1
},
{
"id": "cd2650ba-83e2-4d7d-8c53-1329ed635cfc",
"name": "Generate Embeddings",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
544,
384
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "b6ef7793-ebbd-4a06-af68-32e9c3794a1b",
"name": "Chat with a RAG Agent",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
704,
-128
],
"parameters": {
"options": {}
},
"typeVersion": 1.3
},
{
"id": "70a167d6-f1ee-491c-afed-da4ba1d6f16c",
"name": "Answer Questions",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
880,
-128
],
"parameters": {
"options": {
"systemMessage": "=You are a helpful AI assistant with access to a document knowledge base. Your primary role is to answer user questions based strictly on the information found in the documents.\n\nCRITICAL: You MUST use the document search tool for ANY question that could be answered from documents, even if you think you know the answer from your training data.\n\nGuidelines:\n- ALWAYS search the document knowledge base first before answering questions\n- Even if a question seems general, check the documents first - they may contain specific information\n- Base your answers ONLY on information retrieved from the documents\n- If the documents contain relevant information, use it and ALWAYS CITE the source with a link. If no link can be found, provide the source without the link.\n- If you cannot find the answer in the documents after searching, clearly state: \"I searched the available documents but could not find this specific information\"\n- NEVER answer factual questions from your general knowledge if they could relate to document content\n- If the user's question is unclear, ask for clarification\n- When providing factual information (dates, numbers, names, specific facts), include a SHORT direct quote from the document to verify accuracy\n- Format quotes like this: \"According to the document: '[exact quote]'\"\n- Keep quotes concise - just enough to verify the specific fact\n\nBe accurate, concise, and honest about the limitations of the available information.\n\nAlways include brief quotes for factual claims.\n\nRemember: Your purpose is to help users find information IN THE DOCUMENTS, not to provide general knowledge. Always search first. The documents may contain specific information that differs from general knowledge.\n\nIMPORTANT for broad questions:\n- Questions like \"Do any documents mention X?\" or \"Which documents discuss Y?\" require checking ALL relevant documents\n- Review search results carefully - multiple documents may contain relevant information\n- If you find information in one document, check if others also mention the topic\n- Acknowledge ALL documents that contain relevant information, not just the first one you find\n\nThe knowledge base contains business correspondence, legal documents, and technical guides. Use the search tool to find relevant information from these sources.\n\nWhen answering:\n- Provide direct answers first\n- Reference the source document (e.g., \"According to the NIST guidelines...\")\n- Use bullet points for multiple pieces of information\n- ALWAYS CITE the source in the following format: Source: ..."
}
},
"typeVersion": 2.2
},
{
"id": "f5ac0196-4f61-407b-8296-756a615c1eab",
"name": "Generate Response",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
784,
48
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {
"temperature": 0.4
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "5a43b619-64d5-4175-b198-a8699ce3ba89",
"name": "Search Documents",
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"position": [
1088,
48
],
"parameters": {
"mode": "retrieve-as-tool",
"topK": 10,
"options": {},
"toolDescription": "This tool searches the document knowledge base. Use it to retrieve specific information, facts, quotes, or details that are stored in the uploaded documents. This tool retrieves relevant content when answering questions that require specific facts or details from uploaded documents. The information is retrieved based on semantic similarity to your query.",
"qdrantCollection": {
"__rl": true,
"mode": "list",
"value": "n8n-rag-tutorial",
"cachedResultName": "n8n-rag-tutorial"
}
},
"credentials": {
"qdrantApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "15d06ecd-8c45-4c61-acbe-52f9d1bf9410",
"name": "Store Conversation",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
944,
48
],
"parameters": {
"contextWindowLength": 20
},
"typeVersion": 1.3
},
{
"id": "b870df36-8eda-4058-9f9a-7acb256fe7ba",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
-240
],
"parameters": {
"color": 7,
"width": 992,
"height": 768,
"content": "## 1. Import your data and store it in a vector database\nUpload files to Google Drive \u2192 convert to Markdown \u2192 chunk text \u2192 create embeddings \u2192 store in **Qdrant vectore store**. \n\n"
},
"typeVersion": 1
},
{
"id": "49bf36b8-92cc-481f-805a-391030cba5a6",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
592,
-240
],
"parameters": {
"color": 7,
"width": 736,
"height": 768,
"content": "## 2. Chat with your data\nAsk the **RAG Agent** via chat interface \u2192 retrieve relevant chunks from the **Qdrant vectore store**\u2192 generate contextual responses."
},
"typeVersion": 1
},
{
"id": "ebb07d79-f2ad-494c-97ad-660f42b67b92",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-976,
-240
],
"parameters": {
"width": 560,
"height": 768,
"content": "# Build a RAG Agent with n8n, Qdrant & OpenAI\n\nThis template creates a **RAG agent** that answers questions from your uploaded documents. It consists of who parts: **Data Pipeline** and **RAG Agent**.\n\n## How it works\n### Data pipeline\n\n- **Webhook trigger**: detect new files in the [Google Drive folder](https://drive.google.com/drive/u/2/folders/1BevhU5qdgNDFbK4D9oAYGeK0Dt5sEaxQ)\n- **Qdrant vector store**: chunk text, create embeddings with metadata and save them for semantic search\n\n### RAG Agent\nOnce the **Qdrant** database is created, start the chat. **RAG agent** retrieves relevant chunks from the vector store and generates answers with a GPT-4o model.\n\n## How to set up\n\n### 1. Import the template to your n8n instance and set up **credentials**\n\n- **Google Drive** (via Google Cloud Console); add them in the Trigger node\n- [Qdrant API](https://qdrant.tech/) key (create Cluster first)\n- [OpenAI](https://platform.openai.com/api-keys) key\n\n### 2. Upload files to your Google Drive\n### 3. Activate the workflow, it will catch the added files. \n"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "c6087208-31b7-4436-83f7-7694583be27a",
"connections": {
"Add Metadata": {
"main": [
[
{
"node": "Insert into Vector Store",
"type": "main",
"index": 0
}
]
]
},
"Detect New Files": {
"main": [
[
{
"node": "Download as Markdown",
"type": "main",
"index": 0
},
{
"node": "Add Metadata",
"type": "main",
"index": 1
}
]
]
},
"Search Documents": {
"ai_tool": [
[
{
"node": "Answer Questions",
"type": "ai_tool",
"index": 0
}
]
]
},
"Generate Response": {
"ai_languageModel": [
[
{
"node": "Answer Questions",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Split into Chunks": {
"ai_textSplitter": [
[
{
"node": "Load File Content & Metadata",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"Store Conversation": {
"ai_memory": [
[
{
"node": "Answer Questions",
"type": "ai_memory",
"index": 0
}
]
]
},
"Generate Embeddings": {
"ai_embedding": [
[
{
"node": "Insert into Vector Store",
"type": "ai_embedding",
"index": 0
},
{
"node": "Search Documents",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Download as Markdown": {
"main": [
[
{
"node": "Add Metadata",
"type": "main",
"index": 0
}
]
]
},
"Chat with a RAG Agent": {
"main": [
[
{
"node": "Answer Questions",
"type": "main",
"index": 0
}
]
]
},
"Load File Content & Metadata": {
"ai_document": [
[
{
"node": "Insert into Vector Store",
"type": "ai_document",
"index": 0
}
]
]
}
}
}
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.
googleDriveOAuth2ApiopenAiApiqdrantApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This template helps you to create an intelligent document assistant that can answer questions from uploaded files.
Source: https://n8n.io/workflows/11468/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Alfred (funcional). Uses gmailTool, googleCalendarTool, gmail, embeddingsOpenAi. Event-driven trigger; 83 nodes.
This comprehensive workflow bundle is designed as a powerful starter kit, enabling you to build a multi-functional AI assistant on Telegram. It seamlessly integrates AI-powered voice interactions, an
This intelligent chatbot leverages cutting-edge financial APIs and AI-driven analysis to deliver comprehensive stock research reports. Get instant access to professional-grade investment analysis that
This n8n template automatically classifies incoming emails (Sales, Support, Internal, Finance, Promotions) and routes them to a dedicated OpenAI LLM Agent for processing. Depending on the category, th
Automate Outreach Prospect automates finding, enriching, and messaging potential partners (like restaurants, malls, and bars) using Apify Google Maps scraping, Perplexity enrichment, OpenAI LLMs, Goog