# Build RAG Workflow in n8n (with Pinecone) | Step-by-Step Tutorial | FREE TEMPLATE

Source: https://qvantx.com/insights/build-rag-workflow-in-n8n-with-pinecone-step-by-step-tutorial-free/
Author: Ani Björkström — QvantX Sweden AB, Stockholm
Published: 2025-09-29
Updated: 2026-09-20
Video: https://www.youtube.com/watch?v=DUjJmmUvX30 (8 min)
Topic: Automation

License: free to quote and cite with attribution to https://qvantx.com

---
_AUTOMATION_

## How Do You Build a RAG Workflow in n8n with Pinecone?

#### Key takeaways

- A RAG workflow answers only from documents you provide and says so when the answer is not there, unlike a plain LLM that risks hallucinating.

- Pinecone's free starter tier includes an Assistant: upload your documents, copy the connection code, and paste it into an n8n HTTP Request tool via import.

- Setting include_highlights to true plus a strict system message makes the agent cite the exact document and page behind each answer.

Retrieval-augmented generation, or RAG, is a practical way to make an AI agent trustworthy. In this walkthrough by Stockholm-based tech consultant Ani Björkström, you build an n8n workflow connecting an AI agent to a Pinecone assistant loaded with Snowflake documentation, then verify its answers against the source file.

### What is RAG and how is it different from a normal LLM?

RAG gives the model a defined set of documents to retrieve information from, and it will say it does not have an answer if the answer is not in those documents. A plain LLM such as ChatGPT answers from whatever it was trained on, so it will always produce an answer, with a real risk of getting it wrong. That failure mode is called hallucination, and constraining the agent to your own documents is the direct countermeasure.

### Why use a vector database like Pinecone?

A vector database stores words and word combinations as points in a multi-dimensional space, so terms with similar meanings sit close together: search for "jacket" and it can also return "coat". Pinecone is the choice here because it is not only a database but also offers an agent-connected assistant, and its starter tier is free. You log in, create an assistant in the Assistant section, and upload the files you want to query, in this case a Snowflake document.

### How do you connect Pinecone to the n8n agent?

Pinecone shows a connection code snippet under its Connect button; switch the language from Python to shell and copy everything except the API key. In n8n, create a workflow with an AI agent node, pick your LLM (Anthropic in this build), then add an HTTP Request tool and use its import function to paste the code, which populates the fields automatically. Two adjustments matter: map the tool's content field to the chat input by dragging it in, and set include_highlights to true for citations. Finally, give the agent a system message telling it to be very specific and to state which document and page each answer comes from.

| Workflow step | What it does |
|---|---|
| AI agent node | Receives the chat input and orchestrates the response using your chosen LLM |
| Pinecone assistant | Stores uploaded documents and retrieves relevant passages |
| HTTP Request tool | Connects the agent to Pinecone via the imported code and API key |
| System message | Forces the agent to cite the source document and exact page |

### How do you check the workflow is not hallucinating?

Ask a test question, such as "tell me about Snowflake share," then copy a phrase from the answer and search for it in the source document with Ctrl+F. In the tutorial, the response cited the exact page, and the checked text was found directly in the Snowflake documentation, confirming the agent retrieved rather than invented its answer.

#### FAQ

**Does Pinecone cost money for this setup?**

No. Pinecone has a free starter tier, and the assistant used in this workflow was created on it. Review Pinecone's documentation if you need more specific configuration later.

**Which LLM do I need to use in the n8n agent?**

Any LLM you like. The tutorial uses Anthropic with saved credentials; the retrieval work is handled by the Pinecone assistant.

**How do I get citations to show up?**

Set include_highlights to true in the HTTP request and instruct the agent in its system message to mention the document and page for every answer.


## Full video transcript

[0:00] Hey, my name is Annie. I'm a tech consultant based in Stockholm. And in this tutorial, I will help you to create an NHN workflow using RA. The first thing first, let's understand what is RA and how it is different compared to usual LLM. When we ask a question to chat GPD, which is an example of LLM, CHVD will answer based on the information it was trained on. However, if we are creating rack, we are giving rack certain database or documents to look and retrive information from and it will always say that it doesn't have an answer if it can't get the answer in those documents. Compared to that, LL for example GBT will always answer and there is a certain risk of answering wrong which we call hallucination.

[1:01] Now back to animate end and here what we will do we will create a whole new workflow together. So I will click on plus button then workflow and here we will choose agent. So this one and we'll double click on that. Okay, you can see that we have the chart and then we have the I agent here. We will enter a break for I agent and you can choose the LLM that you like to use. In my case, it's Antropic. So, I will just choose entropic and you can see that I already have my credentials to Antropic saved here. So, that will be added. Next what we need to do is we need to use a vector database where we will save our documents.

[1:57] Now the question is what is a vector database? Compare to general relational databases in vector databases we'll process every single word or combination words and we'll give them different vector points in multi-dimensional environments and for example different words that have similar meanings for example king and queen will be saved close to each other. So when we search certain words from vector databases, it will return words that are close to each other. So for example, if we search for jacket, it will also return code. So that's what vector database is. So in this tutorial, the choice of vector database for me is pine cone.

[2:47] And the reason I'm choosing Pineon is because it's not only a database, but it also has an agent connected database. So, Python also has a free section. So, you can just log in and use it in the beginning for free. You can see starter usage and you will go on assistant button and here you will create an assistant. You can call for example NM and you will just click on create assistant and that's it. Your assistant will be created and what you will do in here you will save the files that we want to use for rap here.

[3:33] So you will for example click here in my case I have snowflake document that I uploaded that I want to use for this purpose. So I will just save my snowflake document there. Here I will click import and document will be saved there. Okay. So you can see that snowflake documentation was uploaded and after that what we will do we will click on connect button and from here we will change Python to share and we will scroll down. You can see the code here that is used to connect to Python agent. So we will copy everything except icon API key and then we will go back to N10 and here you will need to create an HTTP request because this agent needs to be able to connect to Pyon and for doing that we will just click on the plus button and we will search for HTTP request tool.

[4:36] So here it is and here we can just click on import and we can just pass our code. If we click on import we can see that everything will be populated here which is amazing except the API. Another thing that we need to update in HTTP request is content. And content is basically what the user enters into the chat. So if we go here, if we go to mapping from here, you can see that the content should be chat input and in this case it's tell me about snowflake data share and how you will enter it here.

[5:21] You don't even need to type it. You can just drag this chat input into here. But I have already done that so I will not repeat it. So that is done. And another thing if you want your answer to include citations then you will even include this part include highlight is to true. You can get more information about this in Python documentation. And of course Pyon has an API documentation. So if you want to make this even more specific then you can just read Pyon documentation and update this based on your needs. So that is done. And another thing if we open I agent. So here we need to enter system message.

[6:06] So this is something that you need to update. And in this case I'm basically saying to Pyon tool to be very specific and to mention from which page and from which document it is returning the answer. So you can read it here. And of course I will be sharing this N10 template for free. So you don't need to type it on your own. So that's it and let's save this workflow and let's try to test it. I will ask about snowflake share. So I will ask question tell me about snowflake share and hit enter. And then after that let's see what is happening. You can see it says snowflake documentation. Okay it's giving basically all the pages that are in this document.

[6:54] It's specifying exact page but it still says what are the key features how it works for the agent. We can see what is then the exact output even here simply applies collaboration reduces storage application issues realtime access to Jassy data. You know what we can do? We can just copy this and we can open that document from where it is extracting the data the snowflake documentation and try to find this information to see if this information exist in the snowflake documentation or if our dragon lm is just hallucinating. So here if we do ctrl f and we will try to enter.

[7:43] Okay, here you can see so it was basically getting the information directly from this document and it wasn't hallucinating which is an amazing sign that our workflow works. Yes, but that is what I wanted to share with you. And as always, if you want to get this NAT template for free, just comment NAN down below in the comments and I will send you a link that you can use to get this template for free. And have a good day. Bye.
