No Code RAG Agents? You HAVE to Check out n8n + LangChain
Summary
TLDRThis video demonstrates how to create a full-fledged RAG (Retrieval-Augmented Generation) AI agent without writing any code, using n8n, a workflow automation tool, and LangChain, an AI development library. By integrating Google Drive as the knowledge base, the AI agent can answer questions from stored documents. The creator walks through building this no-code agent step-by-step, leveraging n8n's workflow features, including triggers, actions, and LangChain’s tools for chat memory and vector databases. Viewers can download the workflows and easily implement the solution themselves for powerful AI-driven automation.
Takeaways
- 🤖 Building AI agents using RAG (retrieval-augmented generation) can be done without coding by using n8n and LangChain.
- 🔧 n8n is a no-code workflow automation tool that allows users to create advanced AI agents with tool calling and RAG.
- 📂 The AI agent can utilize Google Drive as its knowledge base by uploading documents for the agent to access and answer questions.
- 💡 n8n workflows are simple to set up, consisting of triggers and actions that connect to AI models, databases, and external tools like Google Drive.
- 🚀 The LangChain AI agent node in n8n simplifies complex tasks like tool calling, memory management, and interaction with vector databases.
- 💬 The n8n interface provides a built-in chat window to easily test and iterate AI agents directly within the UI.
- 📄 Users can customize their vector databases and memory settings, with options to store data locally or use services like Supabase and Pinecone.
- 🔄 AI agents can retrieve documents from the vector database, which are indexed based on user queries and stored as vector embeddings using OpenAI models.
- 📊 Workflow nodes allow integration with Google Drive, enabling the AI agent to find, download, and add files to its knowledge base.
- 🌐 The workflow can be embedded into websites, allowing users to deploy the AI chatbot with RAG capabilities via a simple HTML embed code.
Q & A
What does the speaker mean by 'RAG AI agent'?
-RAG stands for Retrieval-Augmented Generation, a technique used in AI where external data, like documents, are retrieved and incorporated into a language model's responses. In this case, the speaker builds a RAG AI agent using Google Drive as a knowledge base, allowing the AI to answer questions based on uploaded documents.
How does n8n help in building AI workflows without code?
-n8n is a no-code workflow automation tool that allows users to build complex AI workflows by connecting different nodes, such as triggers and actions. It integrates with tools like LangChain, enabling the creation of RAG AI agents without writing code. Users can import or create workflows, including those for AI agents, using simple drag-and-drop functionality.
What role does LangChain play in the workflow?
-LangChain is a library for AI development that simplifies the integration of advanced AI capabilities like tool calling and memory. In the workflow described, LangChain powers the AI agent by enabling it to interact with tools, handle memory, and retrieve information from a vector database without requiring manual coding.
What is the benefit of self-hosting n8n over using services like Zapier?
-Self-hosting n8n offers significant cost advantages, as users can avoid expensive monthly fees associated with services like Zapier. Additionally, it provides greater control over the workflows and scaling capabilities, allowing users to customize and expand their setup without restrictions.
What is the significance of using a vector store in the AI agent?
-A vector store is crucial in RAG workflows because it allows the AI agent to retrieve and store document embeddings as vectors. This enables the AI to efficiently search for and retrieve relevant documents based on user queries. In the speaker's setup, the vector store holds documents from Google Drive, which the AI uses to answer questions.
How does the AI agent retrieve documents from Google Drive?
-The AI agent is programmed to search for files in Google Drive using a query provided by the user. It downloads the file, extracts the text, and stores it in the vector database for future use. The AI agent can later retrieve this information to answer questions based on the content of those documents.
Why is Superbase recommended for production use?
-Superbase is recommended for production environments because it provides a more scalable and robust solution for managing both chat memory and vector storage. Unlike the in-memory storage option, which is more suitable for local or demo purposes, Superbase can handle larger datasets and ensures better data persistence and synchronization across workflows.
What options does the AI agent offer for different language models?
-The AI agent supports multiple language models, including OpenAI's GPT models, Anthropic's Claude, Meta's Llama, and Grok. Users can select the model based on their needs and easily configure the credentials for accessing these models.
What is the purpose of chunking documents when adding them to the vector database?
-Chunking documents into smaller parts (in this case, 1,000 characters) helps optimize the retrieval process. When a document is queried, the AI searches the vector database for the most relevant chunks, making the process more efficient and accurate than trying to retrieve an entire large document at once.
How can the AI agent be embedded into a website?
-The AI agent can be easily embedded into a website using a code snippet generated by n8n. The speaker demonstrates how to copy the code and insert it into an HTML editor or website, creating a chat widget that allows users to interact with the AI agent directly on the site.
Outlines
🤖 Building an AI Agent without Code Using n8n and LangChain
This paragraph introduces the concept of creating advanced AI agents using RAG (Retrieval-Augmented Generation) without writing any code. The speaker plans to demonstrate how to use the no-code workflow automation tool n8n in combination with LangChain to build an AI agent that answers questions using documents stored in Google Drive. They emphasize that even though they enjoy coding, using no-code tools like n8n can be more efficient for many projects.
⚙️ Workflow Automation with n8n: Triggers and Actions
The paragraph explains how workflows in n8n are structured around triggers and actions. Triggers start the workflow, such as receiving a chat message, while actions execute tasks, like interacting with AI models or Google Drive. The user can easily add a chat window in the UI for testing purposes. The LangChain integration in n8n simplifies setting up AI agents by automatically providing tools, memory, and chat models. It supports multiple AI models like OpenAI and others, making it versatile for various applications.
🧠 Integrating RAG: Tools and Vector Stores
This section covers the integration of custom tools and vector stores into the RAG agent. The speaker explains how n8n offers built-in tools like a vector store, which stores and retrieves documents based on user queries. They recommend using Superbase for production environments to manage both chat memory and vector stores. For quick demonstrations, everything is stored locally in memory, with embedding models using OpenAI for document processing. The speaker highlights the flexibility of n8n, which allows for customizing workflows and tool usage without writing code.
📂 Managing Documents with Google Drive and Vector Databases
This paragraph dives into how documents from Google Drive can be added to the RAG agent's knowledge base. A specific workflow is set up to search, download, and add documents to the vector database for future queries. The speaker demonstrates how users can instruct the agent to retrieve and store relevant files from Google Drive. They also explain the importance of controlling which documents get added to the knowledge base to avoid bloating the vector database. The process involves setting up parameters for querying Google Drive and handling the text extraction and embedding tasks.
🔄 File Querying and Knowledge Base Testing
Here, the speaker tests the AI agent’s functionality by asking it a question that it cannot answer initially because the required document hasn’t been added yet. After adding the document from Google Drive to the knowledge base, they repeat the question, and the agent retrieves the correct information. This test showcases how the AI agent can dynamically add files to its knowledge base and answer questions based on the newly added data. They also mention the option of scheduling automatic updates to the vector database.
🔧 Workflow Troubleshooting: Handling Workflow IDs and Memory Keys
The speaker discusses a technical issue in n8n where the workflow ID used to call tools must differ from the ID of the main workflow, resulting in errors if not handled correctly. The workaround involves setting up a separate workflow to reference the correct memory key when interacting with the vector database. This ensures that data retrieval and insertion use the same workflow, avoiding conflicts. They explain how using Superbase as a vector store eliminates this issue by allowing dynamic memory key management.
🌐 Embedding Chatbots in Websites and Future Plans
This final section demonstrates how to embed the AI chatbot into a website using a simple code snippet. The speaker highlights how the chat widget can interact with users and answer questions based on the RAG integration. They conclude by teasing future content, focusing on deploying the system into production environments and integrating with Superbase. They encourage viewers to provide feedback and express interest in more advanced tutorials on RAG and no-code AI development.
Mindmap
Keywords
💡RAG (Retrieval-Augmented Generation)
💡n8n
💡LangChain
💡Vector Database
💡Google Drive Integration
💡Chat Memory
💡Embeddings
💡No-code AI Development
💡API Integration
💡Superbase
Highlights
Using n8n and LangChain, you can build a full-blown RAG AI agent using Google Drive as a knowledge base with zero coding required.
n8n is a workflow automation tool that is self-hosted, scalable, and cheaper than alternatives like Zapier.
RAG (Retrieval-Augmented Generation) AI agents can be built simply with n8n, integrating directly with LangChain for advanced AI development.
The agent can retrieve documents from Google Drive and answer user queries by utilizing a vector database and LangChain’s capabilities.
The no-code approach allows for rapid AI agent development, using pre-built workflows that handle chat models, memory, and document retrieval.
Testing the AI agent is easy with a built-in chat window in n8n, allowing real-time feedback and adjustments.
You can use multiple chat models like OpenAI, Claude, Grok, or LLaMA for flexible integration in the AI agent setup.
Custom tools can be added to the AI agent workflows in n8n, including any n8n workflows packaged as tools for multi-step processes.
Google Drive documents can be added dynamically to the AI agent's knowledge base via vector store retrieval, ensuring precise control over what information is accessed.
The integration allows vector databases to store chunks of documents for later retrieval, ensuring efficient RAG-based answers.
Using embeddings from OpenAI’s text models, documents are processed into vectors for effective knowledge retrieval.
The workflow includes an option to search for Google Drive documents by query, download them, and add them to the vector database for RAG integration.
A workaround is required in n8n to call a secondary workflow for vector database operations, ensuring seamless data insertion and retrieval.
The embedded chat interface can be added to any website, offering a smooth user experience while interacting with the AI agent.
This no-code workflow setup can be scaled to production using tools like Supabase for both chat memory and vector storage, further enhancing the AI’s capabilities.
Transcripts
building Advanced AI agents with rag is
definitely not something that's limited
to complex and custom coded applications
today I'm going to show you how to use
my favorite workflow automation tool n8n
along with my favorite library for AI
development Lang chain to build a
full-blown rag AI agent using my Google
Drive as my knowledge base so the agent
can answer questions using the documents
that I upload and when I say no code I
mean that today we are literally going
to write zero lines of code to build our
AI agent and don't get me wrong I love
to code my own agents but I would be
dumb to code them myself every single
time when a lot of the times I can make
them very simply without code using n8n
n8n is a workflow automation tool
similar to make.com or zapier but it is
way better because you can self-host it
so you don't have to pay hundreds and
hundreds of dollars a month like I did
at one point for zapier and you can
scale it infinitely so definitely more
on that in a future video but on top on
top of that which already makes n8n
amazing it integrates directly with Lang
chain so it is so so easy to build AI
agents that are really powerful with
tool calling and rag just like what I'm
about to show you now so without further
Ado let's get right into the meat of it
and see how easy it is to build a rag
agent with no code all right so I have
already fully built out these NN
workflows for my rag AI agent because I
just want to walk through it with you
very very smoothly to give you a lot of
value very quickly you can also steal
these workflows from me if you want I've
got a link to a GitHub repository in the
description of this video so you can
download these workflows as Json files
and then you go into your own n8n
instance in the top right here you click
on the three dots and then import from
file and in seconds you can bring in
this entire workflow into your own n8n
instance so you can take this further
and build something amazing with Rag and
so with that we can actually dive into
what this workflow looks like so just
like with make.com and zapier every
workflow in N an is made up of two four
parts you have your triggers which is
what starts these workflows and then you
have your actions the nodes within the
workflow that actually do things like
interacting with AI or your Google drive
or your vector database whatever it
might be so the trigger for this and and
workflow is a chat input so when chat
message received if you click into this
the options are quite simple you just
give authentication optionally then also
the initial message that's going to be
there in the chat widget for the user
when they first click on it to interact
with the agent in a chat bot and then
when you add this as a trigger to an NA
end workflow you're immediately given
this option in the bottom middle here to
open up a chat window and this is one of
my favorite Parts about n it makes it so
easy to quickly test your AI agents
because you have a chat window directly
in the UI to test things out as you're
iterating on the prompt or the tools or
the vector database whatever it might be
so this just makes it so easy to test
things and iterate on things and so
we'll even be looking at this later when
I give a demonstration of this AI agent
with Rag and so we have our trigger here
that I just covered and when there's a
chat message that comes through it flows
immediately into our rag AI agent which
is a tools agent that uses Lang chain
under the hood and so the way that I
know that this uses Lang chain aside
from just the documentation telling me
if I click on the plus icon here to add
a new node to the workflow and I search
for Lang chain sure enough AI agent
which that's the node that I chose here
is the second option and this just does
everything for me I don't have to code
anything to have my tools my memory and
my chat model if I want to get more
custom with it I can use the Lang chain
code node to actually code things if I
want something more robust that maybe no
code can't do for me because no code
can't do everything but it can do most
things and so with this use case I can
just use the AI agent from laying chain
here and it's got everything for me it's
got the chat model so I'm using open AI
in this case and I can use any model
that I want it's really easy to set up
my credentials as well I just need an
API key
and then also if I wanted a different
chat model I can click on this connector
here I could use claw if I want to
select anthropic I could use grock for
llama 3.1 I could use ol llama um open
AI like I already have selected pretty
much everything that I actually care
about is here already and so even if
there's something else like if I wanted
to use fireworks for example maybe I
could set up custom code here but for
most cases I'm happy with everything
here so it is just amazing no code
needed for all these Integrations and
then also for the chat memory there's a
lot of options for that so I'm just
using chat memory which is basically
going to be stored locally on my n
instance um but there are other options
as well so if I click on the memory
connector here we could use something
like postgress chat memory so having a
SQL table that manages all the
conversations or using reddis for
example a lot of options here as well
and then for the tool calling the best
part of the AI agent where we actually
have the rag integration there are a lot
of options for Tool as well so if I
click on this connector there are a lot
of custom tools that are already
provided for you like a calculator or a
vector store which is how I actually
retrieve the documents to answer
questions with rag um and then my
favorite part is you can literally call
any n8n workflow as a tool and so you
set up a workflow to do something like
interacting with Google Drive and a
multi-step workflow which I'll show a
little bit and then you just tell the AI
agent how to use this workflow like what
parameters to give and then also you
tell it when to use that workflow just
like you would with any tool that you
might Define in custom code and so you
can literally have all the power of any
na workflow you want even if there's a
ton of steps there just packaged as a
neat little tool that you can just shove
onto your rag AI agent and so yeah just
really cool stuff um and so there's two
tools that I have here for this agent
the first one is that built-in Vector
store tool where I retrieve the
documents based on a user query um to
answer a question or something like like
that and so I add this on as a tool
that's connected here and then it asks
me to supply a vector store and so I'm
just using an in-memory Vector store so
similar to my chat memory it's going to
just be stored locally on my n8n
instance so there'll be like files that
are there on the server that I am
hosting my n8n there are other options
as well though so you could use um for
example a sua base Vector store or a
pine cone Vector store uh if you want my
recommendation I would actually highly
recommend to go with super base here and
the reason that is if I go back to the
chat memory here this is just a nice
little gold nugget for you here uh you
can use a super based postgress table
for your chat memory and then you can
also set up a superbase vector store so
you can have everything managed for your
Rag and your chat memories all within
one place in super base so that's my
recommendation if you want to take
something like this to production but
just for a quick demonstration purpose
here I'm running everything locally for
my memory and my Vector store uh and
then for your embedding models there's a
lot of options for that as well I'm just
using open AI for my embeddings as well
so same credentials and then I'm just
using the text embedding three large
model uh from open AI for my embedding
so that's what actually takes the
different chunks of documents that I put
into my Vector database and turns them
into vectors for retrieval
later um and then on top of that I have
a model that's associated with this tool
to retrieve information so I'm just
using the same uh GPT 40 mini here as
well um because you're going to get the
documents from the vector database and
you need a large language model to
process that and pick out the right
information and so I'm using GPT for
that again as well so that is everything
for the rag retrieval the actual
retrieval part of rag now to put
documents in the vector database
knowledge base I have another tool here
and this is a NN workflow as a tool like
I was mentioning earlier and so the way
that my chatot works here and you could
take this in a milon different ways is
it's going to start out with nothing in
the vector database but I have infinite
access to my Google Drive so I can talk
to my AI chat bot and say I have this
file in Google Drive I want you to add
it to your knowledge base for future
reference and so what it's going to do
for this tool here is I have a little
description that says use this to search
for a file in Google Drive so the user
might say I want my meeting notes from
last week to be added to the knowledge
base so it'll search for those meeting
notes in Google Drive download it and
add it to the vector database knowledge
base for future querying so that's the
description to tell my AI agent when to
use this tool and then I have parameters
so in a Json example here I tell the AI
agent what parameters to give this
workflow so that it can execute properly
and so in this case I'm just giving one
parameter here which is a query how are
you going to search Google drive to find
that file to download and then add to
the vector database very very simple
couple of other options here like the
workflow ID so this tells it what
workflow and na end to actually execute
for this tool and then also the field
that's going to be outputed from that
workflow that you want to use as the
response that would then tell the large
language model what happened when it
invoked that tool very very simple stuff
and so the workflow that I have for this
is actually this one right here so it
starts out with a web hook and so this
gets the query and then it passes it
into the Google Drive and so let me
click into this and show you it's going
to search for a file or a folder based
on the query here and so if you search
for um 822 meeting notes for example it
would find that word doc file that has
those meeting notes in your Google Drive
and then on the next action it's going
to download that file then after it
downloads it it's going to extract the
text from that file and so now at this
point in the workflow I have all the
text from that file that I've downloaded
from Google Drive and I can now put it
into my Vector database so it's added as
the knowledge base so the AI agent can
use that to answer questions later and
so for this I'm just using the same user
documents memory key so the way that I
retrieve my documents is using this
memory key and the way that I insert
documents is also using this key
otherwise those two things are not going
to sync up um and then it's kind of a
similar setup here where I just have to
choose my embeddings which I'm going to
use gbt 40 or not gbt 40 that's for the
llm I'm going to use the text 3 large
and beddings from open Ai and then I
have a default data loader so this is
going to basically Define how I take my
text and put it as vectors in my Vector
database and so I'm going to split into
chunks basically just using a 1,000
chunk size text splitter so all the same
kind of stuff that you would see if you
were to code a rag agent yourself um but
you have all the power and customization
still within n with absolutely no code
and so I'm not really losing out on much
here doing it in a workflow with no code
which is the best part of it um and so
with all this together I can now test
this out a little bit so let me show one
quick thing here I'm going to go to a
couple of files that I have here for rag
I've got two meeting notes Here one from
822 and one from 823 and these this is
just fake data that I made up just to
have something here for rag um and so
what I'm going to do is I'm going to
tell my AI agent to add these to its
knowledge base and then I'm going to ask
a question that could only be answered
when it has this in its knowledge base
so I'm going to go back to my rag agent
here I'm going to save it and then I'll
go to the chat window in the bottom
middle and first I'm going to ask it a
question that it shouldn't know at this
point because it doesn't have these
meeting notes in its knowledge base I'm
going to say what are the action items
from the meeting on
8:22 and it's going to take a little bit
to get a response try to find it in the
vector database and sure enough I don't
have access to that specific um folder
or that specific file right here and so
I'll say okay cool uh find the
822 meeting notes in the drive and add
them to your knowledge base I don't have
to get really specific in my quest like
this but I'm just doing it right now to
absolutely make sure that it works for a
good demo here and there we go and that
was like super quick too which is also a
really huge plus with na it is as fast
so I have successfully added the meeting
notes to my knowledge base so now I'm
going to ask the exact same question
here and this time it's going to have an
answer and it's going to be based on
this file that we have here so the
action items from the meeting on 8:22 R
plan a budget make a bunch of money
everything that we have exactly right
here in our Google drive file so I
proved that it didn't have this
information before I showed in real time
how I was able to add it and then get an
answer from this document and the reason
you might want to do it this way the
other way you could do it is you could
just feed in every single file in your
Google drive into the vector database
automatically like every morning or
every hour something like that and then
that would be there automatically in the
knowledge base um but that when you do
it that way sometimes your vector
database can get bloated by a ton of
files that you don't necessarily want to
have available for Rag and so this way I
have control over exactly what I give to
my agent to have knowledge of later on
when I want to reference something again
in a conversation like maybe to remember
something like the action items here so
that's why I have it set it up this way
um but yeah there are a lot of ways that
you could do this the best part about n
is however you want to do it you can do
it very easily in these workflows like
it was it just took minutes to create
this workflow to find a file in Google
Drive download it and put it in the
vector database but you could set up
something similar that you'd run on a
schedule basis to uh maybe pull files
from a specific folder and constantly
hydrate your vector database with those
files there's a ton of things you could
do U so it's very very powerful stuff
the one thing that I wanted to mention
is that I have a second workflow
involved here and that is simply a
workflow to call this web hook so
there's kind of a little issue with naan
that's unfortunate but I found a really
solid work around here when you have a
tool that references a workflow ID you
can't reference the workflow ID of the
workflow that has the agent so I can't
just take what I have right here is my
workflow ID and dump that in here
because it gives some weird errors
saying that there's like not credentials
or something like that so you have to
reference a separate workflow
so I just have this workflow that then
hooks right back into um this web hook
within my original workflow um and the
reason you need to do that is because in
my in-memory Vector store here my memory
key it says here that it's prefixed by
the workflow ID to avoid Collision so if
I am inserting into a vector database in
a different workflow it's going to have
a different memory key because it's
prefixed by a separate workflow ID so I
have to have my retrieval be the exact
same workflow as
I have the insertions the data
insertions into the vector database
otherwise they'll be prefixed by
different workflow IDs and so that data
won't actually be available for the
agent so it's like a really really
technical thing that I just had to solve
but I have it solved for you now and so
that's why there'll be two workflows in
the GitHub repository um but yeah it's
just like a tiny little thing that you
had to do unfortunately um but however
if you were to use um a production
Vector database like super base then you
would't have to worry about this because
when you set up a a supera base Vector
store here as the tool for the regag AI
agent you get to define the memory key
in a more Dynamic way where it's not
going to be prefixed by the workflow ID
that's something that's just done for
the inmemory vector store so you
wouldn't have this issue and you could
actually have this whole tool to add a
Google drive file to a vector database
as that separate workflow instead of
having this weird workaround where you
need to invoke this separate workflow
that just hooks then right back into
this part of uh this whole workflow
setup that I have here so I hope that
makes s it's all Built For You at this
point so now you can just take these
workflows that I have steal them for
yourselves and expand upon this to make
the vector database production or to add
more tools or to improve upon the rag or
the prompts whatever you want to do this
is yours to play around with no code at
all and you can even embed this in a
website so I'll show that really quick
as well just to give you a lot here so I
can take um the embed so I go to more
info right here uh when I open my chat
window and I know that this is code we
didn't have have to write any code
though and you don't have to know code
to be able to embed this you can just
take this right here copy it you and you
can go over to your website I'm just
going to go to an online HTML editor
here you can paste it in here and then
when I click run I have this chat widget
in the bottom right like you see on a
lot of websites where I can click into
this and there we go we've got our chat
bot now and I can say something like Hi
how are you and then after it gives me
an answer super super fast um I can say
what are the action items from 820 too
and so that's going to again reference
the document with rag giv me the answers
because I've already inserted that into
the vector database super cool um so
yeah that's pretty much everything for
this
workflow um I'm definitely going to be
making more videos on rag with NN in the
future because this is super powerful
stuff and one thing that I'm probably
going to do is also focus on super base
and getting things deployed in
production so if you're interested in
that let me know I would really
appreciate knowing just so I can know
that that's something that you want to
see and then uh I'll probably make a
video on it so yeah more on rag to come
I hope that you found this useful and
that you're able to build really cool
things with Rag and N using this as your
foundation if you found this helpful I
would really really appreciate a like
and a subscribe and with that I will see
you in the next video
Weitere ähnliche Videos ansehen
Run ALL Your AI Locally in Minutes (LLMs, RAG, and more)
Cosa sono i RAG, spiegato semplice (retrieval augmented generation)
Crew AI Build AI Agents Team With Local LLMs For Content Creation
Using agents to build an agent company: Joao Moura
How I Automated My Workflow with AI Agent Teams (NO-CODE)
"How to give GPT my business knowledge?" - Knowledge embedding 101
5.0 / 5 (0 votes)