crewAI Crash Course For Beginners-How To Create Multi AI Agent For Complex Usecases

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome to this crash course of creating multiple AI agents for real world use cases using crew AI if you haven't heard about this platform so creu AI is an agent framework uh which will actually help you to create multiple AI agents for various amazing use cases um so in this video I'll be talking about this entire platform along with that I will also show you with an amazing use cases uh I will try to create a complete end to end use case and how I can use this crew AI platform or framework uh to develop multiple AI agents and where it will basically be required see in Lang chain also you have an option to create agents right but here the main thing with respect to CI is that here your agent will be able to communicate with each other right in an efficient way so that we will be able to make or we'll be able to implement the task much more in an efficient way okay so this is the entire web page of the crew Ai and right now many many people are using it they are creating multiple agent Crews you can see over here in last 7 days all these things are there you'll also be able to work with the open source tools that is already provided over here and in this video I'll be also talking about that and showing you with the most practical use case um so let me just go ahead and let me just start first of all we'll understand what kind of use case I will be solving okay so let's say I have a project over here and everybody knows that I have a YouTube channel now in my YouTube channel there are more than 1,00 plus videos um now what I really want is that U for every video I need to have a Blog Page let's say I want to probably create a blog platform right now I want to create a blog platform just let's imagine so what I will do I will take up every video of mine probably based on the content I will go ahead and write my entire Blog Page itself right whatever content is required in that blog page now this task is a really tedious task right now what I'm actually going to do is that I'm going to automate this entire three with the help of cre AI framework where this block platform will be automatically created from my all my YouTube videos with respect to all the things that I have said in my YouTube videos that is most important okay so with the help of cre AI what we are really going to do is that first of all let's say that if a user queries any kind of uh videos with respect to AI let's say I'm querying about crew AI over here so what it should happen is that it should go to my YouTube channel pick that particular video extract that entire content and based on that particular content summarize that information put it into the blog page right now obviously I know that I have created more than 1900 plus videos now if I really want want to probably work with multiple people over here so I need to have a Content writer I need to have a researcher right who will probably go ahead and explore every video in my YouTube channel based on the query it is writing and then it will go and validate that content and after probably validating the content I need to have a Content writer separately who will specifically write this particular Blog Page also right now here um just understand for just one video it is fine but if I have 1900 plus videos it is going to take a lot of time because validating is also there I need to to probably go and check the content proofing do multiple things over there right so with the crew AI we can automate this thing completely in a whisker of time uh and that that is where we'll understand how this AI agents okay and here also you can see right if I'm involving multiple people they also need to communicate with each other then again have there may be some kind of communication gap you know how they are specifically going to work so with respect to that you are going to take a lot of time over here right now with the help of cre AI um so crei if I talk about they are three main important components one is the agents one is the task and one is the tools okay now here if I probably consider this specific use cases as I'm saying first of all we need to explore my YouTube channel right so I need to have a researcher over here who will probably go and query any query in my YouTube video and he'll probably bring that particular YouTube video okay after seeing that particular YouTube video he needs to listen he needs to probably hear out what what you have about that entire YouTube video itself so here also we require an expert right expert who's good at data science who's good at data analyst because my entire channel is based on data science itself right AI so here obviously I need an expert person who will probably go ahead and watch the each and every video and retrieve the content out of it right then after that I need to pass it to my content writer right so content writer so here I have an domain experty person right it can be a data scientist it can be an analyst right so this two roles here you can basically consider in crew AI these are nothing but these are agents okay so we are specifically going to take consider this as agents so agents are none other than the people who are having some kind of experience with respect to the work right it can be a domain expertise like in data science domain it can be data scientist data analyst it can be a Content writer right so it can be anyone right so this basically becomes an agent so in the crew AI the first component is specifically agents the second component that we specifically use in crei task right now each and every agent does some kind of task let's say the domain export people will probably go ahead and watch this particular YouTube video he'll try to trans uh take out the entire information that I've told in the YouTube video itself right so uh that basically becomes the task for this particular agent right similarly content writer is a agent its task is right to write the content right so that can basically be a task so this is the most important second component like what task a agent is specifically doing that also we need to Define and the third thing over here is about tools okay let's say uh the domain expertise is over here I do not have a domain expertise let's consider so if that domain expertise wants some kind of help right uh like uh let's say once it is searching from the YouTube uh video itself right uh any of my video it is probably searching let's say that it wants to get the transcript of the video so what may what may happen is that this person person may use some kind of tool to do that it can be a third party tool it can be an API it can be anything as such in this particular case let's say I want to get the transcript of the my YouTube video then I may use a transcriber right and that transcriber can be a third party tool itself right and that is where a tool comes into existence like with what will be the main uh what will be the main way of probably let's say that if I have some kind of dependency on some third party tools itself to explore this particular task right how can I perform this particular task with the help of this particular tool so I may also have a separate YT tool which will be able to uh provide me the trans transcription of the entire video right so that is where we can specifically use the tool other tool can be okay I want to probably do a Google search API right Google search so this can be another tool right so similarly multiple tools will basically be there which we can actually use so agent will have some specific task and this task can be performed by a specific tool okay so this is is how it actually works now similarly here you can also see I have created two agents one is researcher one is content writer because that is what I actually require researcher will explore the Wht videos from this particular YT videos it may use some kind of YT tools to transcribe the entire content right analyze the entire content once that thing is done then that particular researcher will pass it to the content writer because it now has the entire information this entire info will be basically there after performing this particular task then once it provides it to the content writer the content writer what will happen based on the research it will write the blog page right and finally my this will basically be my output right so here you can also see that interaction is there between the researcher and the content writer right and this this process now see this is one way so this process is entirely called a sequential process there are also other processes which is called as hierle processes so here in the sequential process once the researcher completes this work it is going to give that entire output to the content writer and the content writer further based on the task it is assigned it'll probably go ahead and create the block page so I hope you got an idea about what are the main important components of creu AI one is the agent one is the task and one is the tools and based on this we can automate this entire use cases now let's go ahead and implement it practically as I said in the agents I'm going to probably create two agents one is researcher one is the content writer then I'm going to go ahead and Define the task for this specific agent like Explore videos it can be explored YT videos it can be exploring another thing it can be probably exploring Google search API anything it can be now to complete this particular task we have dependency on some tool which is called as YT tools because uh at the end of the day I require the transcription or uh of my entire YouTube video so for that I may require a tool and this can also be a custom tool which you can also create by yourself right so once we get this particular tool we will be able to do this particular task and after that we will be able to complete the researcher work once this researcher work is completed we will pass this entire work to the content writer because the content writer needs to write the entire Blog Page based on the research right so this entire process is also called a sequential process because once this is getting completed the next step is to get uh to complete this there are also other processing other processes like hierle process where parall also you can actually do this particular task okay now let's go ahead and implement this entire project completely from scratch so guys I have opened my uh new project over here in my vs code I will go to the terminal the first step is probably to create our cond environment okay and this you really need to do it for every project so I will go ahead and write cond create cond create minus P VNV python W equal to 3.10 so okay I will be taking 3.10 that's is 3.10 now after doing this uh let's say installation probably happen um once the installation actually happens and a new environment is basically created what we are going to basically do is that we are going to create our requirement. txt file so let me just go ahead and write my requirement. txt file okay uh now inside this requirement. txt file I will be using some of libraries that I really need to install one is the cre AI then one I'm going to write python okay right now I don't require this so let me just go ahead and write ccore AI sorry cre aior tools right so these are the two important libraries I will be requiring so let me save it now this uh environment is basically getting created or it has got created so I will go ahead and activate V EnV okay so Conta activate V EnV now let me quickly go ahead and let me do one thing guys let me hide my face so that you'll be able to clearly see this okay now let me just quickly go ahead and write pip install minus r requirement. txt and this all both the requirements will get installed okay so once this install is basically happening uh we will continue our task now first of all as you know we need to create our agents so agents. py I will go ahead and create it the next will basically be tools. py okay uh agent tools and I also require task okay task. py so these three components uh we really need to create so first of all I will go ahead and create my agents now for creating the agents first of all all I will go ahead and import from CRE AI import import agent okay now uh since uh you know that uh we really need to create some kind of agent over here right and for creating an agents so first of all what all things I will create so I will probably create a uh senior blog content researcher okay so this will be basically be my first researcher which I will probably create which will be an agent who will be doing my task okay so these are like people who will be handling all my task okay now let me quickly go ahead and create my researcher so this researcher will be my blog researcher okay and this blog researcher will be of type agent okay now with respect to agent uh there are some important parameters that we really need to use okay first parameter we really need to give is role what kind of role it is basically doing or what kind of role it needs to do it okay so here I'm going to basically say that okay these are nothing but they have to probably be a Blog Creator a Blog researcher from YouTube videos Okay YouTube videos so these are some default information that we really need to give one is the role the other one is goal okay so here we also need to specify the uh goal over here uh here we can basically write get the relevant relevant video uh get the relevant video um content for the topic whatever topic I say okay from YT Channel okay so this will basically be my role for this particular agent you need to get the relevant video uh content for the topic this from my um this one okay name I can basically uh write over here description as I can write so let me just go ahead and uh uh write the name but let it be I don't require this to but it is getting suggested by the uh Amazon whisper that I have specifically used over here but it's okay I don't want this then I will go ahead and set up my verbos so verbos will be true which will be able to see some information out there here we also going to set one parameter which is called as memory true so which will be initialized with some memory and we will go also go ahead and write some backstory about this particular agent okay so let's go ahead and Define some backstory so uh I will keep a backstory something like this this person or this agent is an expert okay see see this okay so I will just go ahead and write this person is expert in understanding videos in AI data science machine learning and gen Ai and providing suggestions okay so this will basically be my backstory and then the third thing that I require is my tool whether I'm going to use some tools or not so here I'm going to basically Define my tool and right now I'll keep the tool empty because I have not created any tool okay and then further I will also say allow delegation delegation basically means will I be transferring after whatever work that I do or this agent does to someone else so we will set this allow dation to True okay so this is all the default parameters that we really need to write for an agent okay uh and based on this you can create anything as such this topic will be the topic that I will probably be giving for whichever topic I really want to create my blog for my YouTube videos okay now the third thing third right let's go ahead and Define this the second agent that we will be creating so here I'm going to write a writer agent blog writer agent creating a senior blog writer agent okay with with YT tool okay so right now I'm also going to create my YT tool which I will also show you how to probably create so this basically becomes my writer or I can also say it as blog writer and this blog writer will be again an agent type agent type and here I'm just going to copy and paste um some information with respect to roles tools and all okay so let me copy it over here and here you can probably see that I have written some of the information like role is nothing but blog writer I can basically write it as something like this blog writer goal is narrate the compiling text stories about the video uh I'm basically going to write with respect to any topic over here from YT channel from YT Channel okay verbos will be true memory will be true backstory we are specifying some amazing back story with a fair of simplifying the the complex topic your craft engaging narratives that cap cap Captivate and educated bringing new discoveries to light in accessible manner then tool have not yet created and allow delegate because uh see at the end of the day blog writer needs to just write the blog so further we do not have to delegate his work to someone else so we are keeping this as false okay so this is what is my agents so two agents have actually created one is my blog researcher and one is my blog writer now let's go ahead uh with the next step over here uh and and uh let's go ahead and Define my task so task or tools first of all we'll go ahead and Define my tools so for tools uh again if I go to my documentation page in cre AI so uh get started let's see let's get started so here if you go down there are multiple tools which it supports right so here you can see Google search serer search browser based web loader so many different different tools are there my uh the tool that I have actually used is nothing but YouTube channel uh Search tool okay so this will basically be searching my YouTube channel okay so first of all it says pip install crew AI tools I've already done that installation if you remember crew aore tools okay and this is how we explore any tool name okay sorry this YouTube search tool so first of all we'll go ahead and import from crew AI import YouTube search tool so let me just go ahead and import this okay and uh after that we will go ahead and initialize our you YouTube channel which YouTube channel we really want to explore and I want my YouTube channel to explore so I will just go ahead and write my YouTube channel name Krishna 06 okay so this is uh this is my tool so this tool is responsible whenever I get any query it should be searching from this particular YouTube channel and this tool we will be using now since this tool is what we are going to use so we need to update in our agents so here I'm going to write from Tool from tools import okay instead of writing tool here I will go ahead and write my Yore tool okay so this variable I will go ahead and initialize in my agents. py okay and the same YT tool I will be using inside my tools now this is completed amazing right so my agents and tools are actually completed if you want any other tool like Sur API Google search API you can just follow this particular page right so uh and don't worry as I we go ahead I'll be creating more amazing videos so let's say that I want to go ahead and do PDF rack search so you can probably use this particular tool for doing that same process right to ask any question from that but this is the most efficient way of creating any um you know agents in an easy way now the third thing that we really need to fill is our task okay now since uh you know that we have created two agents right one is the blog researcher and one is the blog writer so similarly two tasks needs to be created over here so I'm going to write from crew AI import task okay from tools here also we are going to use tools import tool okay so these are the two things and then uh I also need to probably call from Agents import blog researcher comma blog writer so both the agents also I need to probably call okay done so let me just see the name agents blog researcher and blog writer so both the both the agents have actually called over here now the first task will be nothing but the research task okay now in order to probably use this I have to again use this task and uh it is also very simple so here I will probably go ahead and write and create my research task so here you can see here some basic information is required inside this task class one is the description like I identify the video okay get detailed information about the video from the channel so these are the two information that I have given expected output is nothing but a comprehensive three paragraph long report based on the topic of the video content and here I'm going to use this particular tool over here but since this tool name is not there I will go ahead and use YT tool so let me copy paste it over here and let me copy paste it over here so Yore tool will be there so here you can see that I have updated this researcher task what tool I'm basically going to use so YT tool I'm going to use and my agent will basically be my blog researcher okay so these are the updated information that I have with respect to uh this entire research task similarly I will go ahead and create my writing task and again we will be using the writing class so here you can see writing task task description get the info from the YouTube channel on topic this summarize the info about the video on this particular topic tools I'm again going to use yd tool here also we are going to specifically use YT tool along with that my agent will be nothing but my blog writer which will be doing the task async execution okay there is one parameter which is called as async execution a async execution if I set it to true then both this agent will be parallely working okay right now I don't want that to happen because we are going to focus on uh sequential process and finally you also have one output file so all the content all the info that we are basically get getting generated we will put us in the new blog post. MD okay so here you can see uh the entire thing get the info from the YouTube channel summarize the info from this um all the information is basically there summarize the info from YouTube Channel video on the topic and create the create the content for the blog I'll go and add it create the content for the blog so basically whatever thing I explain my YouTube video uh in that way only this blog will get generated okay so both these things are done perfect uh here you can probably see I've also created my task and how easy it was right so finally to run all these things we'll also create one more file which is called as crew. py and that is where our execution will probably start so here I'm going to write crew. py okay uh and this is where my execution is going to start so for this again uh I will go ahead and import some important things like from crew AI import crew crew comma process since we are going to use sequential process that is the reason we are using this then from Agents import the same thing let's see what all things we imported and from tools we have to import all these things okay so from Agents I don't require tool from Agents I'm going to import this from from tools from task from task I'm going to import what all things we have to import from task let's see let's see let's see two things researcher task researcher task research task and the other task is nothing but write task okay so these two are imported now in order to call this in a sequential manner we will be using this crew class we will give our agents researcher and writer so here uh we will go ahead and write blog researcher blog writer okay then uh research task WR task is already there so that is all my task name that I've actually defined this is the most important parameter process is equal to sequential so this basically says sequential task extion is default okay I will also be showing you other sequential Pro other processes as we go ahead okay in the other video memory is equal to True cach is equal to true Max RPM is equal to 100 and share undor crew is equal to true so these are some of the default parameters that is got selected now let's start the task execution so here I'm going to start the task execution process with enhanced feedback okay so this will basically be my result is equal to crew dot kickoff and here I'm going to give my inputs inputs will be nothing but topic let's say one of the topic that I want to search which is my most famous video is nothing but between AI versus ml versus I have the maximum view in this versus data science okay finally I will go ahead and print the result okay so this is how we kick off this entire thing now as we kick off this crew it is going to call this here we are going to basically call this agents task process sequential so automatically it will go to that particular references from that particular pages and it is going to do the sequential execution now let me open my terminal I hope now the terminal is ready now let me go ahead and run python crew. py once I execute this it will start the exec ution it will start exploring it'll first of all query use this tool okay one uh error is that open API key so guys one error that we are specifically getting it is asking for a key error open aior API _ key now let me make you understand what exactly is this error so if I probably go to the documentation page over here one thing is that whenever we want to implement any application with the help of multi- a agents we specifically require an llm model right integrated with our crew AI application because see over here if I go with respect to agents here we are telling it to do many task as such right obviously tools we are specifically using but once we get the relevant information we need to summarize it we need to probably display it we need to uh based on a simple prompt we need to make sure that the content is generated in that particular way so by default if I probably consider connecting to llms crew AI offers Flex ibility in connecting to various llms including local model via AMA and different apis like Azure it is compatible with all langin llm components so here you will be seeing multiple examples how you can probably connect with uh connect the agent with the llm models because at the end of the day all the llm models needs to uh work along with the agent because most of the research work is specifically done with the agent right like a writer needs to probably write the entire blog so obviously an LM is required to summarize the entire block so here you can see that in one of the parameter in agent there is also something called as llm indicates the large language model of the agent uses by default it uses gp4 model defined in the environment using this particular model name now uh what I'll do in this particular video I'll show you with the help of open AI API key later on uh as we go ahead uh we will also be discussing with respect to various open source models like AMA then you have hugging face and all right now let's go ahead and do it with uh open AI so for open AI what I'm actually going to do again if you want to probably do it at any open source right you can again play with this over here in the AMA integration it is told you like what all keys you need to set right and based on that you can actually work and how all the step by step it is given over here but let me just show you with the help of uh open AI over here so I'll go to my agents okay I'm specifically using llm is equal to llm this parameter I'll try to set it up additionally now let me do one thing thing let me go ahead and create my llm before that uh I've already created my environment variable. EnV over here to explore the uh to to to basically explore all the to to get the openi API key itself so what all parameters we specifically required here you can see I will just go ahead and write import OS okay import OS now in this import OS what I'm doing I'm importing open a API key right and this API key is basically coming from my EnV environment table which is having my open a API key and the second one is open aore model name like which model I really want to use okay now one more thing in order to import all these things uh we have installed load. EnV so I'm also going to call this so let me go back again to my agents okay and I'm going to write uh from load. EnV import load. EnV okay so here you can see load. EnV and I'm going to basically import things right so this looks absolutely fine uh here sorry it should be EnV not load. EnV now we are in uh basically we are calling all the variables from the environment variable we are setting up open AP key and open aore model name now let me just go ahead and execute it because this is the thing that is required and after that we will be setting with our llm in our agent right so llm is equal to llm here also we can go ahead and set it in the agent llm on LM so now I think it should start doing our process and it should start working so let me quickly go ahead and write python C.P and now you'll be seeing that it will start this entire process now again let me repeat it uh in our crew first of all it'll go and do the blog research for my YouTube video then it'll give that information to the blog writer this blog researcher is going to do the research task this blog writer is going to do the right task right so here you can see now the processing of the videos has started this will probably take a one minute time and uh because it is around 4 to 5 minutes 6 minutes video it'll probably I have asked for what is AI versus ml versus data science and this will probably go to my video in my YouTube channel explore the transcription you know get all the relevant information and then finally at the end of the day uh you'll be able to see over here we will be getting one new file new blogpost MD so let's wait till then I'll just pause the video I think it'll take a 1 minute time and then once it is executed I will show you so guys finally you can see that the entire program has got executed and uh this is the entire content of the amazing blog that is created for the video query that I had as asked right so if you also go here and see so this is your new vlogging post uh and this is the entire blog right whatever things I explained in the video Everything has basically put up in a good uh good sentence in form of blog now I can directly use this and I can even automate this if I'm probably creating a big amazing end to endend project this will get also get automated automatically that entire Vlog may also get created so here is each and everything under the umbrella ml DL and data science you know the words has been correct over here and this is how it has worked right and if you probably see how much processing it probably took you know it was hardly 1 hour sorry 1 minute of uh embedding it has done embedding many things it has done probably first of all see when we hit the query it goes and search in the YouTube channel once it gets the video then it removes I mean it takes out all the transcript then finally you'll be able to see that it has been able to create this entire content right so this in short is an amazing way of creating this uh creating of agent task and tools uh and here you can also see sequential processing is basically happening researchers is doing one work two agents are also communicating now further going ahead you know um not let not make this particular video big so what I am planning to do is that uh with respect to this I will also show you how you can also work with other llm models as we go ahead so that will be coming in the next video so I hope you like this particular video this was it for my side I'll see you all in the next video thank you take care
Info
Channel: Krish Naik
Views: 24,113
Rating: undefined out of 5
Keywords: yt:cc=on, crew ai tutorials, crewai crash course, multi ai agents using crewai, crewai langchain
Id: UV81LAb3x2g
Channel Id: undefined
Length: 32min 41sec (1961 seconds)
Published: Mon May 27 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.