How I Automated My Workflow with AI Agent Teams (NO-CODE) β
Flowise AI (2024) TutorialAgingπ
2024-07-02
Multi-Agent Architecture β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MULTI-AGENT SYSTEM β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββ β
β β ORCHESTRATOR β β
β β (Manager Agent) β β
β βββββββββββ¬ββββββββββ β
β β β
β ββββββββββββββββββΌβββββββββββββββββ β
β β β β β
β βΌ βΌ βΌ β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β Research Agent β β Writer Agent β β Reviewer Agent β β
β β β β β β β β
β β β’ Web Search β β β’ Compose β β β’ Validate β β
β β β’ Data Gather β β β’ Format β β β’ Improve β β
β ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ β
β β β β β
β βΌ βΌ βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β SHARED TOOLS β β
β β [Web API] [File System] [Database] [Code Executor] β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββAgent Workflow β
- Agent configuration
- Tool integration
- Memory management
Transcript β
[00:00] In this video, I will show you how to automate everyday tasks using AI agent teams. This tutorial is inspired by a video from Code with Brandon, where he used CrewAI to create a YouTube research team. But instead of writing a lot of code, we will instead use a free, no-code platform called Flowwise to try and achieve the same results. If you're new to Flowwise, you can use it to build advanced AI applications by simply dropping nodes onto a canvas.
[00:30] Setting up Flowwise locally or in the cloud is very easy, so check out these videos on getting started. So let's have a look at what we'll be building in this video. As a content creator, my workflow typically includes researching keywords on YouTube to find high-performing videos for a set of keywords. If a video idea interests me, I don't need to think of how I click through the right titles, write a video description, and create an expo to promote the video. So what I did was create an AI agent team
[01:01] that will perform all of these tasks for me. So let's have a quick look at this team before we delve into creating this from scratch. First, we have a supervisor note that is responsible for delegating the tasks between the different workers. Then our team consists out of five different workers. The first worker is our research specialist that is responsible for searching videos on YouTube, and also fetching information like the amount of views, the channel subscriber count, the days
[01:32] since last published, etc. Our second team member is a title creator who is responsible for generating 10 iClickthrough Rate titles for our video idea. The third worker is a description creator who will take the results from the researcher and generate a video description. Then we have a Twitter post creator or an expo creator that is responsible for generating an expo that we can use to promote the video.
[02:02] Then finally, we have this report writer who is responsible for taking all the results from the previous workers, create a report from that, and then write the results to a file on my PC. Now let's actually see this in action. Let's open the chat and let's paste in a bunch of keywords. I'm thinking of creating a video on how to automate my life using AI agent teams. So here we can see that the supervisor asked the research specialist to look for any videos related to these keywords.
[02:33] The research specialist then used custom tools to search for results on YouTube, and it then used tools to fetch additional information like the subscriber counts, the view counts, the channel name, etc. The supervisor then asked the title creator to come up with 10 unique title ideas for this video, and our description creator then created a description for the video. The Twitter post creator then created this expo that we can use to promote the video. And then finally, the report writer wrote
[03:06] the results to a file on my file system, which is simply added to this output folder over here. And if I open this, we can see that all the results from the agents were consolidated into this report. So this includes all the eye-performing videos on YouTube, potential titles, the video description, and our Twitter post. So let's go ahead and create this team from scratch. From the flow-wise dashboard, go to Agent Flows, then let's add a new flow. Let's save this. Let's give it a name
[03:37] like YouTube Research Tutorial. In order to create an AI agent team, we need a supervisor node, as well as any worker nodes. Let's start by adding the supervisor node. So go to Multi-Agents, and then add Supervisor. We are able to make changes to the supervisor by clicking on additional parameters, and here we are able to change its system prompt, which we will change in a few minutes, but for now let's leave it on the default value. Then let's add an AI model to the
[04:08] supervisor by clicking on Add Nodes. Let's go to Chat Models, and I'm going to use the Chat OpenAI model, as I do want to use the new GPT-40 model. But of course, feel free to use any model that you want. If you are planning on running a local open source model, then I do recommend using the llama3 70 billion parameter model, if you have the hardware to do so. If you are planning on using the claw 3.5 sonnet model, then do take note that anthropic has a very strict rate limit, which might
[04:41] cause issues as well. At the time of recording, I think the rate limit is something like 5 messages per minute, and these agent teams will be sending a lot of requests back and forth, so that rate limit might be an issue. That's why I'm simply going with OpenAI, as they do not seem to have those limitations. Let's add the Chat OpenAI model to our supervisor team. Let's also select our credentials, and if you haven't created credentials yet, simply click on Create New, give your credentials a name,
[05:11] and you can then generate your OpenAI API key, and you can get your key by going to platform.openai.com slash api dash keys. Simply save your credential and select it from this dropdown. Then for the model name, let's change this to GPT40, and for the temperature, I'm going to set it to a lower value, like 0.4. And let's go ahead and create our very first worker. The most advanced worker in this entire flow is without a doubt the research
[05:42] specialist, which has access to these custom tools for searching YouTube and extracting video details and channel details from YouTube. So we will have a look at creating this worker last. So let's start with something easy, like a worker that will generate YouTube titles based on our keywords. Let's click on Add, then let's go to multi-agents, and let's add this worker node. Now let's have a look at this worker. First, we need to assign a supervisor node, so let's do that now, by grabbing the output of the
[06:13] supervisor and attaching it to the supervisor input on the worker node. Now for workers, we can assign a list of tools, which we will do for the research specialist, and we can also assign a chat model. This input on the worker node is optional, and if you don't set a specific chat model, this worker will simply inherit the same model that was assigned to the supervisor node. Let's also give our worker a name, like title creator, and let's also assign a prompt to the
[06:44] worker. You can use the worker prompt to set the roles and responsibilities for the worker. For instance, as a YouTube title generator, your job is to create 10 high click-through-rate titles based on the video keywords. Let's save this, and let's go ahead and test out our flow. Let's save this, and in the chat, let's enter our keywords as "automate tasks using AI agent teams", and let's send this. We can see that our supervisor is indeed
[07:14] asking our title creator to create titles using these keywords, and our title creator did indeed create 10 YouTube title ideas. Great! Now let's add another worker for generating our video descriptions. So let's click on add notes, let's add a worker, and let's also assign the supervisor to this worker as well. For the worker name, let's call this "Description Creator", and for the worker prompt, let's clear this default values, and let's type
[07:44] something like this. "Create a description for a given YouTube video based on the video keywords". What I'm also going to do is to paste in an example description from one of my previous videos, just like this. Let's save this, then let's go ahead and add another worker for our X-Post. So let's add this worker, let's attach our supervisor to this worker, then for the worker name, let's call it "Twitter Post Creator", and in the description, let's add something like "Create a Twitter post
[08:16] that will be used to promote our new YouTube video based on the video keywords". Excellent! Now let's give this a spin. Let's save this, and in the chat, I'm actually going to use the same keywords from earlier. Let's clear this chat, and let's run this again. Now let's have a look at what happened. First our title creator created our 10 title ideas, great. Then the description creator generated this description for us, which is fantastic, and then our post creator created this X-Post that
[08:47] we can use to promote the video. Awesome! Now let's move on to adding our research assistant, which is by far the most interesting worker in this flow. Let's start by adding a new worker to our canvas, then of course let's assign our supervisor to this node, and let's give our worker a name, like "research specialist". Then for the worker prompt, let's enter the following. For the given video keywords, search YouTube to find five videos on the same topic. Then using the provided tools,
[09:18] retrieve the following information for each video in the results. We want the title of the video, the view count, days since published, the channel subscribers, and also the video URL. For the channel subscribers, I'm simply adding this "additional details" to tell the agent which tool to use to fetch this information. So if you ever find yourself in a situation where the agent isn't using the correct tools, then simply add additional information like this. Let's
[09:49] save this. Now let's think about the tools that we need to create. First we need to assign a tool which will allow the agent to perform a search on YouTube for the video keywords. Then the worker needs some way of extracting information from the video, like the amount of views, the days since published, etc. Then we also need a third tool for extracting information from the channel, like a subscriber count. Now let's have a look at how we can create custom tools for our workers. We can find
[10:19] tools by going to "add nodes", and within this you will find the tools menu. Flowwise provides a list of tools that you can use to integrate with external platforms. But one of the most powerful tools within Flowwise is the custom tool node. With custom tools you can write a little bit of code to do pretty much anything you want. And I know I did say that we won't write any code in this video, and I promise the code that you will see here is super simple. And if you do get stuck,
[10:50] you can simply ask chatgpt to generate the code for you. So just bear with me. Let's add a custom tool, and this tool will be responsible for searching YouTube for videos related to our keywords. We can create new tools by clicking on this dropdown, and at the bottom of this list click on "create new". Now let's give our tool a name, and very important this needs to be lowercase and no special characters. For example, "youtube_search", and it's very important not to use spaces
[11:22] either, but instead use an underscore. The tool description is super important as this will tell the model how and when to use the tool. So let's type something like "use this tool for searching YouTube videos". Then under properties, let's add a new item, then for the property "name", enter "keywords". These properties are basically the values that we can expect to pass into the tool, and in order to search YouTube for videos, we obviously need to receive the keywords. For the type, let's
[11:54] set that to a string value, and for the description, let's enter the search keywords. Let's also check the required field, as we do need the keywords to perform this action. Then scrolling down, you will see this JavaScript section, but again, please don't worry if you are not familiar with code, as you really don't need to write a lot of code to make this work. And you will find the code in the description of this video, so feel free to simply copy and paste the code that I've written for you. So simply copy the
[12:24] code from the description of the video and paste it into this field. Basically all this code is doing is it's calling an API endpoint to Google, passing in the keywords that we received in this tool. So this represents the keyword property over here, and we are telling the API to return five video results. And also something that we will change is this key, which represents the API key that we need to generate in order to call this API. You don't have to change anything else in
[12:55] this code, so let's simply click on add to create this tool. It's also created tools for fetching the video details and the channel details. So let's click on add nodes, let's add the custom tool, and let's call this tool YouTube Video Details. In the description, paste something like "Use this tool for retrieving detailed information about a video, like the views, the publish date, the like count, the channel ID, or whatever else. Let's add a new
[13:25] property, and let's call it Video ID. This is of type string, and let's add a description of the ID of the YouTube video. And let's also check the required field. So basically what will happen is the search tool will return a list of results, so about five related videos. The agent will then call this tool for each of the videos in the result list, passing in the video ID, and expecting to receive all of this information about the video.
[13:56] Now for the code, again feel free to copy the code from the description of this video, and paste it into this box. Again this is simply calling an API on Google, but this API will fetch the details of a video based on the video ID. So whatever you call the property over here, ensure to use the same value over here. And we will come back and replace this API value with the actual API key. We don't have to change anything else, so let's click on Add. Now let's
[14:27] create our final tool, which is responsible for fetching the channel details, like the subscriber count. Let's click on Add Nodes, then let's add the custom tool. Let's create a tool by clicking on this drop down, and create new. Then let's call this YouTube channel details. For the description, enter something like "Use this tool to retrieve details of a specific YouTube channel, like the subscriber count." Let's add a new property, and let's call it channel ID, as this time we expect to receive a
[14:58] specific channel ID. Let's change the type to string, and the description to something like the ID of the channel. Let's also check required. Simply grab the code from the description, and paste it into this box. So this is again calling an API on Google, but this time it will fetch channel details for a specific channel ID. And of course we will change the API key in a minute. We don't have to change anything else, let's click on Add to create this tool. Now we can assign these tools to this research
[15:29] specialist by attaching it to the tool's input, like so. And let's also add this third tool. Now this won't work quite yet, because we've hard coded the API keys in these tools. So let's go ahead and create our Google API key. For this, go to Google Cloud Platform, and open up the console. Then create a new project by clicking on this drop down. Then click on new project, give it a name like "YouTube research flow wise," and create your new project. Then select a project by again
[16:01] clicking on this drop down, and click on the new project name. Excellent. Now let's enable the API by clicking on this menu, go to APIs and services, and go to library. Here search for "YouTube data API." Then click on this result, then enable this API. And now that it's enabled, we can go ahead and create our API key. So go to credentials, then click on create credentials, API key, and then copy this API
[16:33] key. Please ensure to use your own as I will delete my API key after this recording. Back in flow wise, let's add the API key to these tools. So let's go back to the dashboard, tools, and then find the tools that you just created. So what we could do is open up this tool, then in the code, replace API key with the key that you just generated. But this is not ideal as you will have to do this for each and every one of the tools that references API key. So instead we'll
[17:04] create this key in a central place and simply reuse it in these tools. So if we ever wanted to refresh or change the key, we can change it in one place and all the tools will be updated automatically. For this we will use variables. So click on the variable menu, then click on add variable, let's give it a name like YouTube API key, then for the type, set it to static and then paste in your API key. Then let's click on add. We can now use
[17:35] this key in our tools. So I'm going to copy the name of this variable. Let's go back to our tools. Let's start with the YouTube search tool, and let's replace this hard coded API with this global variable. For this enter a dollar sign, followed by opening and closing curly braces. We can now reference that global variable by entering a dollar sign, vars, referencing the global variables. And within the variables,
[18:05] we can specify a dot and the name of the variable that we just created, which was yt API key. And that is all we have to do. I'm actually going to copy this. Let's save this tool and let's do the same thing for our other tools. So let's replace the string with this variable. Let's save this and let's also change the channel details tool. So let's replace API key with the reference to our YouTube API key. Awesome. Let's save this. Let's go back to our
[18:35] flow and we should now be able to test out our flow, including these custom tools. So let's open our chat. I'm actually going to use the same keywords again. So let's copy this. Let's clear the chat and let's run this. The research specialist is running and our title creator is running after that. And our description creator is running as well. And finally, we can see our Twitter post. Awesome. Now let's have a look at what the research assistant did. When we go to the research specialist, we can see these
[19:06] tools were indeed called. So we will see that the YouTube search tool was called using these keywords, which then returned a whole bunch of YouTube videos. And for each of these videos, the video details tool was indeed called. And because we received five videos from the results, the video details tool was called five times. But you might be wondering why the channel details tool was unequal three times. And that is simply because the same channel, so Matthew Berman, showed up in the results multiple times.
[19:38] So the tool for each channel only had to be called once. Now let's bring this all together by adding another worker to the canvas, which is responsible for taking the results from the previous workers and then writing a report to the file system. Let's assign our supervisor to this worker. And let's call this worker report writer. And for the worker prompt, I'm actually going to add a lot of information, but it's pretty much a repeat of everything you've seen up until now. So here we are simply telling this agent to take the output
[20:09] from the previous agents and to write a report that contains the research data in a table format. Then the report should also include the titles, the description and our Twitter post. And we're also telling it to use a write file tool to write the file to the file system. And I also want the report to be written in HTML. Then I'm simply providing an example of the report that I'm expecting. So I do want to see the videos being listed with these details. Then below the list of
[20:39] videos, I want to see the list of the titles, then the video description, and finally our Twitter post. Let's save this and let's assign a tool to the worker that will allow it to write the contents to a file. So under tools, let's add the write file node to the canvas and let's assign this tool to our worker. On the write file node, we can specify the path of the file. I'm simply going to write the files to this output folder in my flow-wise directory. This
[21:10] does not have to belong to the flow-wise directory and it can exist anywhere in your file system. Just ensure that the folder actually does exist. Let's save this and let's run this flow. So in the chat, again I'll simply use the same keywords. Let's clear the chat and let's run this. So after running this, the behavior is not quite what I expected and I did leave this out intentionally. You might recall at the start of the video, I did mention that we will make changes to the supervisor's prompt.
[21:40] We would have expected the research specialist to execute first, followed by the title creator, the description creator, and then the Twitter post creator. But it seems that the research specialist didn't execute at all and the file was not written to the file system at all either, which is definitely not what we want. So we can improve this behavior by tweaking the supervisor's prompt as well. So below the standard prompt, let's simply add some simple information to enforce this behavior. Let's add
[22:12] start with the research specialist passing it the video keywords. Pass the research results along with the video keywords to the rest of the team members in order for them to complete their work. Finally, once you have the results from the title creator, the description creator, and the Twitter post creator, pass their results to the report writer. Great, now let's test this again. Let's copy these keywords, let's clear the chat, and let's give this a spin. And after this is completed executing, let's have a look at what happened. So indeed the research
[22:43] specialist was called first and it used all of these available tools for fetching information from the related videos. We then received our titles and our description and our Twitter post. Then finally the report writer used the write file tool to write a file called report.html containing all of this information. And if I look in the file system, I can indeed see that report and when we open this, we can see all of our research data with our titles, a
[23:15] video description, and our Twitter post. If you enjoyed this video then please hit the like button and subscribe to my channel. And if you would like to see more projects and videos on using Flowwise multi-agents, then check out this playlist over a year. Thank you for watching, see you in the next one. Bye bye.