Your docs already have the answer. Your chatbot still makes one up.
RAG in n8n fixes that with two workflows. One loads your files into a vector store. The other answers chat from it, and for a first build that should be the Question and Answer Chain, because it searches your docs on every message.
We built it on self-hosted n8n and asked four questions. One popular setup never opened the docs.
Disclosure: n8n links here are affiliate links, so we may earn a commission. No result below depends on it.
What you’ll build, and what it costs
Two small workflows share one vector store. The first cuts uploaded files into chunks and stores each one as an embedding. The second embeds the chat question, pulls the closest chunks and hands them to a chat model.
That’s the whole RAG loop. If the theory is new, our RAG explainer for beginners covers it without a single n8n screen. This is the hands-on half.

What you need:
- An n8n instance: n8n Cloud, or the free self-hosted Community Edition
- An embeddings model and a chat model. OpenAI covers both with one API key. Ollama needs no key if you self-host
- Three to ten short test files, not your whole drive
- About 40 minutes
The bill is smaller than you’d think. n8n’s Starter cloud plan is €20 a month on annual billing, and each chat turn counts as one execution. Our n8n, Make and Zapier pricing breakdown shows how far that goes.
Embeddings cost almost nothing. OpenAI’s text-embedding-3-small charges $0.02 per million tokens. A 200-page handbook, about 133,000 tokens, costs under one cent to embed. The chat model is where the money goes.
How we tested it (and what we didn’t)
We ran n8n 2.45.4 self-hosted on a Linux box with no GPU. Ollama served the models: nomic-embed-text for embeddings, and two small Qwen2.5 chat models, 1.5B and 3B.
The knowledge base was three made-up bike-shop policies: refunds, shipping and warranty, 235 words in all. We asked four questions. Three had answers in the docs. The fourth, about gift cards, didn’t, so the right reply was “I don’t know”.
We didn’t test OpenAI or Claude models, PDFs, n8n Cloud or hosted vector databases. Anything here about those comes from n8n’s docs, checked on 28 October 2026.
Part 1: load your docs into the vector store
The loader is five nodes. Three of them hang off one Vector Store node as sub-nodes, and you’ll reuse the workflow every time your docs change.
Build the document loader
Form Trigger to Simple Vector Store, with three sub-nodes
-
Step 1 of 6
Add a Form Trigger with a file field
Create a workflow and add On form submission. Add one File field that accepts
.md, .txt, .pdf. A teammate can now upload docs without ever opening n8n. -
Step 2 of 6
Add a Simple Vector Store in Insert Documents mode
Connect the form to a Simple Vector Store and pick Insert Documents. Type a memory key such as
docs_kb. The chat workflow must use this exact key. -
Step 3 of 6
Attach an embeddings model
On the Embedding slot, add Embeddings OpenAI (text-embedding-3-small is plenty for policy docs) or Embeddings Ollama with nomic-embed-text. You’ll pick the same one again in Part 2.
-
Step 4 of 6
Attach the Default Data Loader
On the Document slot, add Default Data Loader. Set Type of Data to Binary, since the form sends files, and Text Splitting to Custom.
-
Step 5 of 6
Attach a Recursive Character Text Splitter
Set Chunk Size to 1000 characters and Chunk Overlap to 200. That matches n8n’s Simple setting, and it keeps a short policy file in one piece.
-
Step 6 of 6
Publish, upload, then count the chunks
Activate the workflow, open the form’s production URL and upload your files. In Executions, the Insert node lists every chunk it stored. Count them before you build anything else.
Why count chunks?
Our first run used 500-character chunks, and the refund file split in two: the heading alone, then the policy. That stray heading caused trouble later.
PDFs go through the same binary loader, though we only fed it Markdown. For web pages, our Firecrawl tutorial turns a site into clean text you can load the same way.
Part 2: answer questions from your docs
The chat workflow reads the store you just filled. n8n offers two ways to wire it, and they behaved very differently on the same docs.
Option A: the Question and Answer Chain (start here)
The chain embeds every question, fetches the closest chunks and passes them to the model. It never decides whether to search. It always does.
Wire the Q&A chain
Chat Trigger to Question and Answer Chain, with a retriever
-
Step 1 of 7
Add a Chat Trigger
Start a new workflow with When chat message received. Its test chat panel is enough for now. Make it public later if you want the chat on a site.
-
Step 2 of 7
Add the Question and Answer Chain
Connect it to the trigger and keep the prompt on the connected Chat Trigger. Swap triggers later and the field must still be called
chatInput, or you get a No prompt specified error. -
Step 3 of 7
Attach a chat model
Add OpenAI Chat Model, Ollama Chat Model or another model sub-node. Set temperature to 0 so answers stick to the text.
-
Step 4 of 7
Attach a Vector Store Retriever
On the Retriever slot, add Vector Store Retriever with a limit of 4 chunks. Without it, the chain won’t run.
-
Step 5 of 7
Point it at your store
Under the retriever, add a Simple Vector Store in Retrieve Documents (As Vector Store for Chain/Tool) mode, with the memory key from Part 1.
-
Step 6 of 7
Attach the same embeddings model
Use the identical embeddings node and model name from loading. A different model maps questions into a different space, and search returns junk.
-
Step 7 of 7
Test with a question the docs can't answer
Ask two questions your files answer and one they don’t. The third is the real test: a good build admits it doesn’t know.
Option B: the AI Agent with your docs as a tool
Here the agent gets your store as a tool and decides when to call it. It’s the setup in n8n’s RAG starter template. Pick it when the bot needs other tools too, like an order lookup.
Our first AI agent in n8n guide covers agent basics. For RAG, set the Simple Vector Store to Retrieve Documents (As Tool for AI Agent). Name it with letters, digits and underscores only (we used company_docs) and describe what’s inside.
Then give the agent a system message that forces the search:
You answer questions about our company using only the company_docs tool.
Always call company_docs before you answer.
If the answer isn't in the results, say you don't know.
Keep answers to two sentences.
Sounds airtight. On our smallest model, it wasn’t.
Agent or Q&A chain: which one answered correctly?
The Q&A chain on the 3B model got all four right, including “I don’t know” for gift cards. The agent on the 1.5B model didn’t search the docs once, despite “always call” in its instructions.
| Setup | Searched the docs | Fully correct | Reply time |
|---|---|---|---|
| AI Agent + 1.5B model | 0 of 4 | 1 of 4 (a guess) | 0.4 to 3.0 s |
| AI Agent + 3B model | 4 of 4 | 3 of 4 | 4.5 to 12.3 s |
| Q&A Chain + 1.5B model | 4 of 4 | 3 of 4 | 1.0 to 1.7 s |
| Q&A Chain + 3B model | 4 of 4 | 4 of 4 | 1.9 to 3.2 s |
The small agent told a customer a ridden bike could go back within 30 days. The docs say 14 days, minus a 10% restocking fee. It also declared that the shop doesn’t sell gift cards, which our files never say.

The 3B agent searched every time and got the core facts right. It still promised a free return label that the docs only offer on orders over Rs 5,000. It was also the slowest, because the agent spends extra model calls deciding on the tool.
Would GPT or Claude do better? Probably, since big hosted models handle tool calls far better than a 1.5B one. We didn’t test them. The chain takes the gamble away whatever model you run.
Our take: start with the Q&A chain. Switch to the agent only when the bot needs a second tool, and ask it something your docs can’t answer before anyone else does.
Four mistakes that broke our n8n RAG build
Each one showed up in our runs. None of them throws an error, which is what makes them nasty.
1. Uploading the same file twice doubles it
The Insert mode’s Clear Store option is off by default. We re-uploaded the refund file and the store grew from 4 chunks to 6, with every refund chunk stored twice.
With a limit of 4, duplicates can fill half the slots. Turn Clear Store on when you reload the full set, or upload only new files.
2. A heading chunk can outrank the answer
Our 500-character split left “# Refund policy (Northwind Bikes)” as its own chunk. For “refund for a ridden bike”, that empty heading scored 0.748. The chunk with the actual policy scored 0.744.
So the top result held no answer. Use 1,000-character chunks, or drop lonely title lines from short files.
3. A restart wipes the Simple Vector Store
We restarted n8n and asked about the carbon frame warranty again. The bot said it had no information, because the in-memory store was now empty.
n8n’s docs call it a development tool. On n8n Cloud it’s capped at 100 MB, about 8,000 documents. A store left untouched for 7 days is removed, and any user on the instance can read any memory key.
4. Chunks forget which file they came from
Every stored chunk was tagged source: blob, with no file name. Fine for answers, useless for “according to the warranty policy” citations.
The Default Data Loader has a Metadata option for this. We didn’t test it, but one file per upload, with its name added as metadata, is the obvious route.
When should you move off the Simple Vector Store?
Move when real users depend on the bot or your docs change weekly. Replace both Simple Vector Store nodes with a persistent store node and keep everything else.
| Store | Pick it if | The catch |
|---|---|---|
| Supabase (Postgres) | You want vectors in a database you can query | You set up a table and match function first |
| Pinecone | You want a managed vector database, no servers | One more account and bill |
| Qdrant | You self-host n8n and want vectors on the same box | You run and back it up yourself |
| PGVector | You already run Postgres for n8n | Needs the pgvector extension |
Check that the store’s vector size matches your embeddings model. Our nomic-embed-text vectors had 768 dimensions. OpenAI’s text-embedding-3-small makes 1,536 by default. Switch models later and you re-embed everything.
Where does MCP fit? RAG gives a model documents to read, while MCP gives it live tools to call. Our Model Context Protocol explainer covers that side, and a mature support bot often uses both.
Torn between self-hosting and Cloud? Our n8n review weighs both after real use.
Frequently asked questions
Can I build RAG in n8n without writing code?
Yes. Every step here is a node you configure in the editor, from the Form Trigger to the chain. You never open a Code node. The only typing is a memory key, a tool description and an optional system message.
Can I use n8n RAG with Google Drive or Notion instead of uploads?
Yes. Swap the Form Trigger for a Google Drive or Notion node that reads the files, then feed its output to the same Insert Documents node. Use the Binary data type for files and JSON for page text. We tested uploads only.
How do I keep the vector store in sync when a document changes?
Re-run the loader and clear old chunks first. With the Simple Vector Store, Clear Store wipes the whole key, so reload every file. Supabase adds an Update Documents mode for changing chunks by ID, which suits docs that change weekly.
Is my data private if I use OpenAI for embeddings?
Not fully. Your chunks and every question go to OpenAI’s API to be embedded, and the retrieved text goes to your chat model. For files that can’t leave your servers, self-host n8n and run Ollama models locally, as we did here.
How many chunks should the retriever return?
Start with 4. That gave our test bot enough context without padding the prompt. Try 6 to 8 for long manuals where an answer spans sections. More chunks mean longer prompts, slower replies and bigger bills on paid chat models.
Can I add the docs chatbot to my website?
Yes. Make the Chat Trigger public and n8n gives you a hosted chat page or an embeddable widget. Every message is one execution on n8n Cloud, so a busy widget drains a Starter plan faster than internal testing does.
Why does my n8n RAG chatbot say it doesn’t know?
Usually the store is empty or mismatched. Check that both workflows share the memory key and embeddings model, that n8n hasn’t restarted since loading, and that the Insert run stored chunks. If all three pass, raise the retriever limit and ask again.
Build the boring version first
A working RAG chatbot in n8n is two workflows: one fills a vector store, and a Q&A chain answers from it. Bring in the AI Agent only when the bot needs more tools than your docs.
One warning: always ask a question your docs can’t answer. Our smallest agent failed exactly that, and the happy-path questions would never have shown it.
Next step: open n8n, load three of your own files and count the chunks before you write a prompt.



