STOP Building Dumb AI Agents – Do This Instead
FlowiseAI v3 TutorialRecent📅 2025-06-09
Build Process
┌─────────────────────────────────────────────────────────────────────┐
│ BUILD CHATBOT WORKFLOW │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ PLANNING │
│ ──────── │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Define │───►│ Choose │───►│ Setup │ │
│ │ Scope │ │ Stack │ │ Project │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │ │
│ ▼ │
│ DEVELOPMENT │
│ ─────────── │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Build │───►│ Add AI │───►│ Test & │ │
│ │ Features │ │ Logic │ │ Debug │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │ │
│ ▼ │
│ DEPLOYMENT │
│ ────────── │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ Deploy │───►│ Chatbot │ ◄── LIVE! │
│ │ to Cloud │ │ Running │ │
│ └─────────────┘ └─────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘Key Components
- Project architecture
- Core features implementation
- Best practices
Transcript
[00:00] Hey there and welcome back. In the previous video, we built this AI agent that's able to answer the user's questions by performing a Google search or by looking up the answers from a custom knowledge base. Basically what we did is if we expand this node we assigned a tool and more specifically the SER API tool which gives the agent Google search capabilities and for the custom knowledge base we assigned a document store which contains information related to this open barrel
[00:30] restaurant. These are not the only two options you have of getting custom data into your agent and that is what I want to focus on in this video. Flowwise actually provides several different ways in which you can pass custom knowledge into your agent and we will be covering all of those in this video. Now you're already familiar with two of those ways. We can assign tools and of course we can attach a document store. If you haven't seen the previous video then don't worry. We will be going through everything again in this video and we'll
[01:02] also cover the additional features like using this vector embedding section which allows you to attach an existing vector database and you will also learn how to add the ability to upload images and documents directly in the chat window and the user can then ask questions about the contents of those documents or images. Now before we make these changes in flow-wise, I do want to take a moment to discuss rag or retrieval augmented generation. So what
[01:33] exactly is retrieval augmented generation and why should you care? You could of course just simply blindly attach tools and knowledge bases to your agent without caring what the impact is. But if you are serious about building AI powered solutions using large language models, then this is a very critical concept to understand and it is quite simple. We have to understand how large language models are trained. So let's say LLM training. Large language models are trained on a lot of different data.
[02:06] Pretty much everything that's publicly available. So let's change the color of this line to green. And for argument sake, let's say this model has been trained on all the data that was made available since the year 2000 up until the year let's say 20 23. So this effectively means if you ask your agent questions within this time period, it should be able to give you an accurate answer. The issue, however, is if you ask a question past this date, the agent simply won't know the answer or even
[02:37] worse, it will hallucinate an answer for you. So this could include realtime data like asking about the weather or we could ask questions on content that was created only after this point. So the intent of rag is to inject additional context into the chat which will allow the model to more accurately answer the question. Let's visualize this on the left. Let's say this is our chat window or more specifically the prompt that we sent to the LLM. Now this prompt
[03:08] contains the question from the user. So this could be something trivial like what is my name? Now by default the LLM really wouldn't know how to answer this question. In fact let's try this. So inflow wise let's just do a quick rag explanation and let's add our agent. I'll just call this guy agent. Then let's select our model. And at this point I'm not going to add anything else. All we have is a vanilla agent
[03:38] using a simple LLM. So in the chat window, let's ask what is my name? Now the agent will try to answer the question based on its knowledge base. But because it's missing any context as to who I could be, it simply says, "Sorry, I don't know." So let's have a look at a few different ways that Rag could solve this problem. First is the system prompt. What we can do is assign a system prompt to this agent and in that prompt we can provide instructions and some context as well. So under
[04:11] messages under roles let's add the system role and now we can say you are speaking to Leon. Let's simply save this and let's start a new chat. And now we can ask what is my name? And look at that. Our agent was able to answer the question because we've provided that context. And if we expand process flow, we can open up start. And looking at the agent mode, we can see the system message was indeed injected into the prompt followed by the user's question.
[04:44] And therefore, the LLM was able to give us an answer. Besides for the system message, these prompts also contain chat history. The chat history is the back and forth conversation as it's happening within the chat window. Let me show you this. So in our agent, I'm actually going to change the system message to something like you are a friendly AI assistant. We're no longer providing the name as context in the system message. However, we do want to record and use
[05:15] the conversation history. So all I'm going to do is enable memory and watch what happens when we save this flow. I'm going to start a new conversation and let's start the conversation by asking what is my name? And of course it's saying I don't know your name. So therefore let's say my name is Leon. It's saying nice to meet you Leon. How can I assist you today? And now let's ask what is my name? And of course, it's
[05:46] saying your name is Leon. How can I assist you today? If we expand the process flow and look at the agent node, we can see the full conversation history over here. So, we see the system message. Then, we see the back and forth with the user and the assistant. Here we provided that context and therefore the LLM was able to answer the question based on the conversation history. Now I do consider the chat history to be a part of rag as we're still retrieving the conversation history from some sort
[06:16] of database and then injecting that into the prompt. Then finally we also have context. Now context can contain any additional information that the agent could use during this conversation. Let's actually add our agent over here. So we'll say agent and let's change the question to something like who won the 2025 Oscars. Now of course the agent doesn't know this because it's training cutoff might have been in 2024 or earlier and fun fact we can actually ask
[06:48] the LLM what is your training cutoff date and many of these models will actually tell you when the cutoff was. So let's change the question to who won the 2025 Oscars. Now the agent won't be able to answer that question since its training data doesn't include that answer. Our agent can now retrieve that data using tools and then inject any helpful information from those tools into this context. Now by default agents don't have any tools assigned to them.
[07:19] So what we can do in flowwise is assign a list of tools that the agent can use to perform actions and more importantly retrieve information. For our example, a Google search tool could be very useful. So what the agent will do is perform a Google search to retrieve the winners of the 2025 Oscars and the result of this tool call will then be injected into this context in the prompt. We can see that in action as well. So if we open up the agent, we can go to tools and within
[07:52] this list of tools, let's add the SER API tool. And this will give our agent the ability to perform a Google search. So in our chat window, let's ask who won the 2025 Oscars. And it will take our agent a second whilst performing this Google search. And indeed, we get our answer back. You will also notice that the search tool was called. And if we expand this process flow, let's have a look at our agent. You will notice that the agent had access to this tool. But looking at the prompt, we started off
[08:23] with our system prompt. Below this, we would have seen our conversation history if we had any. We then get the user's question. The assistant then realized that it doesn't have this answer from this training data and therefore it's calling the SER API tool and over here we can see the results from that tool call being injected into the prompt and this information was injected as context. So this block over here and this allowed the LLM to accurately
[08:53] answer this question. Now tool calls are not limited to performing Google searches either. Another popular use case is to get an agent to read your emails. That is rag as well. So you might assign a tool which will allow the agent to read your emails and inject the content of those emails into the context and that will allow the LLM to answer this question. We can also add vector databases. So let's say we've got a database containing all our contact information and the user asks something
[09:25] like what is Jane's email address? Now of course the agent doesn't know how to answer that question based on the context that's been provided up until now. So what the agent can do is reach out to a database containing our contacts. this database could retrieve a record containing Jane's email address and all of that context is added to the prompt. So at this point I think you do get the message rag is nothing more than giving the agent the ability to retrieve up-to-ate information added to the
[09:56] prompt as context and then getting the LLM to answer the question based on this context. So let's continue looking at the different ways that we can add rag to our flowwise agents. But what we can do as well is attach a custom knowledge base. There's pretty much two ways to do this. First, we can create a document store. Document stores are extremely powerful in FlowWise. It allows you to easily create a knowledge base. In fact, let's call this one something like invoices. And we can then add data to
[10:28] this knowledge base by using document loaders. There are many different types of loaders in Flowwise. We can fetch data from Air Table, call APIs, scrape it using Cheerio web scraper and much much more. Let's upload a PDF. So let's select PDF file. Then let's upload this sample invoice. Let's click on preview chunks. Now this document was split up into three chunks. The default behavior
[10:59] for PDF documents is to split it per page. The idea behind chunking is let's say we had a massive document. So we could be uploading a book of some sort. Now this book could be massive. It could be hundreds of pages of content or millions of words. When we ask a question about this book, the agent will actually go and retrieve that book and inject the entire book into this prompt which is just not feasible. You will definitely exceed the context window
[11:29] length of this prompt. And since you're charged per token, it's going to be super expensive and the agent is not going to be as accurate as you want it to be. So the solution is to chunk this content into smaller bits, also called chunks. So this book will be broken up into smaller pieces based on the parameters in your text splitter. So it's basically this thing over here. We could say that when we load in a book, we could select something like a recursive character text splitter and
[12:01] say we want to chunk it based on a certain amount of characters. Maybe these chunks should only be 1,000 characters long with an overlap of 200, just as an example. This book will then be chunked into smaller pieces and then these pieces will be saved into our vector database. Now, our database contains all of these chunks that each contain a certain section of the book. This means that when the user asks a question about the book, our database will only retrieve the most relevant
[12:33] documents related to the user's question. So maybe it will say this one is a match, maybe this one is a match and maybe this one is a match. And then only these three chunks will be injected into the context, saving on token usage and giving the LLM way more accurate information to play with. Now, in this example, we're passing in the three most relevant documents, but this is something you can configure in Flowwise as well. So maybe you wanted to pass in the four most relevant documents
[13:04] instead. Either way, this is what we're seeing here. Flowwise has taken my invoice and split it up into three chunks. And that's simply because with PDF documents, we have the option of uploading one document per page or one document per file. Let's just leave it per page. Let's process this. And now we can see the document has been split up into three chunks. So that basically covers this step over here. And all we have to do now is upload these chunks into a database. So let's do that now.
[13:36] Let's go to upsert all chunks. Then let's set our embedding model. I'll just use open AI. I'll change the model to text embedding three large. All this embedding step is doing is it's taking the English text within these chunks and converting it into a numeric representation which the vector database can use to find similar documents. It's a bit technical but it is necessary for the similarity search to work. Now for our vector store, flowwise provides
[14:08] integration with a lot of different providers. I prefer using Postgress databases. So let's select Postgress. Then under credentials, let's create new. Let's give it a name like I Postgress API. Then we have to provide a username and password. Now we don't have those yet because we haven't set up a database yet. Now depending on the database that you use, these steps might be slightly different, but if you want to follow along, what you can do is go to superbase.com and sign into your
[14:39] account. Then from your dashboard, click on new project. Let's give it a name like agent knowledgebase. Then let's give it a password. I'm going to change the region. And finally, let's click on create new project. From this screen, click on connect. Then scroll down to the transaction pooler section and expand these parameters. Now first let's copy this username and add it to flowwise. Let's also enter the password that we entered earlier. And let's click
[15:09] on add. Now for the host name, let's copy it from superbase and add it over here. Let's also copy the database and add it to flow wise. Let's copy the port and add it to flow wise as well. And if you are using the cloud service, I think you do need to enable SSL. So I'll leave mine disabled, but if you run into issues, try enabling it and trying again. Then finally, under record manager, let's select Postgress as well. Let's select our Postgress credentials
[15:40] and let's simply copy the host, the database name, and the port across as well. The record manager is optional, but I highly recommend setting it up. When we upload data to the database, the record manager will simply ensure that we don't upload duplicate records to the database. So when we upsert the data, it will make a note of all the records or documents that we've uploaded. And if we try to reprocess the same document, it will simply skip those documents going
[16:10] forward, avoiding stale and duplicate data. Let's save this config. And finally, let's upload our documents to the database by clicking on upsert. This will take a few seconds to run. And afterwards, we can see that three documents were indeed uploaded. Cool. So, at this point, feel free to upload more documents to your document store. And of course, you can also delete documents whenever you want. Whenever you make any changes to the document store, just remember to go to upsert all chunks and then run the upsert process
[16:42] again. In fact, watch what happens when I click on upsert. The record manager detected that we already uploaded these documents and therefore these three documents were skipped. Cool. Now, how do we use this document store in our agent flow? Well, that's very easy. Let's go to agent flows. Let's open up our agent and then under this section called document stores, let's select our invoices document store. Let's say for the description, let's say returns
[17:15] documents related to invoices. We can also enable return source documents which will give citations on where this information was retrieved from. Cool. So, let's save this and in the chat let's ask a question from the invoice and let's have a look at the sample invoice quick. You can see the total amount of the invoice was €453. So back in flowwise, let's ask what is the total amount on the invoice and we can see the invoices tool which
[17:45] is the tool calling our document store was indeed called and we can see all the context that was returned from that invoice and therefore our agent was able to answer this question. Now a question I've had in the past is what happens if you already have an existing vector database? There's basically no way to attach an existing database with its existing data to a document store. And to demonstrate this, I've got this existing vector database in Pine Cone containing all sorts of information
[18:17] about my restaurant called the Oaken Barrel. For instance, the current specials on offer. Now, how do I get an existing database into my flow? Thankfully, that's super easy. Again, let's open the agent. Then under document stores we can see this section called vector embeddings. Let's click on add. Then under vector store let's select pine cone. Under pine cone parameters let's create a new parameter. I'll just call this pine cone demo. And
[18:48] then within pine cone I'm just going to create a new key. Let's call this flowwise rag. I'm going to copy this key, add it to flow-wise, and click on add. For the pine cone index, let me just find that index name. I just called it flow-wise like so. And let's just make sure there's no name space involved. And there is. So, let's select this oak and barrel name space like so. And then scrolling down, we need to
[19:18] select an embedding model. And this model needs to be the same as the model that was used when creating the vector database which in my example was text embedding three small. So under the model let's go to open AI embeddings. I'll add my credentials and select text embedding three small. All right. We also have to give the knowledge base a name. So let's call it oak and barrel returns documents related to the oak and
[19:49] barrel restaurant. And that should be all. Let's save this in the chat. Let's expand this and let's ask a question related to our restaurant like what are the current specials? And the agent safely assumed I was referring to the restaurant. So it did indeed call the open barrel restaurant and retrieved all this information giving us an accurate answer. Now there are two more ways in which we can pass context to flowwise.
[20:19] We can upload images and we can upload documents within the chat window itself. But first if you are enjoying this video then please hit the like button and subscribe to my channel for more flowwise content. Now enabling file uploads in the chat window itself is super easy. At the moment, we don't have the option to do so. So, what we can do is go to settings, configuration, file uploads, enable file upload. And here you can see all the different types of files that you can upload in the chat
[20:50] window. Let's save the settings. And now, if we open the chat window, we can see that we are able to upload files. Let's grab this financial spreadsheet and let's ask a question. Let's ask something like what Apple's stock price is. So let's say what is Apple's stock price based on this sheet and it's saying it's $187 which indeed it is. We can also upload and chat with images. Now this is
[21:23] not in the settings window and in fact it actually depends on the model that's being used. Image uploads only work with multimodal models. So, make sure that you are using a model that supports vision. And then scrolling down, enable allow image uploads. We can also select the resolution of the image. This will affect things like your token usage and performance. I'll simply leave it on low for this demo. Then, let's save this flow. And in the chat window, we now get
[21:53] this upload image button. So, I'm going to upload this image of this woman that looks very surprised. And let's ask our agent to describe the image. And the agent says the image shows a young woman with long wavy brown hair expressing surprise or shock. Her mouth is open and her eyes are white, conveying a strong emotional reaction. She's wearing a light colored shirt and the background is transparent. And there you go. Those are some of the most popular ways to inject additional context into your
[22:23] agents. Let me know down in the comments if you have any questions or suggestions for this series. I'll see you in the next one.