Hello guys.
Welcome to this crash course of creating multiple AI agents for real world use cases using q AI if you
haven't heard about this platform.
So Q AI is an agent framework, uh, which will actually help you to create multiple 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 Q AI platform or framework
to develop multiple AI agents and where it will basically be required.
See in long chain.
Also you have an option to create agents, right?
But here the main thing with respect to AI 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 will be able to implement
the task much more in an efficient way.
Okay, so this is the entire web page of the crew.
I.
And right now many, many people are using it.
They are creating multiple agent crews.
You can see over here in last seven 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 1900 plus videos.
Um, now, what I really want is that, uh, 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, Write 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 thing with the help
of AI framework, where this blog 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 Q 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 I, let's say I'm querying about Q I 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
blog page.
Right.
Now, obviously, I know that I have created more than 1900 plus videos now if I really 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 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 to 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 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 will 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 creo
I um so creo I 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 it will 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 is good at data science, who is good at data analysts
because my entire channel is based on data science itself, right?
I so here obviously I need an expert person who will probably go ahead and watch 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 expert person, right?
It can be a data scientist.
It can be an analyst.
Right.
So this two roles here you can basically consider in queue I 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 Q I the first component is specifically agents.
The second component that we specifically use in Q is task.
Right now each and every agent does some kind of task.
Let's say the domain expert people will probably go ahead and watch this particular YouTube video,
try to translate, 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 the agent.
Its task is 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 expert is one 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 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, uh, 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 tool which will be able to, uh, provide me the 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 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 videos from this particular videos.
It may use some kind of I.T 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, 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 hierarchical processes.
So here in the sequential process once the researcher completes his 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 will probably go ahead and create the blog page.
So I hope you got an idea about what are the main important components of creo I.
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 explore 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 y t 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 as sequential process because once this is getting completed,
the next step is to get, uh, to complete this.
There are also other processing, uh, other processes like hierarchical process where parallelly 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 conda environment.
Okay.
And this you really need to do it for every project.
So I will go ahead and write conda create conda create minus p v n v python double equal to 3.10.
So okay I will be taking 3.10.
That is 3.10.
Now after doing this uh let's say installation probably happen uh, once the installation actually happens
on a new environment is basically created.
What we are going to basically do is that we are going to create our requirement dot txt file.
So let me just go ahead and write my requirement dot txt file.
Okay.
Uh now inside this requirement dot txt file I will be using some of libraries that I really need to
install.
One is the CRI.
Then one I'm going to write Python.
Okay.
Right now I don't require this.
So let me just go ahead and write creo underscore I sorry creo I underscore tools right.
So these are the two important libraries I will be requiring.
So let me save it.
Now this environment is basically getting created or it has got created.
So I will go ahead and activate v and v okay.
So conda activate v and v.
Now let me quickly go ahead and let me do one thing guys.
Let me hide my face so that you will be able to clearly see this okay.
Now let me just quickly go ahead and write pip install minus r requirement dot txt.
And this all both the requirements will get installed okay.
Okay, so once this installation is basically happening uh, we will continue our task.
The first of all, as you know we need to create our agents.
So agents dot p y I will go ahead and create it.
The next will basically be tools dot p y.
Okay.
Uh, agent tools and I also require task okay.
Task dot p y.
So these three components are 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 I will go ahead and import from Korea.
I 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 agent.
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 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 tasks.
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 block
creator or block 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 white 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, uh, this one.
Okay.
Name.
I can basically, uh, right over here description so I can.
Right.
So let me just go ahead and uh, uh, write the name, but let it be.
I don't require this too, 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 verbose.
So verbose will be true, which will be able to see some information out over here.
We're 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.
I am providing suggestions.
Okay.
So this will basically be my back story.
And then the third thing that I actually 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 delegation 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 from 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 white tool.
Okay.
So right now I'm also going to create my white 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 underscore writer.
And this blog writer will be again an agent type.
Agent type.
And here I'm just going to copy and paste, uh, some information with respect to roles, tools and
all.
Okay.
So now 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 compelling text stories
about the video, or I'm basically going to write with respect to any topic over here from y t channel
from y t channel.
Okay, verbose will be true.
Memory will be true.
Back story.
We have specifying some amazing back story with a fear of simplifying the complex topic.
Your graph engaging narratives that captivate and educated, bringing new discoveries to light in accessible
manner.
Then tool I have not yet created and allow delegate because see, at the end of the day, a 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 agent.
So two agents have actually created.
One is my blog researcher and one is my blog writer.
Now let's go ahead with the next step over here.
Uh, 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 career I 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 server 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 creo AI tools.
I have already done that installation.
If you remember I underscore 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 Crewe Q I 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 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 zero six.
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 y t underscore two okay.
So this variable I will go ahead and initialize in my agents dot p y Okay.
And the same 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 Serp API, Google Search API, you can just follow this particular page.
Right.
So uh, and don't worry as I will 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 task needs to be created over here.
So I'm going to write from crew Crewe.
I 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 a both the agents have actually called over here.
Now the first task will be nothing but the research task.
Okay.
Now in order to properly 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 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 it tool.
So let me copy paste it over here and let me copy paste it over here.
So white underscore 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 white 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 or topic this.
Summarize the info about the video on this particular topic.
Tools.
I'm again going to use white tool here.
Also we are going to specifically use white 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.
Async async execution.
If I set it to true then both this agent will be parallelly working.
Okay, right now I don't want that to happen because we are going to focus on sequential process.
And finally, you also have one output file.
So all the content, all the info that we are basically 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.
Uh, 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 explained 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 have also created my task and how easy it was.
Right?
So finally, to run all these things, we will also create one more file which is called as crew dot
p y.
And that is where for our execution will probably start.
So here I'm going to write crew dot p y.
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 I import crew.
q.
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 From tools or 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.
Research task.
And the other task is nothing but write task.
Okay.
So these two are imported now 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 we will go ahead and write blog researcher blog writer okay then our research task right.
Task is already there.
So that is all my task name that I have actually defined.
This is the most important parameter process is equal to sequential.
So this basically says sequential task execution is default okay I will also be showing you other sequential
other processes as we go ahead.
Okay.
In the other video memory is equal to true.
Cache is equal to true max RPM is equal to 100.
And share underscore queue 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 and hence feedback okay.
So this will basically be my result is equal to Q dot kick off.
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 AI 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 that my terminal is ready now let me go ahead and run Python crew.py.
Now once I execute this, it will start the execution.
It will start exploring.
It will 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 AI underscore API
underscore 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 AI agents, we specifically require an LM model right integrated
with our AI application.
Because see over here if I go with respect to agents here, we are telling it to do many tasks as such.
Right.
Obviously tools we are specifically using, but once we get the relevant information we need to summarize
it, we need to properly 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 any LMS, Crewe I offers flexibility in connecting
to various LMS, including local model via Allama and different APIs like Azure.
It is compatible with all Lang and LM components.
So here you will be seeing multiple examples how you can probably connect with uh, connect the agent
with the LM models, because at the end of the day, all the LM 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 block.
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 GPT form 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 OpenAI API key later
on, uh, as we go ahead, uh, we will also be discussing with respect to various open source models
like llama.
Then you have hugging face and all right now let's go ahead and do it with uh, OpenAI.
So for OpenAI, 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 llama integration it is told you like what all keys you
need to set right.
And based on that you can actually work.
And uh, how all the step by step it is given over here.
But let me just show you with the help of, uh, OpenAI over here.
So I will go to my agents.
Okay.
I'm specifically using LM is equal to LM this parameter.
I'll try to set it up.
Additionally.
Now let me do one thing.
Let me go ahead and create my LM.
Before that.
Uh, I have already created my environment variable dot env over here to explore the, uh, to to to
basically explore all the to to get the OpenAI API key itself.
So what all parameters we specifically require 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 OpenAI API key.
Right.
And this API key is basically coming from my env environment variable which is having my OpenAI API
key.
And the second one is OpenAI underscore model name.
Like which model I really want to use.
Okay.
Now now one more thing.
In order to import all these things we have installed load underscore dot 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 underscore dot env import load underscore dot env okay.
So here you can see load underscore dot env.
And I'm going to basically import things right.
So this looks absolutely fine.
Uh here sorry it should be dot env not load underscore dot env.
Now we are uh basically we are calling all the variables from the environment variable.
We are setting up OpenAI API key and OpenAI underscore 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 LM in our agent.
Right.
So LM is equal to LM here.
Also we can go ahead and set it in the agent LM underscore 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 q.py.
And now you will be seeing that it will start this entire process.
Now again let me repeat it.
Uh, in our queue.
First of all, it will go and do the blog research for my YouTube video.
Then it will 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, six minutes video, it will 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 will be able to see over here, we will be getting
one new file, new blog, underscore post.md.
So let's wait till then.
I'll just pause the video.
I think it will take a one 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
asked.
Right.
So if you also go here and see.
So this is your new vlogging post.
Uh, and this is the entire vlog, right?
Whatever things I have 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 end project.
This will also get automated automatically.
That entire blog may also get created.
So here is each and every thing 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 one hour or,
sorry, one 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 in search in the YouTube channel.
Once it gets the video, then it in removes a 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 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.