Stepthrough Start free

How to Do RAG in n8n: A Pinecone Chatbot That Cites Your Docs

Practice it step by step

Start the free practice

Take the free module: why it matters, practice and a quick check →

You do every step yourself in a practice copy of n8n. It checks your work as you go, and “Do it for me” finishes any step you get stuck on. Free, about 13 minutes, and nothing touches your real accounts. Open full screen

Quick answer

First load your documents into Pinecone. Then start a workflow with On chat message, add an AI Agent with a system message, an OpenAI Chat Model and Simple Memory, and add Pinecone Vector Store as its tool with Include Metadata on. Give the tool Embeddings OpenAI on the same model you loaded with, then test it in Open chat.

Last updated · Last checked

Free · Live nowRAG: chat with your own docsn8nPineconeOpenAI~13 min31 stepsAdvanced

Updated . Built against the tool’s current screens and checked step by step. How we check this lesson

Every policy question that lands in Operations' inbox costs someone time, and a generic chatbot that guesses is worse than no answer. A chatbot that answers from your own documents fixes that, but only if people can trust it. In this free lesson you build one in n8n: a chat trigger, an AI Agent with an OpenAI Chat Model and Simple Memory, and your Pinecone index connected as a tool. The system message makes it cite the handbook page for every answer and say "I don't know" when the handbook doesn't cover a question. It is part 2 of the RAG series and uses the index loaded in part 1.

At a glance

QuestionAnswer
What you buildBuild an n8n chat agent that searches your handbook in Pinecone before every answer, cites the page it came from, and says "I don't know" instead of guessing.
Toolsn8n
TimeAbout 13 minutes, 31 steps in 4 parts
LevelAdvanced
CostFree
Ways to learn itPractice it step by step, read the guide with screenshots

The 4 parts, in short

  1. Start the chatbot: Add the first step, On chat message, Close the node, Add the next step, and 6 more steps.
  2. Model and memory: Add a chat model, OpenAI Chat Model, Close the node, Add memory, and 2 more steps.
  3. Connect the handbook: Add a tool, Search for Pinecone, Pinecone Vector Store, Describe the tool, and 6 more steps.
  4. Test it: Open the chat, Ask about time off, Ask about expenses, Ask something the handbook doesn’t cover, and 1 more step.

Start here first: How to Create an Index in Pinecone and Load Your Handbook with n8n (module 1 of RAG: chat with your own docs)

In the course: Part 9 · n8n Automation Toolkit (Module 97 of the full course)

Part of: Business Automations with n8n (step 15 of 23). Next up: Guardian: Make Your n8n AI Agent Ask Before It Emails a Customer

Part of: Give AI Your Company Knowledge (step 14 of 15)

Part of: n8n Jump Start (step 18 of 27). Next up: Guardian: Make Your n8n AI Agent Ask Before It Emails a Customer

Part of: RAG: Chat with Your Own Docs (step 5 of 5)

Part of: Build Your Own AI Support Bot (step 8 of 11). Next up: How to Use n8n to Build AI Agents: A Support Agent That Answers from Your Docs

How to Do RAG in n8n: A Pinecone Chatbot That Cites Your Docs: step-by-step guide with screenshots

About the screenshots. They come from Stepthrough’s simulated practice environment (a practice copy of n8n), not the live tool, so no real account appears. The buttons and labels match the real screens the lesson was built against. Practice it yourself free at ynteractive.com.

  • Tools: n8n
  • Time: about 13 minutes, 31 steps in 4 parts
  • Level: advanced

Part 1: Start the chatbot

Step 1: Add the first step

In the last module you loaded the Cedar Ridge handbook into Pinecone. Now the payoff: a chatbot that answers staff questions from it, shows where each answer came from, and says I don't know when the handbook doesn't say.

The n8n workflow canvas in Stepthrough’s practice copy, step 1 of 31 (Add the first step): the cursor is on “Add first step”, highlighted.
Step 1 of 31. This is a new, empty workflow called Handbook chatbot. Click Add first step.

Step 2: On chat message

Pick On chat message. Every question someone types starts the workflow.

The n8n node list in Stepthrough’s practice copy, step 2 of 31 (On chat message): the cursor is on “On chat message”, highlighted.
Step 2 of 31. Pick On chat message.

Step 3: Close the node

The defaults are fine for testing. Close it.

An n8n node’s settings window in Stepthrough’s practice copy, step 3 of 31 (Close the node): the cursor is on “Close the node”, highlighted.
Step 3 of 31. The defaults are fine. Close it.

Step 4: Add the next step

The n8n workflow canvas in Stepthrough’s practice copy, step 4 of 31 (Add the next step): the cursor is on “+”, highlighted.
Step 4 of 31. Click the + after When chat message received.

Step 5: Search for the agent

The n8n node list in Stepthrough’s practice copy, step 5 of 31 (Search for the agent): “ai agent” is typed in, highlighted.
Step 5 of 31. Type ai agent.

Step 6: AI Agent

The n8n node list in Stepthrough’s practice copy, step 6 of 31 (AI Agent): the cursor is on “AI Agent”, highlighted.
Step 6 of 31. Click AI Agent.

Step 7: Add an option

It already reads the question from the chat. Now the rules.

An n8n node’s settings window in Stepthrough’s practice copy, step 7 of 31 (Add an option): the cursor is on “Add Option”, highlighted.
Step 7 of 31. Source for Prompt is Connected Chat Trigger Node, so it reads the chat. Click Add Option.

Step 8: System Message

System Message.

A dropdown menu in n8n in Stepthrough’s practice copy, step 8 of 31 (System Message): the cursor is on “System Message”, highlighted.
Step 8 of 31. Choose System Message.

Step 9: Write the rules

Three rules matter most. Search the handbook before every answer. End every answer with its source and page. And if the handbook doesn't say, answer I don't know, and point to a person. Never guess.

An n8n node’s settings window in Stepthrough’s practice copy, step 9 of 31 (Write the rules): the system message is ready to paste, highlighted.
Step 9 of 31. Replace the default You are a helpful assistant with this system message: search the handbook first, cite the page, and say I don’t know when it isn’t there.
You answer staff questions about Cedar Ridge Partners' policies in an internal chat.

Always search the handbook with your Pinecone tool before you answer. Answer ONLY from what the search returns.

Citations: end every answer with its source, like (Source: Cedar Ridge employee handbook, page X). Take the page number from the search results. If a result has no page number, leave the page out. Never make up a page number.

If the search results don't answer the question, say "I don't know" and that the handbook doesn't cover it. Never guess. Then suggest they ask Dana Whitfield in Operations (ops@cedarridge.example). An "I don't know" answer gets no source.

Keep answers to 2 to 4 sentences. No legal, tax or medical advice.

Step 10: Close the node

Close it.

An n8n node’s settings window in Stepthrough’s practice copy, step 10 of 31 (Close the node): the cursor is on “Close the node”, highlighted.
Step 10 of 31. Close the agent.

Part 2: Model and memory

Step 11: Add a chat model

Now give it a model to think with.

The n8n workflow canvas in Stepthrough’s practice copy, step 11 of 31 (Add a chat model): the cursor is on “+”, highlighted.
Step 11 of 31. Click the + under Chat Model.

Step 12: OpenAI Chat Model

OpenAI Chat Model.

The n8n node list in Stepthrough’s practice copy, step 12 of 31 (OpenAI Chat Model): the cursor is on “OpenAI Chat Model”, highlighted.
Step 12 of 31. Click OpenAI Chat Model.

Step 13: Close the node

Your OpenAI account is connected, and the model is G P T five mini. Fast and cheap, and plenty for this. Close it.

An n8n node’s settings window in Stepthrough’s practice copy, step 13 of 31 (Close the node): the cursor is on “OpenAI account”, highlighted.
Step 13 of 31. Your OpenAI account credential is selected, so Model shows gpt-5-mini. Close it.

Step 14: Add memory

Add memory, so a follow-up question makes sense.

The n8n workflow canvas in Stepthrough’s practice copy, step 14 of 31 (Add memory): the cursor is on “+”, highlighted.
Step 14 of 31. Click the + under Memory.

Step 15: Simple Memory

Simple Memory. It keeps the last few messages inside n eight n.

The n8n node list in Stepthrough’s practice copy, step 15 of 31 (Simple Memory): the cursor is on “Simple Memory”, highlighted.
Step 15 of 31. Click Simple Memory. It keeps the last few messages in n8n.

Step 16: Close the node

It takes the session from the chat trigger and remembers the last five exchanges. Close it.

An n8n node’s settings window in Stepthrough’s practice copy, step 16 of 31 (Close the node): the cursor is on “Session ID”, highlighted.
Step 16 of 31. Session ID comes from the chat trigger and Context Window Length is 5. Close it.

Part 3: Connect the handbook

Step 17: Add a tool

Now the important part. Give it the handbook.

The n8n workflow canvas in Stepthrough’s practice copy, step 17 of 31 (Add a tool): the cursor is on “+”, highlighted.
Step 17 of 31. Click the + under Tool.

Step 18: Search for Pinecone

The n8n node list in Stepthrough’s practice copy, step 18 of 31 (Search for Pinecone): “pinecone” is typed in, highlighted.
Step 18 of 31. Type pinecone.

Step 19: Pinecone Vector Store

The n8n node list in Stepthrough’s practice copy, step 19 of 31 (Pinecone Vector Store): the cursor is on “Pinecone Vector Store”, highlighted.
Step 19 of 31. Click Pinecone Vector Store.

Step 20: Describe the tool

Operation Mode is already set to retrieve documents as a tool. Now the description. The agent reads it to decide when to search, so say what's in the handbook.

An n8n node’s settings window in Stepthrough’s practice copy, step 20 of 31 (Describe the tool): the description is ready to paste, highlighted.
Step 20 of 31. Operation Mode is already Retrieve Documents (As Tool for AI Agent). Paste a Description so the agent knows what it searches.
Search the Cedar Ridge employee handbook: time off, holidays, expenses, hybrid and remote work, benefits, IT and conduct. Use it before every answer.

Step 21: Pick the index

Your Pinecone account is connected.

An n8n node’s settings window in Stepthrough’s practice copy, step 21 of 31 (Pick the index): the cursor is on “Pinecone Index”, highlighted.
Step 21 of 31. Your Pinecone account is connected. Open Pinecone Index.

Step 22: The handbook index

A dropdown menu in n8n in Stepthrough’s practice copy, step 22 of 31 (The handbook index): the cursor is on “stepthrough-tests”, highlighted.
Step 22 of 31. Choose stepthrough-tests, the index you loaded in the last module.

Step 23: Close the node

Limit is four. Each search brings back the four closest chunks. Include Metadata is on, and that carries the page number the citation needs. Close it.

An n8n node’s settings window in Stepthrough’s practice copy, step 23 of 31 (Close the node): the cursor is on “Limit”, highlighted.
Step 23 of 31. Limit is 4: each search brings back the 4 closest chunks. Include Metadata is on, which carries the page number. Close it.

Step 24: Add the embeddings

The question has to be turned into numbers too, so Pinecone can find the closest chunks.

The n8n workflow canvas in Stepthrough’s practice copy, step 24 of 31 (Add the embeddings): the cursor is on “+”, highlighted.
Step 24 of 31. The tool needs embeddings too. Under Pinecone Vector Store, click the + under Embedding.

Step 25: Embeddings OpenAI

Embeddings OpenAI.

The n8n node list in Stepthrough’s practice copy, step 25 of 31 (Embeddings OpenAI): the cursor is on “Embeddings OpenAI”, highlighted.
Step 25 of 31. Click Embeddings OpenAI.

Step 26: Close the node

Text embedding three small. It must be the same model you loaded with, or the search finds nothing useful. Close it.

An n8n node’s settings window in Stepthrough’s practice copy, step 26 of 31 (Close the node): the cursor is on “text-embedding-3-small”, highlighted.
Step 26 of 31. text-embedding-3-small, the same model that loaded the handbook. Close it.

Part 4: Test it

Step 27: Open the chat

Time to test it like a new hire.

The n8n workflow editor in Stepthrough’s practice copy, step 27 of 31 (Open the chat): the cursor is on “Open chat”, highlighted.
Step 27 of 31. Click Open chat.

Step 28: Ask about time off

First, a question the handbook answers. Ask about vacation days.

The n8n chat test panel in Stepthrough’s practice copy, step 28 of 31 (Ask about time off): the question is ready to paste, highlighted.
Step 28 of 31. Ask the first question.

Step 29: Ask about expenses

It searched Pinecone first, answered from the handbook, and named the page. You can check it in ten seconds. Ask another.

The n8n chat test panel in Stepthrough’s practice copy, step 29 of 31 (Ask about expenses): the question is ready to paste, highlighted.
Step 29 of 31. It searched Pinecone, answered from page 6 and cited it. Ask another.

Step 30: Ask something the handbook doesn’t cover

Page nine, three hundred dollars. Now the test most people skip. Ask something the handbook doesn't cover.

The n8n chat test panel in Stepthrough’s practice copy, step 30 of 31 (Ask something the handbook doesn’t cover): the question is ready to paste, highlighted.
Step 30 of 31. Page 9, with the $300 limit. Now the most important test: a question the handbook doesn’t answer.

Step 31: Close the chat

It searched, found nothing about bonuses, and said I don't know. No made-up answer. That's the rule doing its job. Close the chat.

The n8n chat test panel in Stepthrough’s practice copy, step 31 of 31 (Close the chat): the cursor is on “I don't know”, highlighted.
Step 31 of 31. It searched, found nothing about bonuses, and said I don't know instead of guessing. Close the chat.

Part of these free courses: AI for Customer Support, Give AI Your Company Knowledge, AI Automation with n8n: From First Workflow to AI Agents, Build Your Own AI Support Bot

Now do it yourself, free

Reading the steps is a start. Doing them is how it sticks. The interactive lesson puts you in a practice copy of n8n: you do every step yourself, it checks your work, and “Do it for me” finishes any step you get stuck on. Nothing touches your real accounts.

Practice “How to Do RAG in n8n: A Pinecone Chatbot That Cites Your Docs” step by step
Practice copy of the n8n chat testing a handbook chatbot: an answer citing the Cedar Ridge employee handbook, page 9, and an I don't know answer to a question about this year's bonus
Practice copy of the n8n chat testing a handbook chatbot: an answer citing the Cedar Ridge employee handbook, page 9, and an I don't know answer to a question about this year's bonus

What you will build

Cedar Ridge Partners, a made-up consulting firm, has its employee handbook in a Pinecone index from the previous lesson. If you have not built that index yet, start with How to Create an Index in Pinecone and Load Your Handbook with n8n. Now you build the internal chatbot staff ask instead of emailing operations. A new n8n workflow starts with When chat message received, then an AI Agent with an OpenAI Chat Model on gpt-5-mini and Simple Memory, so follow-up questions make sense.

The Pinecone Vector Store node becomes the agent's tool, in Retrieve Documents (As Tool for AI Agent) mode, with a Description that tells the agent what the handbook covers, your index, Limit 4 and Include Metadata on. Underneath it, Embeddings OpenAI uses text-embedding-3-small, the same model the handbook was loaded with. Then you test it: two questions it answers with a page citation, and one it must refuse.

The two rules that make it trustworthy

Citations: every answer ends with its source, like (Source: Cedar Ridge employee handbook, page 6). The page comes from the chunk's metadata, which is why Include Metadata stays on, and the rule forbids citing a page the tool didn't return. A PDF gives each chunk a page number; a Word file gives only line ranges, so the prompt tells the bot to leave the page out rather than invent one. Anyone can check an answer in seconds.

I don't know: if the search results don't answer the question, the agent says so and points to a person instead of guessing. Asked whether there is a bonus this year, it searches, finds nothing and says it doesn't know. Testing a question it must refuse is the step most people skip, and it is the one that tells you whether the rules hold.

Gotchas worth knowing

  • The tool needs its own Embeddings OpenAI node, on the same model the documents were loaded with. A different model returns poor matches.
  • The Description is what the agent reads to decide when to search. Say what the documents cover and tell it to use the tool before every answer.
  • Limit is how many chunks come back per search. 4 is a good start; raise it if answers miss details spread across sections.
  • Simple Memory keeps only the recent conversation. Each new chat session starts fresh.
  • To share the chat, open When chat message received, turn on Make Chat Publicly Available and publish. Tell people it's an AI assistant.

What you need

  • The Pinecone index from part 1, loaded with your document, and the Pinecone credential in n8n.
  • An n8n account and an OpenAI API key with a little credit.

Links

Try it yourself, free

Reading the steps is a start. Doing them is how it sticks. The interactive module walks you through every click in a practice copy of n8n, checks each step, and never touches your real accounts.

Start “How to Do RAG in n8n: A Pinecone Chatbot That Cites Your Docs”

Screenshots

Frequently asked questions

How do I create a chatbot with n8n?
Start with the On chat message trigger, add an AI Agent, and give it a chat model and Simple Memory so follow-up questions make sense. Click Open chat to test it. To share it, turn on Make Chat Publicly Available in the trigger and publish the workflow.
How do I use Pinecone for RAG?
Load your documents into a Pinecone index as chunks, then connect the index to an AI Agent as a tool. The agent searches it before every answer and gets back the closest chunks, 4 at a time in this lesson, with their page numbers. Search with the same embeddings model you loaded the index with.
How does the interactive lesson work?
Each step is shown to you first on the left (Watch). Then you do it yourself in a practice copy on the right (Your turn), and every click is checked. If you get stuck, press Do it for me. It is a practice copy, so no real accounts are touched.
Is this RAG?
Yes. Retrieval-augmented generation means the AI retrieves relevant passages from your documents and then writes its answer from them. Here the retrieval is a Pinecone search and the generation is the AI Agent's reply.
How do I make an n8n chatbot cite its sources?
Keep Include Metadata on in the Pinecone Vector Store tool so each chunk carries its page number, and add a system message rule: end every answer with its source and page, and never cite a page the tool didn't return.
How do I stop the chatbot from making things up?
Tell it to answer only from what the search returns and to say "I don't know" otherwise, then test it with a question your documents don't cover. It reduces guessing a lot, but spot-check answers in the first weeks.
Can I put the chatbot on our intranet or website?
Yes. In the chat trigger, turn on Make Chat Publicly Available. Hosted Chat gives you a link, and Embedded Chat lets you add the chat widget to a page.

Start this module free

More n8n tutorials

How to Create an AI Agent in n8n That Saves Ideas to Google Sheets: a step from the interactive moduleHow to Create an AI Agent in n8n That Saves Ideas to Google Sheets

Build an AI agent for BrightPath Marketing that generates social media post ideas and saves them to Google Sheets — chat trigger, AI Agent, system prompt, model…

Free · Live ~12 min Intermediate

How to Build in Lovable: A Web App with an n8n AI Backend: a step from the interactive moduleHow to Build in Lovable: A Web App with an n8n AI Backend

Build a contact form in Lovable and connect it to an n8n workflow — webhook trigger, AI Agent, Google Sheets, Gmail, and a Respond node that ties it all together.

Free · Live ~15 min Advanced

How to Do OCR in n8n: Read Receipt Photos into Google Sheets with AI: a step from the interactive moduleHow to Do OCR in n8n: Read Receipt Photos into Google Sheets with AI

Drop a photo of a receipt into an n8n chat. An AI agent reads it, pulls out the date, vendor and amount, picks a category, and adds a row to Google Sheets.

Free · Live ~12 min Intermediate

n8n AI Email Responder: Draft Gmail Replies Automatically: a step from the interactive modulen8n AI Email Responder: Draft Gmail Replies Automatically

Build an n8n agent that watches your Gmail, reads each new customer email, and writes a reply as a draft in the same thread, ready for you to check and send.

Free · Live ~12 min Intermediate

How to Make an n8n Workflow That Emails Each Tech Their Jobs from Sheets: a step from the interactive moduleHow to Make an n8n Workflow That Emails Each Tech Their Jobs from Sheets

Every morning at 7, n8n reads a plumbing company's jobs sheet, skips anything not assigned yet, and emails each job to the tech it's assigned to — customer, address…

Free · Live ~10 min Intermediate

The n8n inbox triage workflow: Gmail Trigger, a Text Classifier with Lead, Client and Invoice outputs wired to three label steps, then a Basic LLM Chain and Create a draft on the Client branchGmail AI Triage: Auto-Label Every Email and Draft Replies

Build an n8n workflow that reads each new email, sorts it as a lead, a client or an invoice with a Text Classifier, adds the matching Gmail label, and drafts a reply to…

Free · Live ~18 min Advanced

Plain-English definitions, each with an example from a free lesson.

Agentic RAGHybrid searchLangChainRerankingRetrieval-augmented generation (RAG)Top-k retrievalBasic LLM Chain (n8n)Chunking

The full AI glossary

Browse related tutorials