Build AI Agents With Human Feedback (Flowise Tutorial) β
FlowiseAI v3 TutorialFreshπ
2025-07-07
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] So, I've created a lot of agent flows to help me with things like content creation, and I found that adding human in the loop has helped me to get better results and reduce token costs. So, in this video, I want to show you how to use human in the loop in Flowwise, and I'll show you a few tips and tricks you probably didn't know about. So, first, what is human in the loop? So, you might have an agent flow with a couple of nodes. So let's say you've got an agent that performs research. Then some LLM node that creates the outline and another LLM that creates the actual
[00:30] content for the post and then finally some node that takes the content of the blog post and email it to you. So this is a super simple workflow that maybe takes in a topic and then calls each of these nodes sequentially and finally sends an email. Now the problem is you'll only see the final output after this final node is executed. And if something wasn't correct in any of these steps, then you'll basically have to start the entire process over. So what human in the loop does is it allows you
[01:01] to stop the process at any point. So maybe after the research node, it will wait for the user or you to provide some feedback before continuing onto the next node. Or you could also decide to provide some feedback and then go back to a previous node. So this will allow you to tell the research agent to maybe use a different set of keywords and produce a different response before continuing on to this next node. It's also important to note that you can have multiple of these stops in your workflow
[01:32] as well. You're not just limited to one. And what's very cool about flow's implementation of human in the loop is that the state at this point in time is actually persisted for a very long period of time. which means you can access the step whenever you want. It could be immediate, minutes, hours, days, or even weeks from now. And this is super important. Flow wise won't lose the state even if the server was restarted. So it doesn't stop there either. You can also approve tool calls.
[02:03] So taking this research agent as an example, this is not a standard LLM node. This is actually an agent with tool use. So this research agent might have access to several tools. So maybe it's got access to something like Google search, web scraping and whatever else. In flow wise, we can also add human in the loop when it comes to calling these tools. So before the agent calls these tools, it will first ask the user's permission. So that way you can stop the
[02:33] process if you feel like the agent is starting to do the wrong thing. So let's jump back into FlowWise and build this blog post agent flow. So let's start by adding a new agent flow and be sure to select V2 in agent flows. Let's start by giving it a name. So let's save our agent flow and I'll call it blog post creation tutorial. Then let's start by adding our research agent. So the idea is the user will add some topic for the article and the research agent will look up articles on
[03:05] a topic to create a detailed research report. So let's go to add nodes. Let's add our agent node. And let's rename this to research agent. Then under model, I'll simply select chat open AAI. And I'll select my OpenAI credentials. And for the model, I'll use GPT 4.1. I am going to change the temperature to a lower value like 0.4. A lower value simply means the agent will follow our prompt way more strictly where a higher
[03:36] value like 0.9 will give the agent more creative control. So I'll change this back to 0.4. Then under messages, let's add a system message. And for the system message, we'll say I'll actually start by adding a header. You don't have to do this, but cosmetically it just reads way easier. And you can do that by typing hash followed by something like ro. Then let's enter. Your role is to perform deep research on a topic provided by the
[04:07] user and produce a detailed report. Use the provider tools to generate the topic. Formulate two different keyword combinations for searching the topic. Perform a web search for each keyword combination. Then scrape the two top pages for each keyword combination. Of course, you can decide to use more keyword combinations if you want and maybe scrape more pages than this, but for the tutorial, I think this is cool. Let's save this. Then, let's add another
[04:37] message. Let's add the user message. And in here, we'll provide the topic. And what we want to do here is pull in the message from the chat window. We can refer to the chat window by typing double curly braces. And from here you can see all the variables that's available in this session. We want this question variable. Now let's assign a few tools to this agent that will allow it to do research. First I'm going to add the current date time tool. And this is actually a very simple tool, but it
[05:07] can help you to get way better results. These LLMs tend to get the date and time wrong. And it might think that it's still the year 2024 or whenever the training data cut off was. So by giving it this current date and time tool, it will be able to retrieve up-to-date information. You will also notice this require human input tool and this means the agent will ask our permission to call this tool before calling it. But since it's just a current date and time tool, I don't want human input. Then let's give our agent the ability to
[05:39] perform a Google search. So let's add tools. Then let's search for Tavi API. or if you watched my web scraping video, you might want to use the bright data MCP server as well. To keep things simple, let's use Tavly API and then under credentials. I'll simply select my credentials. If this is your first time using Tavly API, you can just click on create new then give your credential a name like Tavly API. And to get your API key, simply go to tavi.com and sign up
[06:11] for your account and you'll be able to get your API key from the dashboard. They give you a lot of free tokens, so don't worry, it won't cost you a thing. Then simply paste your API key into this field and click on add. Now, I've already done that, so I'll just select my credential. What I am going to do is just close these parameters and enable require human input. Now do take note the search tools irrespective of which one you used will basically scrape the Google results and not the content
[06:42] within the pages themselves. So what I like to do is to perform a web search and then assign a web scraper tool to scrape the pages of the top results. So to do that let's click on add tools. Then let's add the web scraper tool. And I'll just leave all of these on their default values. Let's also enable require human input. And that should be all we need in terms of tools. And scrolling down, we'll leave enable memory selected. And that's actually all
[07:12] we need to build this research agent. Just be sure to connect your start node to the research agent. And we should now be able to test this workflow. So let's save this. Then let's open the chat. And let's give our agent a topic like the benefits of adding human in the loop in AI agent workflows. Let's send this. And now we can see something interesting. We can see this red icon on this node which means it's now waiting for human feedback. We can see our agent wants to
[07:42] call this Tavly search tool with the keywords benefits of human in the loop in AI workflows. We can now decide to proceed with this tool call or reject it. If we reject a tool call, the LLM will simply proceed to answer the question without the results of that tool call. Now, I'm just going to stop this and let's start the process again. So, let's send this or of course we can click on proceed and the agent will now call that search tool. And afterwards,
[08:13] it should call the web scrape tool. And yes, here we can see it wants to call the web scraper tool and it's trying to access this URL. Let's approve this. All right. So, we get this response back. And what I do want to show you is when we scroll up, we can see the search tool was called twice. And that is because in the system prompt, we asked it to research two keyword combinations. Then scrolling down, we can see the web scraper tool was called four times. And
[08:44] that makes sense because we asked it to scrape the two top results for each keyword combination. And then our agent produced this detailed research report. Right now what we want to do is generate a post outline based on this research report. So let's do that under add nodes. Let's add the LLM node and let's connect our research agent to this LLM node. Then let's rename this guy to title and outline. And for the model I'll go with chat openai again. And for
[09:16] the model, let's select GPT 4.1. I'm going to reduce the temperature again. And then under messages, let's add a system message. And for the system message, let's actually get AI to generate it for us. So, let's just say your role is to create a blog title and outline based on a detailed research report. Let's generate this. All right.
[09:48] So, let's just have a look at what it gave us. So, this is all fine. It's giving the agent all the steps. And what I don't care about is the output format which says respond in a JSON format. So all of this stuff I'm actually going to delete along with this example and pretty much everything at the bottom. All right, let's apply. Then we'll leave enable memory enabled. And I think that's all we have to do. So this LLM node will give us our title and outline.
[10:18] And then we want to add another LLM node that will write the blog post based on this title and outline. Let's actually add that node now. So let's rename this to blog post writer. And I'll just leave the model on GPT 4.1 with a temperature of 0.4. Now let's change the system message. And I'm simply going to write something very simple like write a fun and informative blog post based on the following topic block title and outline. Let's save this. We'll keep enable
[10:50] memory enabled. And that's actually all we have to do. Then let's connect our title and outline to this blog post right there. Cool. Now let's run this. And I think this will also demonstrate the issue with this type of workflow. Let's send this. I'm going to approve these tool calls. Let's also approve this web scraper tool. So the research agent completed its task and the title and outline node is now running and then immediately after that the blog post writer executes and we start seeing the
[11:23] result from the blog post writer node. So the problem is we didn't have any opportunity to review the output from this node and request any changes. So it would be ideal to stop the process after this notice executed so that we can have a look at what it produced and then request changes or tell the flow to continue. So let's break this connection and then after this node let's add a human input node. Then let's connect these two. Let's rename this human input
[11:55] node to title and outline feedback. Then for the description type, we can select either fixed or dynamic. So dynamic simply uses an ln to generate the text for us. But we'll simply use the fixed value. And at the top we could say something like title and outline followed by the output from the title and outline node. And after that, we could ask something like, would you like to request any changes or
[12:30] proceed? And we'll enable feedback. Let's close this popup. And what this will do is allow the user to select either approve or reject and provide feedback. It also gives us two different outputs. So we've got this proceed path. So if the user approves the output, we could proceed to the block post writer. Else we get this reject path which needs to loop back along with the feedback to the previous node. So to loop back what
[13:01] we can do is add this loop node. Then let's connect these two. And in the loop node, let's just rename it to say loop back to title and outline. And under loop back two, let's select title and outline. We can also select the max loop count if we wanted to. I'll just leave it on the default. Let's go ahead and test this in the chat. Let's send our topic. Let's approve the search tools. Let's approve the web scraper tool. And
[13:33] now the title and outline is being generated. And we now stop at this human in the loop node. So having a look at this, we can indeed see the title ideas along with the blog outline. So let's say we wanted to make a change to the title. Maybe we want a title that's in a form of a question. Let's actually then reject this. And let's say the article seems good, but the title should be in the form of a question. Give me one
[14:06] title as a question and keep the rest of the article as is. Let's submit this. And now the title and outline node is running again. And this time the article itself should be the same, but what I'm expecting is a different title. We now get one title back and this time it is in the form of a question. And of course we have an opportunity to make further refinements or continue with this workflow. Now this takes me to a very
[14:37] important feature about human in the loop in flow-wise. The current state of agent flow is actually persisted in a database. So if we close this application in fact if we restarted the server we would still be able to come back at any point in time and continue with this workflow. Let me show you. In fact, let's do something super drastic. I'm actually going to stop the Flow Y server entirely. So, if I refresh this, this entire application should fail. And if I start
[15:10] the server back up again, we can go back to Flowwise. We can of course continue to chat in the chat window if we wanted to. But even if we went back to something like the dashboard, we can continue with that workflow by going to executions. And within executions, we can see all our flows that are waiting for human feedback. So, we're looking for flows with this red icon next to it. So, if I open up this flow, I can see that we're currently on this title and outline feedback node. And if I scroll
[15:41] down, I can see exactly the state where we were. And from here, I can decide to reject, to provide additional feedback, or simply proceed with the workflow. So, I'll just say continue. And it should now call our node and will produce the blog post. We can see this flow has completed execution. And if we open it up, we can indeed see that the blog post writer was called. And this should contain our entire blog post. So I thought that was just a very important feature to show you as some other
[16:12] ancient builders actually lose that state if you had to restart the server. We're nearly done. We simply want to add human in the loop after this blog post writer node. And then finally, email the entire article to our email address. But if you are enjoying this video, then please hit the like button and subscribe for more FlowWise content. Right, let's add another human in the loop node. So I'll simply connect these two. Then let's rename this one to blog post writer feedback. And in the description,
[16:44] let's change this to blog post. We'll grab the blog post from the blog post writer node. Cool. Let's also add another loop node. So, let's add it here. Let's connect the reject output to this node. And let's rename this to loop back to blog post writer. And under this dropdown, let's select blog post writer. Awesome. So this will allow the user then to request revisions on the blog
[17:16] post or continue to send the entire blog post via email. In fact, let's also add the email node at this stage. So under add nodes, let's add the agent node and then let's connect this proceed path to our agent. And let's rename our agent to email agent. Now I do want to mention that under add nodes we are able to add this tool node and in this tool node you will see this Gmail option as well. Now
[17:47] you could use this tool by itself and it would still work but I'm specifically using the agent node because I actually want to take the blog post that was written by this LLM and then format it in different ways depending on the output. For instance, the text that's written by this agent is actually very boring and it doesn't work in an email. So I can use an agent node to take this text and then reformat it into HTML and then send the email. So in this email agent node, let's select our model like
[18:21] so. Then under messages, let's add a system message. And in the system message, let's say your role is to send a blog post to an email address. Then I'm just telling it to send an email to this address. The email should look professional. Format the blog post into HTML to make it look professional and readable. After sending the email, inform the user that the email was indeed sent. Include the full blog post in your response in markdown format. Then I'm also going to add a user message just to make sure it knows
[18:52] exactly what article to send just in case there was a lot of back and forth in the conversation. So I'll just say blog post and we'll simply grab the output from the blog post writer node. Now this should be optional and the agent should be intelligent enough to understand that the final article should be the correct one but I'll just add this just in case. Then under tools, let's add the Gmail tool. And under parameters, let's create a new
[19:22] credential. And I'm going to call this gmail oorthth tutorial. And now we have to provide a client ID and a client secret. Now to get all of this, go to cloud.google.com and then sign into your account. Then click on console and under the project picker, let's create a new project and let's call this flowwise tutorials. Let's click on create and we'll just wait for this project to be created and this is free to use by the
[19:54] way. All right. So then let's click on select project or you can just click on this dropdown and select your project from this list. On the left hand side go to APIs and services. Click on library. Then search for Gmail. Then click on Gmail API. Click on enable. Then next we do have to set up the Oorth consent screen. So let's click on that option. Then click on get started. Let's give our app a name. I'll just call it flowwise tutorial.
[20:27] Then we need to select our email account. Click on next. Then click on external. Then click on next. Then enter a support email address and click on next. And finally, click on finish and continue and create. Thankfully, we only have to set this up once. Then let's go to audience, click on publish app, and click on confirm. We're almost done, I promise. Let's click on clients. Then
[20:58] click on create client. Under application type, select web application and let's give this a name like flowwise tutorial. And then under authorized redirect URIs, click on add URI. And then back in flowwise, we can see this oorthth redirect URI field. Simply copy the value that's in that field and add it to this field. Then click on create. This will now give you your client ID and client secret. So copy the ID and add it
[21:31] to Flowwise. Then copy the secret and add it to Flowwise as well. Then click on authenticate. Then click on your email account. You might see this popup. That's perfectly fine. Click on advanced and click on go to Flow Wise tutorial. Let's select all of these permissions and click on continue. And that's actually it. Under type, let's select messages. And under message actions, let's select send message. We can leave all of these fields empty as the agent
[22:02] will decide how to populate them. And if we wanted to, we could enable human input at this stage as well. I'll simply leave it off. So let's close this node and let's test everything end to end. In the chat, let's start a new chat. Let's send our topic. I'm going to approve the web search tool and let's approve the web scraper tool. Right. So for the title, let's actually ask it to create a question type title again. So under reject, let's say keep the
[22:34] article as is, but give me one title in the form of a question. Let's submit this. I do like this title. So let's continue. And in the feedback, we'll just say continue. Then let's approve this blog post. So I'll just say continue. And now the email agent should send the email and give us the full blog post in the chat window. So in the chat window I do indeed see the entire message and I can
[23:06] see the send message tool was called. And then looking at my email I can see the full blog post neatly formatted as well. So I hope you found this useful. If you did, please hit the like button, subscribe to my channel, and let me know down in the comments if you'll be using human in the loop in your agent flows going forward. YouTube also thinks that you'll find this other video very useful, so check that out, and I'll see you in the next one. Bye-bye.