📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

How To Use AI Agents To Do ALL Your Work - Full CrewAI Course for Beginners

Tyler AI2:16:59

Transcription

I'm going to teach you the full crash course to learn Crew AI and become a master. By the end of this video, every day I spend hours reading and replying to emails. However, with the power of Crew AI, I can limit this to under 15 minutes.

So to start off, let's learn Crew AI. Well, Crew AI is an agent framework that allows us to create these agents to help us solve simple or complex tasks. AI agents can assume roles, share goals, have backgrounds, and operate in a cohesive unit, much like a well-oiled crew.

You can have many agents do different things, such as develop a game, create a blog post, or give us a trip planner. But what is an agent, and what is a task in the realm of Crew AI?

Well, an agent is just an autonomous unit that can perform tasks, make decisions, and communicate with other agents. When we go to create these agents, they have many different attributes. The ones that you need to have are the role, goal, and backstory.

So, the role is just what this agent is designed to do. What task is it ready to accomplish? The goal is just what the objective of this agent is. Of course, there are other attributes that we will go over later, but these are the important ones.

Here's what some simple code looks like to create an agent: we import the agent from Crew AI, create an instance of that, and then we give it a role, goal, and backstory. In this case, this agent is a data analyst. We also see that there is a tools property or attribute given to this agent, and they're just giving my tool one and my tool two. Tools are there to help the agent accomplish the task, and we'll go over that later.

Now, that was kind of the previous way to create an agent, and you're more than welcome to still create it that way. But this is the newer way that they have given us or allowed us to create agents.

In this instance, we have a defined poem writer Python function. That's all this is, but it's returning the agent class. Inside this function, you can see that we say return agent, and we give it a configuration. This configuration is going to point to another file where that file has all the properties for this agent, such as the goal, role, and backstory.

Now, a task in the Crew AI framework is just a specific assignment to be completed by the agent. Much like the agents, the task has all these attributes that we can give to the task object. For instance, the description will detail the task's purpose and execution for the agent. Then you have the agent attribute, and we have to assign this task to an agent.

Here's example code of what a task would look like: we import the task, create the task object, and give it the description, agent, and expected output. Like I mentioned before, that was kind of the previous way to do it, which can still work. But in the newer way, you can see we have another Python function called define write poem, and it's going to return the task object. Again, it's going to be pointing to a configuration file that has all those properties defined.

Finally, to wrap this up, we're going to go over the Crew object. This is what brings everything together. When we create a crew, we have to give the task and the agents and the process so that it knows how to put everything together. We can kick off this crew and then run it.

Now here, I decided to give you the newer way. Much like the other two for the agent and task, we have a defined Python function called crew. It's going to return a crew object. It also has a decorator at crew. When we return the crew object, we have the agents and the task and the process defined.

By the way, if you want to join a community that's learning how to use AI agents, how to develop them, and use them for business automation to save time and money, join my school. You will be with like-minded people who want to use AI agents for real-world purposes, whether that's personal or business. The link is in the description.

Look, I know that was a little bit of explanation, a little bit to take in, especially if you haven't worked with Crew before. But the best way to learn is just to start coding. So let's go ahead and create our first crew.

The first thing we need to do, though, is create a project. I have created a folder called Master Crew AI Course. This is what will be in the GitHub whenever you are going through this course as well. But what I want to show you first is how to actually set up your environment.

If you already know how to do that or you do it your own way, you can go and skip this. But if you aren't sure and want to do it my way, let me show you how I do it. I like to use the Conda environment.

To download that, you have to go to anaconda.com. When you come here, you can see there's a free download button. You click this, and it looks like you may have to provide your email to download all this, but you don't. There's a skip registration button that they are kind of hiding.

Then you come down to the download page and choose whichever one is for your machine. Go ahead and download that and wait for the installation to be done. Then we're going to go ahead and come back to our IDE. Again, I am going to be using the Cursor IDE. I have been using it for months now, so if you want to go ahead and use that, there is a free version that you can use.

What I'm going to do now is create an environment. Whenever you create this environment with Conda, you can use the same environment with other folders or other projects. It's not just specific for this project; you can activate it in other projects, but we need to create it first.

You'll say `conda create -n` for the name of it. I'm going to name it Master Crew AI Course, and I'm going to specify the Python version that I want to use. I've been using Python version 3.11.9 for a little while, which is what I also have installed on my machine. This will take a minute to install, but once it's done, you go ahead and proceed. Just say yes to proceed.

Once you're done, it'll ask you if you want to activate this environment, so I'm going to say `conda activate Master Crew AI Course`.

Now that this is activated, we can go ahead and install everything we need for this course. First off, there's a command called `clear`. This will clear up the terminal. You're going to type in `pip install crew aai` and `crew AI tools`.

Now that's going to take a minute to install, but now we're going to install these packages with the latest updates just on the Master Crew AI Course, or whatever you named your environment. It's just going to be installed in this environment.

Whenever you create another project, you can activate this environment, and it'll already have these installations for you with these versions. Hopefully, it installed all the packages correctly for you. If you're using something like Python virtual environment, there may be issues with something like Chroma. I have read those before; this is why I like to use Conda.

This is a relatively new way to create many things. What we're going to do is in the command line or in your terminal, which you can access, for instance, I'm using C. You can go to terminal and create a new terminal. Then I'm going to say `crew AI create crew`, and then we can just give this a name. It doesn't actually matter what it is, so `AI latest development`.

Then what's going to happen is it will give us a couple of options and then create the whole crew for us, so we don't have to create the files. I mean, it's a little unnecessary anymore to have to do that. It's what they call boilerplate code that you have to do every time, and this really speeds up the process.

Here, we can select a provider to set up. For instance, I will select one for OpenAI in this example. We'll go over local models in a bit and then select the model I want to use for OpenAI. I'm going to use the GPT-4 model, so I'll select number two.

Here, we need to enter our OpenAI API key.

Well, let's go and go over these files, and then we're going to run this. We shouldn't really have to do anything; it should just run as it is since we've already given it the API key.

In your folder, AI latest development, or whatever you named your crew project, we have a source folder, and then it again calls it the AI latest development. We have a configuration, tools, a crew, and a main Python file.

The main thing here is the crew.py file that I created. If you have used Crew several months ago, this is not exactly the way that they've done this. They've reorganized how they create the crews now, and personally, I think this is way better.

So this is your first time looking at this, and I know it's different and maybe a little daunting because it looks radically different, but I promise you this is a much better way.

There are things called decorators; that's with the @ symbol above the class. We have it above this researcher function, and all this is doing is saying, "Hey, this class here is basically going to be a crew."

Any function that has the @agent is going to tell the crew, "Hey, this is an agent that we are returning; this should be a part of the crew."

You can see here we have this function researcher; it needs to return an agent class. So we're going to say return agent, give it a configuration, and we're going to say verbose equals true. If we had tools, you know, you could give the tools here, and we're going to go over that in a later section.

We have another agent; this is called the reporting analyst. We're going to create another agent object, and we're going to give it a configuration, which we will look over, and this is also verbose set to true.

So what we've done so far is created two agents: a researcher and a reporting analyst. Now we also need to create a task for each of these, so we're going to create a research task returning a task object.

We can give the configuration for this task. Instead of having all the properties here inside of the task object, which you can certainly do, you can also put everything for the agent in the task inside of what's called a YAML file, which just stands for "Yet Another Markup Language."

Nothing crazy; if that's a different extension for a file, don't worry about it. It's just markup language, okay? Nothing to be concerned about.

Then we have another reporting task where we give it the configuration, all the properties needed for a task to run. We have the output file here, which you can either put the properties here or you can put some here and some in the YAML file. It's your choice, whatever you would like to do.

I'll kind of mix and match so you can just see the different ways to do this. This means that the task, when it's done, should save to an output file report.md for markdown.

This is really where some amazing things happen. We have to create a crew, and now this is given the crew decorator, right? So when we go to import this into the main Python file, it's going to look at this crew and say, "Hey, okay, this is the crew that we need to kick off."

We're going to create a crew object, and we're going to give it all the agents, all the tasks. This is going to be given the sequential process, which is there by default, but it's just added here so you can see that it's explicitly being given the sequential process.

We're going to set the verbose to true so we can see everything that's taking place in the background.

Something that if you're not used to seeing, as I had mentioned, this just says self.agents and self.tasks. All it has to do is look through this class, see which functions have an agent decorator above them, and it knows that's an agent.

The same thing for the task; it knows that it has a task decorator above this function, and it's going to return a task, and it knows that. So it's going to go ahead and collect all the agents and tasks for the crew without having to explicitly add them into a list for each of them.

The last thing that we're going to go over is the agents config and the task config, right? So it created these two YAML files up here.

Let's look at the agents YAML file. We have the researcher, so this is the name of the agent. We have the role, the goal, and the backstory—the three things I said that you need to have for an agent.

The role for this researcher is going to be the senior data researcher. There's also this weird thing that says topic with curly braces; we'll see that in a minute. Then we gave it a goal, and we gave it a backstory.

The same thing for the reporting analyst; we give it a role, a goal, and a backstory. If we go to the task, we have two tasks: the research task and the reporting task. We have the description and the expected output, and also the agent that this task is going to be assigned to.

So the research task, which makes sense, should be assigned to the researcher agent. Then the reporting task is going to be assigned to the reporting analyst agent.

This is a YAML property file where instead of explicitly having to put the description, the expected output, and the agent inside of the crew, for the task here, you know, we could certainly also say that we could say agent equals and then self.reporting analyst.

That would be the name of the agent up here; we could put that here, or we could just define that in the YAML property file. Either way is good; it doesn't really matter.

It's just with the property file, it cleans up a lot of the mess here in this task, and it's just kind of the way that they're preferring it, and I prefer it as well.

So it's really to start with that now. Then we have the main Python file. There are some things here: there's run, there's a train function, a replay, and a test. We are not going to worry about three of these right now.

We're going to go ahead and just delete these three and just leave the run here. Then underneath here, we can just call the run function.

Now we are about ready to go, but just let's go over what this is doing real quick. We're calling the AI latest development crew. So if we go here, this is the class, this is the class of the AI latest development crew that was created to have all the agents and the task in actually defining the crew.

What we're doing is saying, "Hey, take this, call the crew function, and then we're going to kick off with these inputs." These inputs, as you remember, we had a topic surrounded in curly braces in the task.

What happens is if we give this input, say AI LLMs, that's going to be inserted into the task. If we go back to the agent, for instance, the role for the researcher was a topic, and then it said senior data researcher.

So the topic was assigned to AI LLMs. When we go to run this, you'll see in the verbosity of it that this is going to say LLMs senior data researcher.

Also, for the goal, it'll say uncover cutting-edge developments in AI LLMs. Now, I say that this should work; however, there's one thing we need to do, and we need to get rid of this part before the from right.

So we just say from crew import AI latest development or whatever you named your project, right? We don't need that there in order for this to run. You can actually need to remove that in order for it to run.

There's actually one more thing that we need to do that I had forgotten to mention. Inside of your crew.py file, we need to actually load the environment variables, such as the OpenAI API key or any other tool keys that we'll use later on.

So in the crew.py file, we need to type in from env import load_env, then execute the load_env function. What it's going to do is find the env file and load the keys that are needed for the agents in the task in our project.

You can just do that in this crew.py file here, and now let's go ahead and run this. So all we've done so far is we created a crew, made a couple of adjustments to make sure that it runs properly, and now we can run it.

Instead of this, this is so much better than creating all these files yourself and the folder structure that's needed and so forth, right? We don't need to do that anymore. This is the way to create your crew.

Also, don't worry about the red underlines. If you want to restart your IDE, they should go away.

So in the AI latest development folder, which is where I'm currently at, I'm going to now say Python, then source AI latest development slash and then type in main Python file main.py.

Now if I run this, it's now going to find my API keys, and it should run the whole process. Let's see if it works.

And it is working! So it made sure it checked to make sure I have an OpenAI API key. I do. The first agent that's being run is, like I mentioned, it's going to be called AI LLMs senior data researcher because, let me come back up here, because the topic as an input that was given to the crew was called AI LLMs.

Now this task has been assigned to the agent, so it's going to try and run this. The final answer, so this is basically the output, it came up with 10 different things about AI LLMs.

Then the next thing that's happening is the next agent, AI LLMs reporting analyst. So this was sequential, right? The first agent was the senior data researcher, and then the second one is now the reporting analyst.

It gives the final answer because its task is to review the context it got, which basically means it got the output from the first agent, is going to review that, and then kind of expand that into a full section for a report.

Now if we scroll down here, this is the whole output, you know, expanding upon what the first agent did. If you remember in the crew Python file, let me minimize this terminal a little bit.

If we come down here, the second task, the last task was to save the output to a file called report.md. Over on the left-hand side in our project pane, we have one, and this is now our report.

Now if I can do the markdown preview, we can actually look at this, what this would look like for the markdown I created. As you can see, it went through each of the topics that it got from the first agent, then just expanded upon it and makes it look like a more in-depth report.

Okay, great job! You just created your first crew. This is an important step, which you'll see later that is kind of the basis for creating anything within the Crew AI framework.

Now, what we've been using, or what I will continue to use, and we just used was the OpenAI family of models, which means that you need to get an OpenAI API key, which is fine. But you know it does cost cents now.

The models have gotten much cheaper and better, which is good for us as the consumer. However, not everybody wants to do that. But the problem with that is you are stuck to the OpenAI family of models, and there are so many other AI models out there.

In this next section, I'm going to show you how you can use any local AI model, and to do that, we're going to be using a software called Olama, which is free. Let's go ahead and get into that now.

Okay, well, in order to run local models, my favorite way to do that is to download Olama. It makes it really easy to download the models and then run them locally on a server and then connect them to Crew AI. I'm going to show you how to do all those things.

The first thing is you can go to olama.com, and you'll be greeted with this page. Now you don't have to sign in or anything; you just click this download button. Then you'll choose which version for your machine. This is how you'll download it.

So go ahead and download it and install it. Once that is done, there is a models page on the website, and these are all the models you can search for. You can filter them, search for them by newest, most popular, however you want to do that, right?

But you can choose a model this way, and what I'm going to do is choose the Llama 3.2 model. Once you're here, it has a drop-down for which models you want to choose from.

Well, let's go and set up our crew to accept this, and then we'll run Olama and then download this model to use it.

Okay, so let's go back to our crew. Well, the first thing we need to do in our crew is go to your crew.py file. This is where we're going to create the new LLM object and then give that to both of our agents.

The first thing is we need to import the LLM class. So from crew aai, we're going to also add the import for LLM. Then somewhere within the class down here, like you just do it below the configuration, it doesn't really matter, but I'm going to say `self.llm = LLM`.

There are a couple of things that we need here, right? We need the model and the base URL because when we go to run Olama, it's going to run a local server, and then we need to grab the model from that server and use it here.

Now, in order to make this work, under the hood, Crew AI uses Light LLM. What Light LLM does is kind of make it easy to connect to all of the different providers and use their models.

If you look on the left-hand side here, which I'll have this link in the description, there is one 140 Llama. Now, you're not going to import it just like this, but in order to find something that you want to use, such as if you like LM Studio, they don't directly support LM Studio.

But I do have a video where we actually have to use the OpenAI instance in order to get that to run. But we're using Olama right now; let's get back to that.

Now, in order to make this work, we need to add a couple of properties. Like I said, model and the base URL. So the model is going to be `olama/` and then now we need to get the name of the actual model.

So if we come back to the model, whatever model you're going to use, get the last part of the name here. We're going to copy that and add that there as the model.

Then we need the base URL, and it's going to be `localhost:11434`. Okay, when we go to run this, this is the port and the localhost that's running for our AI server.

Now we need to inject this LLM because by default, all the agents are using OpenAI, but we want to change that. So you can add another property called `llm` to each of the agents, and it'll be `llm = self.llm`.

You say `self.llm` because we are inside of the class, and the same thing for the reporting analyst. We will say `llm = self.llm`.

Now we are not going to be using OpenAI; we're going to be using Olama. But we need to run Olama, so go ahead and start Olama. You'll know it's running when you see the little Olama symbol.

The last thing we need to do is actually download the model that we want to use. We already have the model name, right? So all you're going to type in your terminal is `olama pull`, then you're going to copy in the name of the model.

I'm just using the 1 billion parameter model. I already kind of had it downloaded, so this is why it was so quick. That took a couple of seconds, but it'll take a little bit longer for you, especially depending on the size of the model you're using.

All right, so it successfully downloaded it. Now all we need to do is rerun the Python file. So I'm going to do the same command I did last time: `python source AI latest development main.py`.

Just to verify with you that it's actually using Olama and it's still not trying to use the OpenAI API key, I actually went to my .env file and I renamed it to SK project11, right?

So it's not actually getting my API key; it's not using the GPT-4 model. This is actually going to take a few—might take a couple more minutes on my machine just because my machine isn't the best to run.

When you're running a local model, it's dependent on the machine. But just to let you know, if you had any doubts like, "Oh, it's still showing my API key when I run this," well, yeah, it is. That's just a check in the background, but don't worry; it's not.

As you can see, even this is a much smaller model, and so the output might not be the best, but it did work, and it gave me an output.

If we open up the report.md file, I'm going to view this or preview this. You can see it still worked, right? It had topics, and then it went into a little bit more detail about those topics and created the report.

Great! Now from now on, if you do want to use a local model, you now know how to. This is going to pave the way forward so that if you don't want to use OpenAI, you are more than welcome to use any of these local AI models that you want from here on forward in the rest of this course or in the projects that we are going to do.

Now we're about to start our first project. However, before we do that, we are going to be using tools to do this. We're actually going to be using three different tools in this project. But before that, I want to explain tools really quick, and then we're going to start coding them.

This is really exciting because tools can be really powerful to help out our agents. Well, a tool in Crew AI is just a skill or a function that agents can utilize to perform various actions. Crew AI actually has their own toolkit, and so does LangChain and LlamaIndex, but we're just going to be using the Crew toolkit for right now.

How does this look? Well, what we're going to do is, depending on the tool that we need, we're going to import these tools from Crew AI tools, and then we simply instantiate these objects.

Then we're going to pass these into the agent. We saw this in the very beginning, but how this will work is once we create the agent, there is a tools attribute, and then you give a list of the tools that we want that agent to use.

Whenever, well, depending on the task that they're going to complete, they may or may not use these tools to help them complete that action.

For this project, we're going to create a crew. We're going to use three different tools, like I mentioned. One agent will do a Google search on websites, another agent will scrape each of these websites, and then another agent will summarize everything.

Then we'll have another agent that's going to save this to a file using a different tool. So get your coffee ready, whatever it is; let's get coding!

All right, for this new project, what we're going to do is first create our new crew. So we're going to say `crew AI create crew`, then we just call it `ai-news`. Again, I'm going to use OpenAI GPT-4, and then I'm going to enter the same API key we did from the first project.

It's going to go ahead and create the news successfully over here. Let's go and do a couple of things to clean up before we get started.

So under the main Python file under the source, go ahead and get rid of the `from AI news import` and then also we can get rid of the train, replay, and the test functions. Then you can just call run.

Also, in the crew.py file, let's go ahead and say `from env import load_env`, and another great thing about Cursor is it knows I've done this before, so it thinks that's what I would do here, and it was correct.

Now we're going to have a few agents with this project, like we mentioned. Okay, so what we can start doing is we need to start renaming things. Then we need to add an agent and also add another task, and we're going to use a few tools this time.

All right, now I'm going to go over using all of these tools and how to get them set up. The goal of the first agent here is to go out and Google search to retrieve news websites. Then the next agent is going to scrape those websites, and then we're going to have another agent save that to a file.

They're all going to use different tools. So what we can do is we start renaming these things. The first agent we can say retrieve news. Then we can also change the configuration name of the agent for retrieve news.

In here, for the tools, we're going to be using the Serper Dev tool, which means we also need to go ahead and import that as well. So you'll say `from crew aai.tools import SerperDevTool`.

Okay, and then we can go and get rid of some of the comments here. But now whenever we go to run this agent, which we'll have to get the API key for this, it's going to go ahead and Google search and find websites about news that we're going to give it, like the topic that we're going to give it.

The next agent is the website scraper, so we'll say website scraper. Okay, and then this is going to use a different tool. So we'll say tools equals this is called the scrape website tool, which means that we also need to import that as well.

Now this one, when it gets all of the websites that it needs, or hopefully it can scrape for, it's going to go ahead and scrape all of those and extract information from them.

But now we don't have a third agent, so we need to create one. The goal of this agent is to summarize everything that it got from the website.

So what we can do is we just copy and paste this because we only have two agents, right? We need a third and a fourth one, actually. But for this one, we can say this is AI News Writer.

Then we don't need the scrape website tool, so that's just going to be an empty list, or you can just remove this completely. Finally, I'm going to copy that again, and we're going to paste this, and this is going to then be the file saver agent.

So it's going to take everything we get from the News Writer, and it's going to save it to a file. But we're going to be a tool to do that, so we're going to call this one the file writer agent.

We also need to add in the tool here. Again, you can go to their documentation page, and I know that there was one called file writer.

So if you come up here, this is called the file writer. So I know this is going to be the file writer tool, and then we can come back up here, and we do need to import this.

Okay, good! Now what we have are we have our four agents: it's going to retrieve the news, it's going to scrape those websites that it gets, then we're going to have an agent that writes everything, kind of makes it look nice, and then we're going to write that to a file.

So it's four different agents, but we only have two tasks. Okay, so we need to change up these tasks as well.

All right, so you can kind of pause this, but what I've done is we now have four different tasks here. So we have a retrieve news task with the task configuration name, which we're going to have to change the YAML file as well.

We have a website scrape task, an AI News Writer task, and a file write task. Okay, and then if we come down to our crew, we don't need to change anything here because remember when we get these agents, it's going to look for every function that has an @agent decorator on it, and it's going to know that this is now going to be an agent, and it should return an agent.

So that it works successfully. The same thing for the task; anything with an @task decorator above it, any function, it knows that that is supposed to be a task, so it's going to automatically retrieve those and put them into the crew here.

Now with that, we do need to update our configuration, so we need to update the agents' config and the task config.

So over on the left-hand side under the configuration folder, we have the agents and the task YAML file. So if we go to the agents YAML file, okay, so I've updated them.

So the names of the agents are correct from the crew; they are added over here. They each have a role, goal, and backstory. They have the website scraper, the AI News Writer, and the file writer, and I just gave them simple roles and goals and the backstory for each of them.

There's nothing super complex; it's just to give an idea of what this agent is supposed to do. Now we need to go over to the task YAML file and do the same thing.

Okay, now I have my task set up. So I have the retrieve news task, which is going to have the description. The expected output is I just want a list of the 10 websites with the most relevant information about whatever topic we're going to give to this crew.

Then we have the website scrape task. You know, each of these, I try to give an expected output, like give it good direction, right?

So at the AI News Writer task, I want a fully fledged news article with the main topics, each with a full section of information formatted as markdown.

Then the file write task, you know, I just want this to be saved into a file with the date that we are going to provide it with and then the news article.md.

So anytime we run this, it should be like a unique file, and that's what I want because let me show you how to run this multiple times in one execution.

Now with that, we are almost done. We are missing one thing, and the Serper Dev tool does require an API key. However, don't worry; it is free to use.

In our .env file, we're going to say `SERPER_API_KEY`, and then let's go ahead and retrieve that now. So if you go to serper.dev, look, it says you get 2500 free queries, and I assure you that this will last you.

You may not actually even need to pay for an upgrade; this is still lasting me for a long time. Okay, so once you are signed up and you're signed in, you will be greeted with this kind of page.

At the top right here, you can go to your API key, click that button, and then just copy that here. So we're going to copy this, and then we're going to paste that right here into your .env file.

We're going to save that. Okay, we are almost done. Just one thing to note here, as I did this, I realized there's a couple of things for the task I want you to fix.

For the AI News Writer task, change the description to say summarize information from the websites into a fully-fledged news article.

Of course, if you're just using my GitHub, I already have this here, and you can just copy this, which is what I would recommend doing. You can modify it to what you want.

For the expected output, add a folder for it to save it in.

Okay, with all of that said, now let's go ahead and run this and see that it works.

Okay, so a lot's happening. I can't actually even scroll to the top, but it's started, and what it's doing right now is it's trying to scrape all of the websites, right?

So it successfully scraped the content from the fourth website, whatever that is, right? So the tool input was we gave the website URL, so this is the URL that we are going to scrape, and it's doing that right now, right?

So it's going to scrape everything, and I know I'm kind of coming all the way down here, right? Okay, so I think it finally finished.

All right, so the website news scraper from each of these, it kind of gave a final report from each of them. The News Writer is going to summarize each of these, so this is what it's doing for each of the websites that it did.

Now, the thing about a regular Google search is, right, so if it Google searches and it's like a YouTube video, it can't scrape that.

I mean, yes, it's technically a URL, but it doesn't know how to scrape like a video format, right? But if you get something like a website 404 URL, maybe you need to sign in or something, it's just not quite working.

That's okay; that will happen sometimes with just a normal Google search, and you're trying to do a web scraper. That's all right.

But now continuing, we have the AI News file writer, and it's going to use the tool file writer tool. So the file name was 2024 news article.md in the directory news, and here is the content, which is what was from the previous task, which was the third task to summarize everything.

Now if we scroll down here, it says it's been successfully written to the file news blah blah blah. So here's a news article news folder with everything it saved it to.

Now if we come up here on the project pane on the left-hand side, there is now a brand new news folder, and it has the news article that we wrote to.

So if we let me minimize the terminal here and then preview this and look here, we now have actually scraped news from the website or from the Google search, and then it went through, scraped each of the sites, then summarized them, and then added them to a file and saved them as markdown.

That's great, right? Now I just did something simple called AI LLMs. You could do specific topics, which leads me to the next section, which is the kickoff for each.

Let's test that out now with this kickoff for each. This means that we can have multiple different inputs as an array, and we can kick off this crew many different times with different topics that we'll see in a second.

So what I'm going to do now is I'm going to add different topics here. We're going to create this into a list, but I also updated the date time to add in the hour, minute, second because if we do this, it's going to keep overwriting itself with the date, and I want this to be different.

I want to have different files so I can showcase to you the kickoff for each.

All right, so how this works now is we actually need an array of inputs. So instead of just having a singular input, you know, we have one input variable as a dictionary with multiple different inputs.

We just need to convert this into an array of them. So I'm going to have three different topics now here with the date. You know, I can have some of them. This is where I could have the date differently for each of them if I want to worry about the file name, but I'm not worried about that.

So basically, just have three different topics: AI agents, OpenAI, and Hugging Face. Now instead of the inputs being just the singular input, the inputs are an array.

Now instead of just kickoff, it's kickoff for each, and that's pretty much it now. Now we can go through all this different data, and it'll kick off the crew for each of this set of inputs.

Now let's run this. I'll come back to whenever this is done, but I just want to let you know. So the first topic in this array was AI agents, so we now can see that the first agent name is AI agents, AI News Retriever.

It's going to keep doing this for the rest of them. It'll eventually do OpenAI and then Hugging Face. So we'll come back whenever all of the news articles are printed out up here or saved up here in the project.

Okay, and it finally finished. There was one little snag. It's not actually a snag; everything worked perfectly. I saw it as it was happening, and you know, it saved the latest news.

I just forgot to realize that the date time is not actually going to change, so it stayed consistent throughout the whole thing.

So I didn't—I should have made a different way to actually save the article. So I tried to copy one, but the latest one, you know, this is about Hugging Face.

So if we go to, if I, you know, this was the third input, right, was Hugging Face, and then the second one I did happen to copy and change it, and this was about OpenAI.

So you know it did work properly; we just need to figure out a different way to save them as different file names when you do the kickoff for each.

But either way, this is to show you that this was the last one about Hugging Face was the third input. Go back to our crew. Let me get rid of this.

Go back to our crew or go back to our main Python file. I apologize. The first input array was AI agents, then OpenAI, and then Hugging Face, right?

There were no errors in this; everything worked correctly, and this is how you can have different data sets input into a crew without having to do your own while true or any looping or anything like that.

Okay, this is a great way to show how the kickoff for each works. Absolutely amazing stuff!

Okay, great job! We just completed our first project, and there was a lot of things going on in there, especially using tools.

Now, I can't emphasize really enough how powerful tools can be to help us accomplish what we want, especially if there's an API. I mean, there are so many APIs out there, right?

Well, an agent just doesn't, by default, know how to use it. So we can create a custom tool that can connect that agent to the API to perform some action.

Well, now we're going to move on to the next section, and this was an important feature that was released not long ago called flows. I think flows are really important and a really powerful feature.

By first understanding this, let me explain it to you. Well, let's go over what a flow is. A flow allows you to create structured event-driven workflows. It provides a seamless way to connect multiple tasks, manage state, and control the flow of execution in your applications.

Okay, so we're about to go over a code example in just a minute, but a couple of the key things here is that it has state management, which you'll see. It does allow for a lot more flexibility than just creating a single crew because in a flow, you can execute multiple crews, and not even at the same time because flow is created based around Python functions.

It's not created around crews, but inside those Python functions, you can execute a crew.

Let's see how a flow looks. Okay, I have a simple flow here, and I know this is probably going to be new, especially if you haven't seen this before.

But there's a couple of things happening. I will get to this poem state in a minute. What you need to do in a flow is, first off, you create a class. So I created a class called PoemFlow. I added a flow object, so up here you import the new flow class.

You add that in here as a parameter to the class, and then inside of here, I have the poem state. Now my poem state is also just another class, as you can see, with two properties: sentence count and poem. You add that in here as a list of the flow class.

Okay, so to recap, we first off have a class. We give it a flow class as a parameter, and then inside that, we give it the poem state.

Now the next thing you're going to notice is, like I mentioned, these are just Python functions, right? There's actually three of them within this class.

Okay, we have—we start with the generate sentence count, generate poem, and then save poem. Now this doesn't mean that they have to be executed in this order, but what we now need to realize is there are some decorators that are important to how flows actually work.

So this @start decorator means that this function, when we kick off this flow, just like you would kick off a crew, when we kick off this flow, it's going to start at this generate sentence count.

It's going to print this out, and then it's going to save a random number between 1 and 5 to the state sentence count up here.

Okay, so it's going to give that a random number. Then we have the next important decorator you need to know is the @listen.

What that means is that this @listen—well, we first off have a generate poem, right? So it basically generates a poem, and inside of here, we kick off a crew.

So in—well, this @listen decorator, it says @listen generate sentence count. So whenever this function, because this is where the whole thing starts based off the decorator, whenever this function is complete, whenever the logic inside of here, whenever that's done, the output, if there is any, is going to be sent to this function.

Whenever listening to that, this generate sentence count to be done, it then starts.

So then it's going to print generating a poem, print out the state before the poem, and then it's going to kick off the crew.

This is what I meant; you can kick off crews inside of the flows whenever you want. You can have multiple crews.

Now this is just one, so this is actually a whole crew. So on the left-hand side here, if we look at the poem crew, we have a whole poem crew with an agent, a task, and you know we create the crew, right?

It has its own configuration and everything, so that's all contained within a crew.

Then we're just going to simply kick that off, and then we're going to simply kick that off inside this generate poem Python function.

So then we get the result of that, then we save that result in the state.

Now you can see here we say self.state, self.state.sentence_count, and self.state.poem. Well, when you say self.state, it knows that the structured state is going to be inside this poem state class with these properties.

So we don't have to say self.poem_state.sentence_count or self.poem_state.poem; it just knows that it's referring to this.

Then we have another print statement, and then we have this last Python function called save poem. It has the @listen decorator, which means that whenever the generate poem function is done, which is the second function in this flow, whenever that's done, it's going to take the output, if there is any, give it to the save poem function, and then it's going to do all the logic inside of it.

However, this time, we're just writing to a file, and we're going to write self.state.poem.

So we're going to write the state for the poem. This was saved, or this was added to the state in the second function, but now we're going to retrieve that in the third function.

This means that state is accessible throughout the whole flow, just within the flow. But without the—throughout the whole flow, state can be updated, it can be modified, it can be read, whatever, or created, actually.

It can also be created as well, and it can be just accessed anywhere within the flow.

So it's going to save the whole poem to poem.txt, and then this is going to be pretty similar to what we used with the kickoff, right?

So down here, add this main. So whenever we run this main Python file, it'll run this function. It'll come up here; it will call async do run, run the run flow function, which is then right here.

So we instantiate the poem flow object, and then we kick off that flow.

All right, so once that is done, it's going to create this poem. I already have an example here, so we can look at it, and this is the poem, right?

It's kind of cut off here, but this is the simple poem that it created.

Also, what you can do to see how this looks like, this is how this physically looks, is you can run a poem flow.plot function.

So you create the poem flow object, then you run the plot function, and it creates one right here.

So if I were to open this HTML file, open with live server, this is going to open up here. You can see this is the flow of what we just created.

We have a generate sentence count, and there is a diagram or legend at the bottom here.

So this means that this is the start method when it's in orange, and then we went to the second Python function, which was called generate poem.

Inside of here, we had a crew, and you can see that in the legend that means that this is a crew.

Then finally, the third one was just a regular Python function; there were no calls to APIs or anything.

But that's not all; there's actually more that we can do with flows, and then we're going to create our own flow, and we'll do more things with that, like creating our custom tool, like I had mentioned.

Now with the flow control, there is some conditional logic that you can have as well.

So this @listen here, like I briefly mentioned, that just because these Python functions are in this order doesn't mean that's the order that they have to be run.

It's not necessarily sequential like you would see in a crew with the agents.

So the first conditional logic is this or function. You know, or means you can do one thing or the other.

So in this listen method here, we had listen and then or underscore, and then it has the start method and second method.

Again, these are the names of these other two methods. So what this means is this logger is going to execute when either the start method or the second method are complete.

Whenever the start method is done, which all it does is return "Hello from start method," it's going to then execute this logger function.

Then the second method will execute, and there's also an and function, which is similar, but it has to be done when one thing and the other thing are complete.

So this @listen has the and/or logic, then we give it the start method and second method again.

So once the start method and the second method are complete, then this logger Python function will execute.

So how do we create flows? Well, this is very similar to how we created a crew. There is one line I will never recommend again: manually creating all these files.

You can if you want to just to get the appreciation for the command line tools, but all you have to do is say `crew AI create flow` and then the name of your flow, and then it creates the folder structure here.

So it already has the flow and a single crew created for you with all the configuration, everything that you need, right?

In the documentation, it just kind of goes over what I already did, but you can also add additional crews.

You can say `crew AI flow add-crew` and then the crew name, and this will create another crew for you in your flow.

Now with that understanding, and that's a lot to take in, I totally understand. I kind of went over as much as I could to just kind of give you the overview of exactly what a flow is.

Well, the way I love to do things is now let's start coding one. So let's create our own flow.

I just want to get you used to understanding the flow and then executing it. So the first thing we're going to do in your command line, again, I'm just in the Master Crew AI Course folder, so I'm going to say `crew AI create flow`, and then we can just give this flow any name.

So we're going to say PoemFlow. As you can see, that was pretty quick. That took like maybe 10 seconds, I think.

So now we have this new directory called PoemFlow. If we open it up, we can go to the source file. We have another main Python file, and in here we have the poem state.

We have the PoemFlow class, which is how we start off or actually kick off the whole flow. We have the start method, which is going to generate a sentence count between a random number of 1 to 5.

Then we have two listen decorators where we're going to generate the poem and then save that poem locally.

Then it created a crews folder, and inside of here, we have the poem crew that gets executed.

So we have the poem writer, we have the write poem task, and then the crew that's going to take care of executing all of these together.

I mean, this is simple, but we're going to get a little bit more in-depth on the next project.

Then we have the configuration, so it creates the agents YAML file and the task YAML file. It assigns this task to the poem writer, and we have custom tools here, which I didn't really talk about yet because we are going to be creating our custom tool.

But in this instance, it just gives you a way to actually create your own custom tool. I'll get more into this on the very next project where we will be creating our own custom tool.

But this is how it's created; this is kind of the structure of the flow when you initially create it.

In the .env file, we do have to give our OpenAI key just like we did previously, so I just copied over the model and the OpenAI key.

Okay, one more thing before we get started is there's one—couple just fixes real quick inside the main Python file here where we have the PoemFlow.

Get rid of there will be a dot here; just get rid of that. And then make sure from env import load_env and then call the function, then save that.

I am inside the PoemFlow directory, so while I'm here, all I have to do is say `python source PoemFlow main.py`.

Once you execute this, this probably won't take too long because it's a simple flow, but it's generating the sentence count, which was at the start method here, right?

So it's printing out the generate sentence count. Then it's going to generate the poem, so we have the print statement to make sure it's running.

So it's generating the sentence poem. Now it's making sure we have the OpenAI key, so then it says poem generated, and then it gives out the actual state of the poem.

Then it goes to the next listener, which is generate poem because the generate poem function is done. Now we want to save the poem, and down here it's saying saving poem, which is the print statement from the third function, and then it writes it to a file.

So we had the poem.txt, and this is the poem it created.

Okay, great job! You just created your first flow. You created it, and you're actually able to execute it. Just make sure you fix those two little mistakes, and this is how it's going to run for you.

Okay, you've been doing wonderful so far, and I'm really proud of you. The next thing that I really want to cover is custom tooling. This is a really important topic.

Well, I think it's one of the most important topics because being able to create your own tools to do what you want to help the agent out is, I think, something that's priceless.

We're going to be using it in the next project, which means I need to teach it to you first.

We will be covering something else that I think is also important, and that is agent observability, but we'll get to that after we create our big project.

Well, why custom tools? The reason for custom tools is that not all tools are available that can support what we need to do.

This is why Crew AI enables us to create custom tools. So in our next project, for instance, we will create a custom tool to create draft emails for your Gmail account.

There's just no way by default that an agent knows how to do that. But first, we need to know actually how to create it.

In Crew AI, what they have is something called a base tool. What this means is that's going to wrap our tool in a way that the agent can digest it and use it with AI.

So we're going to create a class called MyCustomTool. It needs two things: the name and the description. These are going to define the tool, and then we have a single function, this underscore run function, needs to be there because this is what Crew AI is going to actually execute in the background.

Then you'll have all the logic inside of this, and whatever that returns is what that will be given back from the agent or the tool output.

Okay, now it's time to move on to our second project, and this is going to be called Meeting Minutes.

What we're doing in this project is we're going to create a flow, we're going to create a custom tool, we're going to create a crew, we are actually going to use different models, and we're going to integrate with Gmail.

This is going to be the biggest project that we've done yet, as I had mentioned, but we're going to code everything together. I'm going to show you every step along the way, and by the end, we will have this cohesive crew—the biggest crew that maybe you've created so far.

But you're going to really learn a lot from this session. Let's get to coding!

Okay, so we're going to go ahead and begin creating this project as this is going to be a fair amount of coding. But there will be steps along the way where I'm just going to paste the code because it may not be necessarily related, and it's just something based on a tool or whatever that may be.

But I will go through and explain it, and as always, you can get it from my GitHub as you're moving along and copy that as well.

But I'll let you know when we get there. The first thing is we need to create a flow. So we're going to say `crew AI create flow`, and then we can name this whatever you want, but I will name this Meeting Minutes.

Okay, that is successful. I'm going to minimize this now, and on the project pane, you can see it created a Meeting Minutes flow.

Now there's quite a few things we need to do. Let's look at the main Python file first. By default, it just creates this poem state, so we're going to go ahead and remove some of these things, and we are going to start creating this Meeting Minutes model.

So the one thing that we see here is that in the PoemFlow, again, we pass in the flow, and we pass in a state called PoemState.

So let's first start just kind of renaming some things. So we'll say MeetingMinutesFlow, and then we can go ahead and rename this MeetingMinutesState.

Now a couple of things we'll need here is instead of a sentence count, we will have a transcript as a string.

Then also, I want the Meeting Minutes summary, which will be at the end when we go to send the email. We'll just use this state that will at this point have the whole summary of what we'll see soon, and then we can just pass this into the email to send it.

So we'll say MeetingMinutes. Well, actually, we just call it MeetingMinutes; that's fine.

Then we can actually delete these two things, and we can keep—we can keep this first start. We can delete this as well.

We will go ahead and—as you can see in the kickoff, it is going to modify that for me. Of course, I'm using Cursor, so it's going to recognize some things that it knows it doesn't need, and it will autofill some of this Crew AI stuff because we used it in a couple of the projects already in this course.

So we don't need that, and we're going to rename this generate sentence count, which is this is going where we start the flows. This is the first thing that's going to happen, and the first thing we want to do is actually generate or get the transcript from a WAV file.

So whenever you get from Zoom, you finished a Zoom call, and you have it saved, it saves in a certain folder on your machine.

Well, we're going to pretend that we had that WAV file within our project, so I'm going to give you a sample WAV file.

So we're going to name this first method transcribe meeting and then generating transcription.

We can get rid of some of these print statements at the end, but what's so going to be different about this is we don't actually need to call anything related to Crew AI here.

We're just transcribing something, which does mean we need to use a speech-to-text model, and we can just use an OpenAI call.

If we go to platform.openai, you can search for a bunch of different code examples, and one here is speech-to-text.

What I'm essentially going to do is just copy this, so I'm going to copy this transcribe audio. I'm going to paste that within this function, and here we go. We have a sample transcription right here, and we're going to be using their Whisper 1 model.

Okay, but what's actually going to happen here is we need to give—you can—it can also be a WAV file; it doesn't have to be an MP3.

So we're going to actually use a WAV file, so we're going to search for the WAV file, and then it's going to create or make an OpenAI call using their Whisper 1 model and then give us the text back from the speech or the MP3 WAV file.

Now let's go ahead and clean this up a little bit. I'm going to move these imports up here, and then also, what actually—before that, we are going to need to bring in the—we're going to bring in the .env file.

So from env import load_env and then execute that function.

Okay, so now the API key will be in this OpenAI object. Now one problem with this is that if the audio file is too long, the Whisper model only has so much context length, right?

You actually get an error, and I know in this specific example, it's about a 3-minute audio file; it can't transcribe the whole thing, right?

So what we have to do is we have to kind of chunk it out. What I'm going to do is, depending on—doesn't matter what the size is, I'm going to chunk it out so that every 60 seconds of the audio, we're going to then send that to transcribe until we're going to keep looping until that's done, and then we're going to concatenate all those together into a transcription.

Okay, so I just had this earnings call.wav, which again would be my GitHub that you can download, and I went ahead and just copied the code here instead of just writing this all out and trying to explain it.

It'd be easier if you just copy this, and then I can explain it as we go.

So what's happening is we are getting the file path for that WAV file. We're using a library called Pydub, which we'll have to install in a minute, and it's basically taking that audio from the WAV file, and it's going to chunk it into 60 seconds or 1 minute each.

Then we're going to enumerate or iterate over each of those chunks of at most 60 seconds, and then we're sending what we just copied from OpenAI.

We're sending that to the Whisper 1 model to transcribe for us, and then, you know, there's a full transcription.

There's a full transcription variable that's going to take each time we do that; it's going to concatenate it or append it.

It's actually not concatenate; it's going to append it to the end of what's already there in that text. So that by the end of this, we have a full transcription, and then what I'm doing here is saving this to the transcript state of the Meeting Minutes state up here.

Okay, and like I said, like I mentioned before in the previous project, all you have to do is call self.state and then the property of that Meeting Minutes state class.

So here I'm just calling the transcript.

Okay, so now we need what we need to do now is actually install the proper libraries to make this work.

If you want to, in the beginning, I'll have a requirements.txt, so you can just install that, which has the instructions to do that in my GitHub.

But let's go ahead and do here, so we can say `pip install pydub`.

Now I already have it installed, but we need to actually import that now. So you can say `from pydub import AudioSegment`, and then we also need to pass in the make_chunks, and then we also need the path.

So from pathlib import Path, and this will get rid of all of those errors that we have.

Right before we do that, there is a .env file. Make sure that you paste your OpenAI key in here and the model, or you could just move this .env to the whole project level, and we can always use the same things.

But you can have it per folder or per mini project so that you can maybe update this and change it for that little project.

But either way, however we do that, you just need to make sure that that .env file has your OpenAI key and the model you want to use.

Now that everything is set up, let's make sure we test out this first before we move on.

So make sure you're in the Meeting Minutes folder, and then we're going to say `python source MeetingMinutes main.py`.

You can always hit tab to help fill this out, and then I'm going to go ahead and hit enter.

What should start out is say it should print out this generating transcription because this start decorator means that we're going to start out by executing this transcribe meeting function.

What we can see here is saying transcribing chunk one of three. Again, this is 60,000 milliseconds, so that's 60 seconds, and it's going to make however many chunks that means.

So the earnings call.wav is 2 minutes and 55 seconds long, which means that there are going to be three chunks, right?

Then it comes down here and tries to transcribe each of those chunks, and each time it's transcribing the chunk, it's calling the OpenAI model for Whisper 1 to give us the text of that.

Then when we save that into the state, I'm just going to print out that state, and that should be the whole text of the whole WAV file.

So this is about to be done, and here you go. Here is the transcription.

So good afternoon, everyone, and welcome to FinTech. I do know that's how it starts, and this is correct.

So we had the first part done where we actually get the transcription from the Zoom call.

Now the next thing is we need to actually create the crew, and what I can actually do here is just kind of minimize this so it's not all this code everywhere.

So we're going to create the Meeting Minutes, which means there's a few things the crew are going to do.

It's going to have the summary, the meeting minutes, and if there's any action items that are needed, and we're going to create that before we send it off to the email.

So how do we do this? Well, we need to add a listen decorator onto this transcribe meeting.

So whenever we're done transcribing it, then we can pass that transcription off to the crew because it'll also be saved up here in the state.

So we're going to say @listen, and you know it's already kind of started this with Cursor, but this @listen, we're listening to this transcribed meeting function to be done.

If you see this in quotes, that works as well. There are a couple of different ways to do that, but we're going to create a Python function called generate meeting minutes.

Then I'm going to start out printing that we're generating this.

Well, what we're going to do is actually kick off the crew, and as of right now, we have up in the project folder up here, it created the poem crew by default.

That is this right here, so we going to modify this, and you can see Cursor is already telling me what we need to modify it to.

But we need to modify this; we need to add some agents, add some tasks, and also we need to modify the agents YAML file and the task YAML file, which again give all the configuration for each of the agents and the task.

So let's go and start doing that. So we can change the name of the crew first. We'll have to modify some imports as well.

Okay, so we can go ahead and call this first one. Let's call it Meeting Minutes Summary Summarizer. That's perfect!

Okay, and then once you do that, we also need to change the config to—we'll modify the config to get it from here.

Then we need to—what I'm going to do is have a writer, so we're going to create another agent, which you can also kind of copy this.

This is going to be the Meeting Minutes Writer, so we're going to take this. This is going to have a bunch of different things that's going to take from the transcription.

Then we want the writer to kind of make that and format it and make it look nicer before we send it off in an email.

Okay, so we have now we have two agents. We create another agent, and now we need to create both of the tasks for these.

Okay, so we can change this to say Meeting Minutes Summary Task. We can modify that, and then, you know, it's already giving me the next task—Meeting Minutes Writing Task, which is perfect.

Okay, and then once you have—we have two agents and two tasks. Now these don't need to be the same number, right?

You could have one task; I could have five tasks and still only have two agents. You can assign multiple tasks to an agent, just to clarify.

I don't want you to think that because I have two agents, I need to have two tasks. I could actually add more tasks here, and I could have one agent perform multiple tasks.

But then again, with the crew, we don't need to—you never need to modify this anymore because this is always going to check for the decorators of the agents, and this is going to check for any functions with the decorator of task and go ahead and put that here in a list.

So we don't need to change that. We're going to keep the sequential, and then I want to set verbose to true so that you can see what's happening.

Okay, the next thing we need to do is update the configuration for the agents and tasks.

What I'm going to do instead of just you watching me type these out, I will have these in my GitHub. I'm going to show you what they are here and go over them.

So let's do that now. Now what we do is go into the crews, the poem crew. We can actually go ahead and rename this, right?

So first off, we're going to the source Meeting Minutes, and then crews because we are going to have another crew here.

We're going to rename this to poem crew, so you can just right-click that, rename, and we're going to rename this to Meeting Minutes Crew.

Then we can rename the Python file that we just modified to Meeting Minutes Crew.

Okay, now go to the configuration, and we have the agents in the task YAML file.

So for the agents, we now have the Meeting Minutes Summarizer with the role, goal, and backstory.

We can go over this, but what I really want to go over right here is this agent is going to do three different things.

So we're going to summarize the transcript, write it to a file, then we're going to extract the action items from the transcript and write that to a file.

Then we're going to basically have a sentiment analysis, which means we're going to see what the language of it is like, kind of the emotions of it, and then also write that to a file as well.

We give it a backstory, and then for the Meeting Minutes Writer, it's basically going to take all of those things from those files and then put them together.

Okay, that's just really what it's going to do and put them, like, kind of make it look nicer.

Then for the task, we have the first task for the first agent. So, you know, I want to summarize the—I want to summarize the transcript, write the summary to summary.txt.

I want to write the action items to a file called action items.txt in this Meeting Minutes directory, which this will all be provided by the tool.

All right, and then I want the action items to be in the following format, which, you know, you can come in here and change this however you would like.

Then I want, again, I want to analyze the sentiment of the meeting transcript and write to a file called sentiment.txt.

The reason I do this is we will be using tools for this agent as well, the file writer tool.

But if you kind of give it some—what I noticed is that it works almost 100% of the time if, in the prompt, you kind of help it again by saying use the tool and make sure it's in this directory or wherever you would like to put it.

So then we have the expected output. Oh, I forgot to change that. I forgot to change that agent.

So we now want to assign this to the Meeting Minutes Summarizer agent.

Then we had the Meeting Minutes Writer task. You know, it's supposed to take down everything from those summary action items and sentiment and put them into a nice markdown document.

There are some things here, right? Like I wanted to use today's date for the meeting date, and I want to use my company name, use my name for the name of the organizer, and create some random list of attendees.

Then the location was Zoom. Okay, so my expected output is just a document, and then the agent—this is tied to the Meeting Minutes Writer agent.

Okay, well, now that we have the agents and the task figured out, if you notice in the task, you know, I mentioned, or in the agents, I mentioned that we need to save—we want to save files from each of the summary action items and the sentiment into a file.

Well, I can tell to do this, but just by itself, it's not going to execute code to do that.

So how do we take care of that? Well, back in the crew for this agent, we need to give it the tools to do that.

Crew AI, like I had mentioned before we started this, has their own set of tools, and we're going to go ahead and import that.

So you're going to say `from crew aai.tools import FileWriterTool`.

Now we can do a couple of things here. I want to make sure that these are going to the correct folder and make sure that they're a specific file name.

So we're going to instantiate three of them, one for each of the three things that we had mentioned in the agents and task configuration.

So I'll say `file_writer_tool_summary = FileWriterTool()`, and then we can have the same thing for the action items and the sentiment.

And then instead, though, I want the file names to be something specific, so I'm going to say `file_name = summary.txt`, and then I'll finish out the rest.

So we are instantiating the file writer tool three times, and that's okay, right? An agent can have multiple tools, even if it's multiple of the same tool.

So we are going to add all three of these tools that come from Crew AI into our agent.

If you're curious how I knew this was file name and directory, you

If you actually go into the file writer tool, you can see that in this input here, which is kind of the arguments for the tool, it's going to look for a file name, directory, overwrite, and content.

Well, the file name is what we gave it, and the directory we also provided. The overwrite is set to false, and then the content will be added through the AI. It will take the content and add this in here as well.

So when it goes to actually run this, it's going to take all the arguments and fill in the content. Now we just need to add it to the agent. You just add another property. Actually, it already knows what I want to do, so it says tools equal to, and then you're just going to add in each of the three tools.

Okay, great! Now that we finished with that, we need to go back to the main Python file. As you can see here, we have this method we just created before that we need to call this crew to kick them off.

So we can say crew equals meeting minutes crew. We haven't imported that yet, so we can actually go ahead and do that now. We can go and import this now. We'll say from cruise.meeting_minutes_crew import the actual class meeting_minutes_crew.

This basically means that we're here in the main file, going to Crews, then meeting minutes crew, and then the file called meeting minutes crew, then import the class from here. I know that can be kind of a tongue twister and a little bit crazy to read, but this is how we do it.

So we're importing this crew, we're instantiating the crew now, and then we can say meeting minutes is equal to crew.crew the function.kickoff.

Okay, now we are not quite here yet, right? This is going to work; this is going to kick it off. However, it doesn't have any reference for the transcript.

Now remember how we do this in the previous project? We actually have to give it inputs. So we'll say inputs is equal to, and then you can say transcript. This is like a dictionary, right? So we're going to assign to the transcript the actual transcript from above.

Remember we saved the transcript from the transcribe meeting function into this state. So for this input, we are going to call that state and then we're going to pass this into the kickoff.

Then we want to save the result of this into the meeting minutes state up here. So we have this meeting minute state, which is still an empty string. We want to save the output of this there, and this is how we do it.

You just say self.state.meeting_minutes is equal to the meeting minutes. Okay, and then we are done with this crew. But I do want to check to make sure this works.

Say make sure you saved all the files, and we're going to run this again. I'm going to raise this up a little bit so what you can see is we went ahead and did the same transcription. There are ways to optimize this so you can make sure it doesn't happen again, but I'm not worried about that right now.

So then it starts to generate the meeting minutes. You know, it's just kind of checking that I have the open API key, so don't worry about that.

So make sure it mapped it correctly. We had the first agent, which is the crew AI meeting minute summarizer. This is the task that we asked it to do. It's going to use the tool.

So the first tool is to use the file writer tool, and as you can see, the tool input we had the file name that we gave it, the directory, the overwrite, and then this is the content that it got from the transcription.

So this is just a simple summary and successfully saved that to this directory, which we'll look at in a minute. Then it did it again, another file writer tool for the action items, and then finally did it for the sentiment.

All right, so it was able to actually write everything successfully here, and then we have the summarizer. Right? So this is the summary.

So it's taken the summary, the action items, and the sentiment analysis that we had, and then it's going to write them. So it's going to write them into, as you can see here, it's going to take all that and make it look nicer.

So it's filling in all the information that we had, right? So all the attendees, these are the minutes, these are the financial summary overview, the sentiment, action items, and so forth. That's exactly what we wanted.

So this is going to be the output that we saved to the meeting minutes state. Now, if we go into the actual meeting minutes directory that it created, you can see, let me minimize this, that we have the action items, the sentiment, and the summary.

Okay, awesome! So what this means now is that we transcribed an audio file, we created action items, sentiment, and summary for it. The output of that was what we just saw here.

So it's able to make it look nice. This is really setting it up for an email, and we're going to create a draft email next, which means we're going to create another crew. But I had to explain to you how the Gmail API works.

Okay, so once you go to console.googlecloud.com, make sure you're at console.cloud.google.com. I'll give you the link here. Make sure that you have your correct email address that you want to use.

So it says I'm working in my master crew AI course, so I created this just for here. How I did this in the top left here, if you're just doing this, you won't have any projects. You'll click the drop-down and create a new project, or you may have a button to create a new project if you don't have one.

But either way, just create a new project. So I created a new one called Master Crew AI Course. Then we need to enable the Gmail API.

So click this quick access here for API Services. I do not have Gmail yet, so I'm going to click this enable API Services button at the top in the middle here. I'm going to search for Gmail, choose Gmail API.

There are two; just choose the first one for actually managing your Gmail inbox. Then you click this enable button.

Okay, awesome! Now it's saying that to use this API, you may need credentials, which we absolutely do. In order to do that, go to the OAuth consent screen here. It's on the top on the left.

We have to fill out, we have to kind of like create an app. So you can choose between internal or external. For me, I can only choose external, which is fine.

So I'm going to choose create for app information. I'll just say Master Crew AI Course so you guys know this is exactly what it's for. For the user support email, I'm just going to choose my email.

You don't need an app logo or an app domain. You actually don't need any authorized domains, but for developer contact information, we do need to re-input our Gmail address.

So I'm going to hit save and continue. Okay, what you see on the screen is that we don't have any scopes.

And what a scope is, it just means that this is what our credentials, when we create them and download them, this is what we're able to use, such as composing emails, removing emails, managing the whole inbox, and everything.

So click that, and on the right-hand side, these are the scopes for enabled API. So we're going to type in Gmail, and what we can see here is all of the scopes that we are allowed.

Right? So you could just basically have it do everything. You can have it read, compose, send, and permanently delete all email, recompose, and send emails.

Right? These are just all things that you want to allow this API that you're going to use to do. So I just want to click the one that says manage drafts and emails.

So then once you click that one, all we're doing is creating drafts. So manage drafts and send emails. So we're going to click update.

As you can see, we now have this Gmail scope, so click save and continue. Test users, you can add a user. I don't think this matters, but I always put my Gmail address in here just to make sure.

And then once you add that, click save and continue. And for the summary, we are done. Just go back to the dashboard.

Okay, now we're done with that. Then go to credentials, and we need to create an OAuth client ID credential.

So we're going to, at the top here, click create credentials, go to OAuth client ID. The application type, choose desktop app. It doesn't matter what you name this, Master Crew AI Course, and then click create.

Okay, awesome! So you'll get this screen here where it says it's created. So you have a client ID and a client secret.

So what you're going to do is click the download JSON. It is going to download a JSON here. So I'm going to open up this folder, and I'm going to rename this to credentials.json.

And then we're going to do something with this in a few minutes. Now that we have everything set up on the Gmail side, we actually need to create the Gmail crew that is going to use this.

Okay, great job so far! The last thing we're going to do is we need to create a Gmail crew that is going to create the draft from the meeting minutes that we have created.

So we need to create one more listen. So we're going to say add listen. This is going to be waiting for the generate meeting minutes, and this is going to be called create draft meeting minutes.

Okay, so we're going to create the draft meeting minutes in my email address or your email address. Now we want to create another crew, and there's a simple way to do this.

If you go to the crew AI documentation under the flows core concept section, you can scroll all the way down here, well almost all the way. Somewhere here, what we can do is just add another crew to the flow without creating a crew separately and then kind of moving it.

So here, adding additional crews using a CLI. So we're going to create another crew, but we're going to add it to the flow we already have.

So I'm going to copy this, come back here in our terminal, and I'm going to copy that. But of course, you want the crew name to be different.

So I'm going to say Gmail crew, hit enter, and this is going to create, it should create another Gmail crew inside of this crew's folder. And I believe it did.

So if we now drop down this crew, yeah, look, we have a Gmail crew folder with a configuration and a Gmail crew.

Now, if we take a look at this Gmail crew, we can get rid of this. Let me minimize this a little bit. We know it does the same thing.

It creates the same researcher, reporting analyst, and so forth. So we're going to go ahead and modify this crew now.

In this case, we only need really one agent, one task. We need one agent, which is going to use a custom tool that we are also going to create that allows us to create the draft email.

So we're going to name this one Gmail draft agent. We can keep kind of the rest of that the same. I do not need this agent. I also don't need this second task, but this is going to be the Gmail draft task.

Perfect! We don't really need to change anything else. We will need to add the custom tool, which we will create here soon.

I just want to get everything else set up, and then let's go ahead and look at the agents in the task emo file. I went ahead and just saved it.

This is really simple, right? There's really nothing to this except just know that I have this body here. So we're going to be taking the summary from the previous run and add that into here.

So the Gmail draft agent will have the body to send in the email. So then in the task, same thing. This is really simple.

Okay, these are not crazy, although I need to change this agent to Gmail draft agent.

Okay, so now back to the Gmail crew. What we need to do next is actually create this custom tool and make sure that our credentials work and everything whenever we go to create the draft email.

So how are we going to do this? Well, we're going to right-click the Gmail crew and create a new folder called tools.

And then inside of here, we're going to create the Gmail tool.py, and then I'm going to go ahead and create another file called Gmail utility.py.

Okay, and the reason I named that is not the correct spelling. Okay, so the reason I have two separate things is, you know, to set up the Gmail, you have to have the authentication and make sure there's credential, and it kind of, you have to set up kind of the email before we create the draft and then execute the function for the Gmail API.

Okay, and I kind of like to separate those things out because in the Gmail tool, we will just have a simple custom tool here.

All right, so let's go ahead and get started with that. And actually, what I'm going to do in the meeting minutes, or not the meeting minutes crew, but just the tools here that kind of came with the flow, I'm going to go ahead and copy this and go back to the Gmail tool and paste this.

Because again, this is what a sample looks like for a custom tool. We need to have everything we need. We have my custom tool input and the actual my custom tool.

And this input will be the arguments that we're going to be giving from getting from the AI to input here. We'll go over this.

So I'm going to change a couple of things here. We have the Gmail input. We just have one parameter here, and that's the body, right?

And then for the description, this is the body of the email to send. So the AI is going to see this argument and say, "Okay, what we get from the previous function, I'm going to input here."

And this is what this args schema here is in the actual tool, right? And then in here, we're going to need to give this a Gmail input and this defined underscore run function.

As I mentioned when we went over custom tooling, this is what actually gets executed. So the logic has to be in here to actually execute the create draft API.

Now, what I'm going to do is copy the code that I already have for the Gmail utility, and then I'll go over that with you.

All right, so I know there's a lot going on right here, and I will go over this. There are some imports that I will have you have to have, you know, Google OAuth.

It's just the Google API stuff and the OAuth stuff that we have to pip install, which I will have that for you already in the requirements.txt.

But once you have that installed, we need to kind of import all of that, and we have the scopes here, right? This is the scope that we allowed for this API.

So we're going to have this scope here so that the only way, only thing that gets executed here, even if we tried to create a label, it will not happen because it's not a part of the scope of this API or of these credentials that we have.

I have an HTML template. This is a string, and what I'm going to be doing is inserting the body here.

So we're going to actually send, instead of just having plain text in the email body, I want it to be like a full-on HTML so it's formatted right.

So I have a couple functions here. I have the authenticate Gmail function. So what this is basically looking for is token.json and then the credentials.json file.

So let's go ahead and first put our credentials.json into our tools folder. So I'm just going to move that over here, and great! Now we have that.

Now I'm going to say, first off, we're saying the credentials is equal to none. So it's looking to see if there's a token.json, which this is used for refreshing tokens.

Okay, it's created after we actually do this for the first time, so it's okay if it's not there. It won't be the first time use it.

So if there are no creds, which initially there are not, and this is not valid, okay, which it won't be, it's going to try and refresh the token.

But if the credentials path doesn't exist, it basically means this credentials.json doesn't exist, then we have an error, right?

And then we have a couple of these lines right here, right? This doesn't look like anything crazy, but this tries to get your secrets, like your client and your secret from the credentials, and then it kind of verifies that they are correct.

And then if they are, it creates the token from the credentials. It creates a token token.json file or by converting it to a JSON file, and it'll create another token.json file here for you.

So it's basically just making sure we have the credentials, and once we do, then it can successfully write and create that tokens.json.

Okay, this is now returning. This service is actually how we're building the credentials and the API to do something.

Now, the next thing that we do is we have a function for creating the message. Okay, so we have a couple, a few parameters in here.

Now, the problem is I had a pretty hard time, well, not say hard time, but it took me a while to kind of format everything into an HTML until I figured out the one library that made all this easier, and that was the markdown library.

Because I had the second part of the flow formats everything into markdown, so I need to convert that. So what I've done is I convert that markdown into HTML.

That's what this does; it converts the markdown to HTML, and then in the HTML template, the final email body is going to be equal to that now converted HTML.

So back up here in the HTML, we see the final email body. We'll be inserting this HTML now into here under the body tag.

Okay, now coming back down, we're creating the email message. We're getting, you know, basically having the contacts to, from the subject, and all of that.

We just have to encode that, right? So then we're returning that encoded message. Then I have a create draft. This is actually calling the API, and this is how it works.

We say service, this is from the Gmail API instance that we created above, say users.draft.create, and then we're going to give it that message body to execute.

So it's going to create that draft with that full HTML with the body, the summarization, and all that that we get, right?

This is just a simple print statement to kind of, you know, make sure something, make sure it worked properly. If it got here, then it probably worked.

I know this was a lot, okay, especially the first time looking at the API, and I know this isn't the best, probably the best code for it, but this is kind of everything that you need to know to get it to work.

So if I were you, I would just copy this from my GitHub. Now, back at the Gmail tool, we need to set this up to actually use that.

So let's go and code this. We need to import all of those functions from the Gmail utility. So create draft email, I believe that's what it was called, right?

So we have authenticate Gmail, create message, and then create draft. Okay, I don't know why this says create message, create draft.

Okay, so those are the correct ones. And now under, we need to modify the logic here within this run function.

So what we can say is service is equal to authenticate Gmail, right? Because authenticate Gmail returns a service object, which is just kind of building the API.

Then what we need to do is I'm going to kind of hard code like the sender, the two, and all that. So the sender is going to be equal to, that's me, so Tyler Reed, youtubelearning@gmail.com.

Then the two is going to be a very old email of mine just for testing. And then subject is equal to meeting minutes.

And then I want the message text equal to the body. Okay, this is the parameter that is going to be given to us using the AI.

Next, we need to actually create the message. So we can say message, so this is going to be create the actual message to send or create the draft with.

Then we can say draft equals create draft, and you can see the user ID is me, right? You're expecting, wait, isn't there like, this is a weird ID?

But if you say me as the user ID, then it knows that I am going to be the user, right? My authenticated self is going to be the user, so you can just put me there.

And I actually want to wrap all of this in a try statement, right? So I want to do all this and then instead and say email sent successfully.

And there's an exception if not, there we go. That's what I want. Make sure that I actually return something if it was successful.

Okay, perfect! This is what I want. Okay, so now we've created a custom tool to be used by the agent.

Now let's go ahead and add that to the agent. So let's go to our Gmail crew. We need to import this.

So from tools.Gmail import the Gmail tool, and then we can uncomment this as a shortcut. It's either control or, well, for me, it's command slash, command forward.

Need that comma there, and we're going to add the Gmail tool as part of this agent.

Okay, we are close to being done. We are very close to being done. Now, back in the main Python file, we need to flesh out this last function.

So we need to import from crews.Gmail crew import Gmail crew. You can always click on this and make sure that that is correct.

I think, oh, it's asking for that to be capital C, which actually want that to be, and which means that needs to be the capital C.

Okay, we come down here. Now we need to instantiate this crew. So we can say crew equals Gmail crew.

The inputs, you know, it knows we have, we're looking for a body as part of the inputs. So we can say actually draft crew, and we're going to crew.

So the Gmail crew.crew.kickoff and then add the inputs here, which is really just the body, which ends up being the whole summary of the meeting minutes.

And then just for clarification, I just want to print out the draft to make sure that we have something working properly.

And there's one more thing I want to show you with the flow. It's just a part, so it's another thing that we can look at the actual flow as a diagram, right?

So once we create the meeting minutes flow, you can say medium ASF flow.plot before the kickoff, and it'll create an HTML page for us.

Now, there are a couple ways you can test this just to make sure this works, right? You could comment out most of the logic, like you comment out all this stuff from each of these functions, and then just give it something in here.

You just give it something to make sure that the Gmail actually works, right? That is something that I would do instead of going through all this again.

Now, also what's going to happen is when you first go to use the credentials, it'll probably redirect you to a web page, which I will hopefully happen to me, and then it makes you want to authorize one time.

It's just one time, but go ahead and authorize it, and then it will continue the flow. It ran, and now it got to the point where I need to authenticate my email for the first time.

So click on your email, continue, continue. The flow has been completed. We can close this box. Perfect!

And it is saying that the email was successfully sent. So let's go through this real quick, and then I'll actually check.

Maybe I should have checked first before I actually get through this, but so generated the plot, which I will go over with you. It did that right here.

This is the HTML file. We did the same thing. It went through all the transcriptions, right? It created the summary, wrote the meeting minutes for the summary, action items, and the sentiment.

Came down here to the summarizer, so it went ahead and did that. So this is now the meeting, or sorry, went to the meeting minutes writer.

So it created the meeting minutes. So it has the sentiment, the action items, and then some overall summaries just like we wanted, right?

Now it's going to create the draft meeting minutes. We authenticated it, and this is going to send. This is the provided body.

So send the email with this provided body, and we went here.

Okay, this is the URL we went to, and this is the Gmail draft agent. It's using the Gmail tool for the body argument we passed in what we just saw above, and it's saying that the email was sent successfully.

Even though it should say draft was created successfully, but that's okay. Let's go, let's look at my email.

Well, first off, you can see I tested this a lot yesterday and this morning. So right now it is 9:47. This was sent at 9:45, so just 2 minutes ago.

And look at this, right? This is really awesome, right? It's from me to my other email, and because we changed that markdown to HTML format, look how pretty this is.

I mean, I know we can maybe do more with this, but you can, anytime that there is an MP3 file from some meeting that is created, you could just have it grab that and then go through this crew.

And look, it automatically creates a draft, and then you can send this out to whoever you want to, right? This is really saving a lot of time for writing notes and summaries of actually what happened in that meeting.

But this is awesome, and I'm really happy this worked. I know that was a lot, but you did great if you stuck around with me.

I hope something worked. Please, you know, leave me comments in the section in the comment section down below, or you know, you can send me an email, join my Discord, whatever it is.

Join my school community that I'll also have in the description, but let me know how things went for you, and I'm always here to help.

Now, the next thing we're going to go over is Agent Ops. And the reason we need Agent Ops or something like this, there's also like Link Trace and Arise, is because we need observability and monitoring for whenever we go to run these crews or any agents in general.

Not even just crew AI, but for any agents, it's good to know like what's happening, how much things cost, how many tokens were used, etc. Right?

There's so much that we can learn, and especially if something goes wrong, it would be nice to have an easier way to see or debug what happened.

Well, let me explain Agent Ops and then integrate it into our meeting minutes project.

Okay, so what is Agent Ops? Well, whenever you run any agents, whether it's a crew or they're using, well, any AI agent framework, a lot's going on under the hood, right?

You may have different LLM calls, different tools used, and you would like to know how many prompt tokens, how many completion tokens, what was the overall cost.

You know, if you had an error, instead of having to doom scroll through your terminal to find it, you know, there should be an easier way to do this.

Well, this is where Agent Ops comes in. They are one of the industry-leading developer platforms to test and debug AI agents, and I personally use them for a lot of my projects.

As you can see, they're already integrated with certain things like crew AI and Autogen that if you've been following me, you are well aware of on my channel.

For instance, they have a session replay here, so this was an error. It kind of gave the start and end time and how long maybe it took for the error to come about.

This was a web search tool that was used, how much it cost. Here is an action performed by an agent that was updated in the database and so forth.

So during different stages of, like in our instance, would be crew AI, during different agent executions and what tools they're using, we can see how much cost and kind of dive in and drill down what's happening.

And like I mentioned, they already have all these integrations, especially with these top frameworks, also like Lane Chain and Llama Index.

And here you can see for the research analyst agent that with GPT-4, it costs 59 cents for the prompt, 20 cents for the completion.

But with Anthropic, it only cost 5 cents for the tokens input and 23 cents for the completion. Now, they do have this pricing model, but I've only been using the basic, and I am fairly certain that's all you're going to need to use as well.

Now, to get started, you can just start here, click this button in the middle, the purple one that says start for free. You'll click this, you'll just sign up with whatever email address you have, and then you are ready to go.

And what you'll do next is see this little projects here, this little plus button inside your projects. You may not have any if this is your first time using it, but as you can see, I've been doing some testing with this.

But you click this plus button, you'll enter a new project. I have another one, say crew AI course, and then I'll choose my organization, which you'll create.

You know, it's easy, so you'll create your project. And then once you do that, it does say your API key is copied to the clipboard, and you will need this because it is different for each project.

You will need this in order to run Agent Ops on the code, which I'm going to show you in a minute.

Now, if I go and click this new create crew AI course dashboard, you know, you're greeted to the dashboard. There's nothing here yet because you haven't run anything that can be associated with this project.

That's what we need to do. But just to show you on the left-hand side, you can also go down to session drill down, and of course, there's nothing here yet.

But this is going to show you everything we need about the chat here. So let's go and integrate this with the meeting minutes project that we just created.

Okay, well, how do we do this? Well, first off, it is a package that we need to install, and again, this will be in my requirements whenever you get this, so you won't have to really worry about this.

But in case something happens, you need to type in pip install agent ops, and then it will install everything you need to do for this.

I already have it installed, so I'm going to clear this, and this is really simple. It's barely any code to make this happen.

So I'm going to import agent ops, import os. There are multiple ways you can do this, but I'm going to get the environment key this way.

So I'm going to import agent ops, and then this is the main class for the meeting minutes, right? This is where we kind of run everything, and then we also define the kickoff.

And this is where, you know, we're starting the whole flow where we take the weight file, and then we end up with a draft of what the action items were, what the summary was, and everything else.

That's what we already went over in our major project. So what we need to do now is, again, what it is, is a session with Agent Ops.

So we're going to say agent ops.initialize, give it the API key, which I will show you where to put that in a minute.

But this will just be in the ENV file, and this is going to, this initializes it, returns, see right here, it returns a session object, and that's important.

So we're going to return this session variable here, and then once this is before the meeting minutes flow, when we go to kick it off, right?

Then afterwards, we're going to say session.end session, that same session object, you're going to end it.

And then once this is done, this is going to give us the URL to go and see everything about the project that we just created and we ran.

What we need to do first is in your ENV file, you're going to give an Agent Ops API key, and you're going to paste that in here.

And then when we go back to main.py, we are basically ready to go. And that's really all there is to it.

Actually, there's one more thing I want to show you is with custom tools. What you can do, you don't really need to, but what you can do is if we go to our crews and then go to Gmail crew, this is where we created, in the tool, we created our specific Gmail tool.

What you can do here is say from agent ops import record tool.

Okay, then in our Gmail tool, not the Gmail input, but the Gmail tool above that, we can have a decorator called @record tool.

And then you can type whatever you want here, right? So instead of Gmail tool, I can say this is used for Gmail drafting.

Gmail draft emails. I don't think that's really a complete sentence, but we just, it doesn't matter, right?

Then we can recognize that we know where this tool was used when we go look at the dashboard.

Okay, so this was going to now recognize this tool. It's going to give it this name so we can easily identify it when we go to see what happened with the whole process of this flow, like I said, in their Agent Ops dashboard.

So now let's go ahead and run this. So I'm in the meeting minutes folder here. Okay, it's going to execute this, and this is going to take just a bit, so I'll come back whenever this is done.

Okay, awesome! So what happened in the last part was the Gmail draft agent, where it actually successfully created the draft.

It didn't actually send out an email; that's fine. That's just on my part. That'll be fixed by the time you get this.

But the session stats, you know, the duration was a minute and 41 seconds. The cost was almost 6 cents, and there were a total of seven LLM calls.

Now you see there tools one. That's because we actually set the record, that record decorator tool onto a tool, so it only shows one here.

But there was more than one call to the tool. But what is more important is there's session replay.

So we can actually just click this, follow this link, and that'll take us to everything we need to know about this session.

Okay, so now we come in here, and we can see everything about this session, right? Which is basically running that whole flow.

So we have all the versions of OpenAI, Crew AI, the tools, and all the libraries that were used. You know, it cost almost 6 cents.

Here's everything about me as the host. Here's the number of prompt tokens, the completion tokens, etc. Right?

And then we have this session replay where each, you know, these were all, all the things in purple were in LLM call. All the tools were in yellow.

And I know it's missing like the file writer tools. I'm not sure why they're not included here, but either way, we know that they were there.

But for instance, here is this tool. This is the name. Remember we named it? This is used for Gmail draft tools.

And if we go to this first agent or the first for the first LLM call, this is where we started the Crew AI meeting minutes summarizer, right?

This is where we use a file writer tool to create the summary.text.

And then on the next call here, if we come look at this, this was for the action items.

And then if we go to the next one, this was adding the sentiment.

And then you can keep going on and on. So we actually, like if you click on the last one, right, this gives you everything.

Each step will give you part of it, right? So if we come here, this was kind of everything added together, kind of getting ready to write the email or draft the email.

So this is everything about the location, the dates, and then kind of the final mail, right?

And then this tool here, this is where we created the draft and so forth, right?

But the better thing is this chat viewer, right? This is the LLM chat, and these are all the calls between the system and the user.

So you can come down here and just look at the whole, at like the history of the whole chat with this flow, right?

Amazing! I mean, this is really cool stuff because then at the end here, right, was the Gmail tool.

This was the body, which was the parameter in the custom Gmail tool that we created.

And then the final answer says email sent successfully, even though it was an email draft that was created successfully.

But this is awesome, right? This gives us everything we need to know.

So if there was an error, you could come in here and kind of see where it aired out, and it would tell you that there was an error.

And of course, you can also do the overview, and this kind of gives you a better idea of what's happening.

Actually, I had used a different, I used a different API key. I used the same one before. I forgot to copy the new project API key in here, so I had run this once before.

So in total, between both sessions, it's about, it's about cost me about 10 cents, and it gives you the average tokens used for all, for both sessions.

Here it gives you the events per session, the session cost, the duration. You know, it gives you all the information that you can possibly need to know.

Awesome! Now you have a better way to see what's actually happening with your agents.

And let's say something costs too much, or you're like, "Why does that cost so much?" or "Why were there so many calls?"

Well, guess what? Instead of just running it, you can now understand why, and then you can go ahead and fix it.

Now we're going to go ahead and take a step back for a second, and I want to introduce you to RAG and how that works within Crew AI.

And this is actually going to be our third project. This is going to be a simpler project. We just went from one to the next, I know, but I like these little mini projects as well.

How this is going to work is we are going to use the PDF Search tool. We're going to give it a PDF, and then it's going to use that same PDF when we ask the agent a question.

It's going to give it to the task, it's going to go to that PDF Search tool, run that query on the PDF, and return to us relevant information and then kind of make it more digestible for us.

So it should give us the correct answer, and with that said, that leads us into our third little project called PDF RAG.

Okay, like I mentioned, we are going to use the PDF RAG Search tool. So this is an example of how it looks on their document website, but it's not like a true example, so I'm going to go over that with you now.

But we're just going to use a crew, not a whole flow this time. I know that meeting minutes was kind of a lot, so we are going to do something that's a little bit less strenuous.

And it's kind of cool because I want you to understand how RAG works with Crew AI.

So let's create a crew. So back in the, I'm up in the Master Crew AI course project level.

So we're going to say crew AI create crew, and then we can just name this whatever, but I'm going to say PDF RAG.

Go through this process again, and then we'll come back.

Okay, so what we're going to do with this is we are just going to have two agents and two tasks. The first one is going to use that PDF RAG Search tool.

Then the second agent is just going to simply summarize everything that it got.

Okay, so we do need these agents, but let's go ahead and start renaming some things, and then we'll also change the YAML files.

So this is going to be PDF RAG agent, so PDF RAG agent, and this is going to be the PDF summary agent.

Okay, and then for the task, this is going to be PDF RAG task. Go and change that, and then this one will be PDF summary task.

Okay, we do not need this output file either, but we are going to need to use the PDF RAG tool.

So this is a Crew AI tool. So from crew AI.tools import PDF Search tool.

Sorry, tool, it is using RAG, but they just call it PDF Search tool.

Now, one thing we need to do is I'm going to give you a sample PDF that is from a recent archive document. I think just last week, it's actually about Agent Ops.

And then we need to create the tool with that.

Okay, so I have an agent_ops.pdf, which you will also have whenever you go to look at this on GitHub.

And then let's go and initialize the PDF tool.

So say PDF Search tool equals PDF Search tool, but let's give it the actual path to this agent_ops.pdf.

So we can say PDF equals path.join(os.path.dirname(__file__), 'agent_ops.pdf').

Okay, so now what we've done is we've given this PDF to the PDF Search tool.

Now, before we go to modify the YAML files, let's look into this and see what's actually happening.

Okay, so I'm not going to go super deep into this, but I kind of want you to have a little bit of understanding because they kind of, you know, hide what's really happening under the hood, which is good because it kind of abstracts it away, which is what their goal is.

But I don't want you to just run this and then be like, "Okay, so it added, it was able to search at the same time." Like, what's actually going on?

Okay, so the first thing is, you know, I had mentioned a bed chain already, and actually, if you go to their GitHub, it goes to memz, which I had already covered, which I thought was interesting.

And what happens is, so we call the PDF Search tool. We have the ARG schema. You know, we just created a custom one, right?

So this PDF Search tool schema, this is what we gave to the tool in the crew, right? We said PDF is equal to the PDF.

So this is the main tool schema that we're using, right? This is the mandatory PDF path you want to search.

Now, before it actually says search, it is going to add it to the vector database and do the embeddings and all that if it doesn't exist already.

If you run this two times in a row, the second time it won't need to add it because it already exists.

So we have this initialized method. So if PDF is not none, so if the PDF does exist, right, it's going to add the PDF.

The self.add, there's a good bit actually going on here, right? So there's this add function here, there's super.add.

There's also this before, right? Before we run it, so we're going to initialize this. It creates a self.adapter, which again here in the model validator, it says we're again in the ragor to.py.

This looks similar, not the PDF search to the rag tool.py.

So it creates this app, right? So this app here, if we go into here, this is like where everything is done with from using embed chain.

So when we initialize this app, so it creates, it lets you create a LLM powered app for your unstructured data by choosing, by defining your chosen data source, embedding model, and vector database.

So in here, they have the database, the embedding model, probably how they chunk everything, and cache and memory config.

So if we scroll down a little bit, and so what they, oh yeah, so right here, the embedding model, default embedding model is OpenAI Embed.

Their default vector database is Chroma, and they use OpenAI for the LLM. But this is kind of what's happening in the background.

This is the telemetry that they're using. If the memory configuration is provided, initialize the memory.

Again, I said they mentioned mem zero. Well, it's instantiating a mem zero object.

Okay, so here they initialize the database, so they set the collection name. So they have defaults already for this.

So in the background, you know, you're not giving a collection name. You're not really, you can change the configuration, but if you don't, that's also okay because it kind of, everything here is done for you, right?

Everything here is done. So if we go back, okay, so if we go back to the PDF Search tool, so this is going to set the default adapter, right?

So the default adapter is obviously going to be the PDF embedded chain adapter, which they have created in the background.

So it was creating this app. So if self.config, so if we do have, we give it custom configuration for like custom embedding models and so forth, it will use that.

Otherwise, it's just all the defaults that I just went over.

So it creates this, and this, if we go into this PDF embed chain adapter, so we have summarize and the source, right?

This is where the query happens. So this is the actual query function after we add it to the embed chain or added to embed chain for the vector database and embeddings and all that.

So once you initialize it for the first time, if it doesn't have it in their vector database, it's going to create that.

So here's the query where, you know, it's going to print out, you know, there's a lot of printouts, right?

But this is basically embed chain app query. So whatever we are going to give it to query to ask about the PDF, it's going to initialize this here.

So we have the result and the sources from that query, which is like kind of the relevant information, which we'll see.

So let's actually just go ahead and finish creating our crew, and some of that might make a little bit more sense.

So if we go to our config, so for the agent, we know we just have a PDF agent, the simple role, goal, and backstory.

And same thing for the summary agent. This is just a simple role, goal, and backstory.

Okay, will be in my GitHub, so you can copy. But for the task for the PDF RAG task, this is the goal or the description is to answer the question based on the PDF it's given.

And so we're going to ask it a question, give that here, and then it will search the PDF. Hopefully, it works; it will work and give us a response back.

And then the same, then what the summary task is doing is just providing it as markdown and then give it just kind of digesting that and making it, you know, into more like a section report.

Okay, that's all the configuration is doing. And I'm sorry I moved the agent_ops.pdf into the main. I put it in the tools by accident because we don't actually have a custom tool for this.

This is a Crew AI tool. Now, if we go to the crew, we are pretty much done, except we need to give this PDF Search tool to this agent.

So in here, tools, you can just say PDF Search tool.

Now, you might be thinking, why didn't I do PDF Search tool and then put the parentheses there? So it's kind of like executing a function inside of here.

You don't need to do that. It doesn't matter. You can do either or because I had already initialized it up here with this PDF.

You know, you can just add the variable here.

Okay, now on our main Python file, let's go ahead and remove this. I'm going to if Main and execute the run function.

Okay, and so when we go, and now what I did is just update this so that when we go to run it, I'm just able to input a question into the terminal, and it's going to send that as an input to the PDF RAG.

And with that said, there is one more thing in something that kind of happens, and I keep forgetting to do this, is that whenever you're searching for a PDF file or some file within your project, it doesn't always work consistently, especially when working across like two different computers.

So what I recommend doing is importing from pathlib import Path. You can name this whatever you want, right?

But what this does, this basically gets the directory where the script is located, and then the path is you get that directory and then the agent_ops.pdf file.

So it's going to say, "Oh, I'm in this directory here for Source PDF RAG, and then I'm going to locate the file in here."

So then I pass that into the PDF Search tool.

Okay, that makes it more consistent whenever you go to run this.

So now what? Now let's go ahead and run this. Make sure that you know everything is set up, your task and configurations, they're all named correctly.

The input is in there correctly. I will say that. So for the main.py Python file, remember this input is crew, or the, yeah, this is the name of the input.

So whenever you go to your configuration, your task, make sure when you ask a question here is the question. Make sure that is called input.

If not, you will get an error, and just make sure you update that.

With that said, let's go ahead and run this. And what it's going to do whenever this starts, it's going to create a database folder up here, SQLite database folder for the long-term memory, like it is right here.

So it's inserting the batches into Chroma DB, like mentioned. That's what embed chain is using as their default vector database.

So let's go and answer a question like, "What is Agent Ops?"

So now it's going to, okay, awesome! It worked. I know it worked because it's using the tool for the PDF tool.

The input, the query is basically, you know, Agent Ops, what is Agent Ops? But it's gathering relevant content from the PDF.

So it didn't gather everything, right? It's just the relevant content.

And now the PDF RAG agent, you know, this is kind of what it retrieved from there.

And then, oh wow, this is pretty long, but the summary agent is going to take that and write a comprehensive, you know, summary of that.

Okay, so that's awesome, and that worked, right?

Now what you're going to see next is if I were to rerun this, let's clear this, let's go and rerun this.

It's going to try to insert the back into the vector database again, but you see nothing comes up because it knows that it already exists, and it doesn't need to.

So this is the actual PDF, right? So let me scroll down.

How many pages is this? 19 pages. Let's go somewhere around the middle, page 10.

Let's ask, "What is guard rails?"

Okay, let's do this. So I'm going to say, "What is guard rails?"

So what it should do is it should give me some, it should get the relevant information from here.

I'm hoping anyways, so this is going to run, and we're hoping that it gives the correct relevant content.

So here is the relevant content, guard rails.

Okay, so constraint, let's see. I think, what did, oh, you know what?

Let me see if there's something else in here. For example, what can we do here? Guard rail targets, rules, configuring.

Okay, so I think it does actually, guard rails by setting targets, rules, and corresponding actions.

See figure five. Okay, yeah, so what I think happened is there's something about guard rails in the beginning of the text as well.

But I know it right here said, "See figure five," right here is figure five about guard rails.

And then it's, oh, and yeah, by setting targets, rules, and corresponding actions, that is right here.

So it is getting, so it's trying to find relevant information based on just the simple guard rails.

And then it went through the next agent and summarized it so that it looks nice.

And you can do more with this, like saving it to a file. You know how to send an or create a draft now.

Maybe you try sending this to an email by having it go through maybe all of your yesterday's archive PDFs and do this for each one.

But this is, you know, this is what I wanted, right? We want to be able to search through a PDF using basic RAG agents.

What I want to show you is how to use code execution with an agent.

Now I'm going to go over a couple of different ways because it's a little bit nuanced, and it's not all told to you, the whole story is not told to you in the documentation.

So I'm going to go over that. Let's see how that works.

There are a couple things about code execution with Crew AI, and I'm going to go over those.

The easiest way to do this is in your agent that you want to have execute code is you simply have this property called allow code execution, and you set that to true.

Now, by default, this is false, so you have to set this to true.

And whenever you do that, based on, you know, the task that's given, it will create code and then execute that.

Now, the thing to know is you do have to have Docker running. This relies on Docker because that's, it'll create a container, it'll execute code inside of that container.

It's not going to run it on your local machine, and that's a good thing. Generally, that's a really good thing.

However, the example that I'm going to go over with you requires that we have a file that it's going to, I'm going to give it parts about the CSV file, like some of the column names and what I want to do with it.

It's going to create code to give me whatever I want to analyze about that file.

So with that, you can't just directly do that this way because, you know, Docker doesn't have access to your file path or your local machine to get that file path.

You have to mount a volume, and then you can copy that file to there.

However, whenever you allow this code execution, you know, a lot of what's happening is done in the background with Docker.

So without actually modifying, you know, modifying the code in the background for this, you know, it just is what it is.

So there is actually a second way to do that, and if we use the code interpreter tool, it says here, right?

This is actually what's really being used whenever they go to allow execution of code on that agent is it's using this tool.

And you can see the requirements for this is Docker. However, that's not entirely true.

You actually don't need to have Docker, and so we're not going to be using it this way.

We're going to be giving it this tool, but there is a parameter that I'm going to show you in the code that we can use so that we can run this on our local machine, and it can recognize a file that I wanted to analyze.

Okay, so that is what we're going to do now. Now, I'll have the CSV file ready for you that you can use, or maybe I just give you the link to download it.

But what this is, is the county health rankings in the United States.

So this is like a 25 megabyte file, right? So it has a lot of data here, and what I really care about is like there's a column F.

This is called measure name, so it's going to measure different things, let's just say, such as violent crime rate.

There's like diabetes, you know, screenings for different things medically. We scroll down here, children in poverty.

You know, I haven't seen some of these yet, but physical inactivity, like there's just so many, there's so much data here.

But all I really want to know is the most violent counties in the United States.

I want to give, I just want to really return the top 10.

So I'm going to have an agent with a task to create code to, based on whatever I give it from the CSV, and then execute that and then return back to me the analytics of whatever I'm about to show you.

So this is pretty simple. It will be under the code execution folder.

I actually just created a crew through the CLI, you know, through the terminal where we use the command to create a crew.

I just did that, and I just modified it. There's actually only one agent and one task.

And this County Health rankings, you know, you can either use it. I'm not using the one that's in the project because I was trying to do some things, but I also have it in my downloads folder on my machine.

So I'm just giving it the full file path, and then I'm going to give that as the input so that it has this in order to do the analytics with, right?

I'm not using RAG. It's just, it's going to look at this probably through the Pandas library, and then it's going to create the code to give me what I want.

Okay, now in our Crew AI, this is where we just have a single agent and a single task.

So I just have a coding agent and a data analysis task. So we first imported from crew AI.tools, which we have done before in this course.

We have the code interpreter tool. Now I give that tool to the coding agent.

And then in the property here, so if we go inside of this, this unsafe mode, basically, if we go, if we scroll down to where it's being used, okay?

So when it actually goes to run this tool, it's going to check if true. This means it's going to run code in like unsafe.

That basically just means on your machine, or if it, where it's by default false, it's going to run in Docker, where you have to have Docker running, and it creates the container there.

Whenever it goes to run this, so it takes just a little bit more time to create the container and then execute it.

But I want to run in unsafe mode so that I can use a file on my machine and do some data analytics on it.

So if we go back here, I now set unsafe mode equal to true because I just want to use it locally.

And then everything else is kind of the same, right? I don't have, I commented out the allow execution, allow code execution to true.

And then for the data analyst task, I just have getting the configuration from whatever I have from the configure from the config folder.

So for the agents in the task YAML file, this is pretty simple. You'll have this, you know, I'm having it as saying use the file from the file path, which will be given.

You can update that. You'll have to update that to wherever it is located on your machine.

But then in the task YAML file, I wanted to analyze the given dataset and calculate the top 10 counties with violent crime rate.

Here's the full file path. The columns, these are the columns that I want to look at, and you know, I just want basically give me the result of the code execution of the analysis.

All right, there's no extra tools I'm giving it, and that's basically it.

So now let's go ahead and run this and see what happens.

Okay, so here we are. I ran the main Python file. I know it looks a little different. I just right-clicked the main Python file and ran it in the terminal.

But for the data analyst agent, you know, we only have one agent. It has the one task, so this is the task here.

Now it says the requirements are already satisfied, and that's because when it went to execute the code, you know, it's using Pandas, NumPy, you know, it's using these different libraries and needs to make sure that they are installed on my local machine, probably, well, in this, in my environment before it can execute it, right?

Because it can come up with the code, but when it tries to execute, if I don't have the libraries, it's just going to fail, right?

So that's fine. And then, of course, you can see here is the code that was created by the code interpreter tool by the data analyst agent.

And then if we scroll on down here, it gives us the final answer.

So it gives us the top 10 over the years, right? It doesn't have to be, it's not each year in a specific year.

It's over a span of years, what were in those years the top 10 worst counties in the United States as far as violent crime rates go.

Looks like New Mexico, I believe is Missouri. CU St. Louis, St. Louis is in there, and then Arkansas.

So it looks like they hold the, actually, it's just like three different counties too each time.

Wow!

Anyways, I don't, I just got the information online. I don't know how they got this raw value for the crime rates.

You know, this is just a way to show you that you can take a CSV as a file, you can take a CSV and then interpret the data by having it create the code for you, then executing it, and then getting an output.

Awesome stuff!

And now I want to get into the last portion, which is the no-code version of Crew AI.

And what they've done recently is create something called Crew AI Enterprise, and you can join for free and try this out, as I'm going to show you.

But this is a way to use no code to create your whole crew.

Let me show you how to do this.

Okay, so let's begin with Crew AI Enterprise. Now, the first thing you need to do is sign up if you haven't already. It's free, and as soon as you sign up, you'll be able to go ahead and start right away.

There's no waiting for them to contact you like there used to be when it first came out. You'll be able to start right away.

So on the sidebar here, there's, you know, a good bit going on. If this is your first time looking at it, but the main one is the crews.

This is where you will have all the crews that you generate. This is where you can deploy them, and you can run them.

But the first thing we need to do is there is an LLM connections. We need to go here, and we need to actually create a connection.

So how do we do this? The first thing is we need to have a connection name.

Now, this can be, on the right-hand side, you can select a provider. These are all the providers that they allow in Crew Enterprise right now.

You know, I'm sure this will be expanded as this matures, but for right now, let's just go ahead and select OpenAI.

Let's choose one of these, see GPT-4. Let's just do GPT-4, and I can just going to name this Master Crew AI Course.

Okay, just so that you know that this is what I'm using right now.

Then in the environment variables right here, we need to actually add the environment variable for this.

And we know that as we have been using this in our code, it's OPENAI_API_KEY, and then you're going to pass in your OpenAI platform key or API key right here.

So go ahead and do that, and we'll come back.

All right, I pasted here. So then you're going to choose add connection, and now I have the Master Crew AI Course connection right here.

Then in the environment variables, this is used if it's like, you know, within the code.

You may not necessarily need to do this, but this is with your crew. We'll come back to here, but this is like if you need anything like a server API key, right?

If you need to search the web, you need a server API key if you're using that, or if you're using Firra, whatever that may be, you need to put that environment variable here just like you would use in the ENV file in your code.

But what we need to do now is select our default LLM connection.

So if you go to settings, and you can see here you're under members, roles, defaults, and billing, go to defaults.

Then, you know, this is my organization name, and then the LLM default.

So the default LLM connection for agents, the LLM connection is I'm just going to go ahead and choose Master Crew AI Course.

Select GPT-4, but then there's also a default for the Crew Studio, which we're about to go, which you're about to see.

I'm going to choose Master Crew AI Course, and then the model I'm going to choose is GPT-4.

You can select more than one model per LLM connection, but for now, this is, I'm just going to use 4 and go ahead and click save settings.

Okay, settings have been updated successfully.

Now for the most powerful tool, in my opinion, of this whole Crew AI Enterprise is Crew Studio.

This is where we can talk to an assistant just like you would any chat program, and then we can ask it to create a crew, whatever we want.

It's going to build out a plan for us, we can modify it, and then we can go ahead and deploy the crew from here.

So let me go ahead and do that now.

All right, so make this simple. I want to search online for the latest Google Trends to AI, then compile them together and save into a file.

You just simply hit send, and you know, it's thinking. Depending on what you're doing, it may not take super long, but it's going to come back with a plan for how we want to create this.

So here we are. The automation plan is to compile the latest Google Trends way to AI and save them into a file.

So there are tools that are being selected here. We have the server dev tool and the file read tool, and the file read tool is for saving the compiled trends into a specified file.

It's giving us two agents, the trend search agent and a file save agent, but there's three tasks, right?

That's okay. You can have three tasks. You can have more than one task assigned to an agent, and that's okay.

So the trend search agent actually has two tasks, and you know, I can, it says, "Does this play align with your expectations? Let me know if any additional requirements or adjustments are needed."

So I'm just going to say, "Yeah, I like this. Go ahead with the plan."

All right, then I'm going to hit send, and then it, you know, it says like, "Oh, you know, there's probably nothing else you need to modify."

So now it's going to give me a grid of all the agents and tasks and descriptions, and then we can actually go ahead and modify that.

Well, let's go, well, actually, it makes sure that there's nothing else that needs to be done.

I'm going to generate crew plan, and now it's going to give us this grid where we can modify anything we want about these agents and the tasks and descriptions, like I mentioned.

Right here, oh, okay, and here it is. We have the agents.

So at the end of the, after it looked at it again, it actually created three separate agents.

So a trend research specialist, content compilation, file management, and then here are the tasks for them.

And we can come into each of these, right? Like the expected output for the latest Google Trends, I can modify this to whatever I want.

And then it's going to generate the crew based on whatever I modified.

So then the agents are assigned, the tasks are assigned to each agent, and we are good to go.

I'm not going to modify any of this, but you can if you want to.

So I'm just going to say generate crew. What's going to happen now is it's going to be, it's basically creating the code for this.

It's going to create that as a crew that we can deploy within Crew AI Enterprise, and you're not actually going to run this locally.

So here you can actually download the code. So if I click download code, this may take a second, but there's going to be a zip file of the crew, right?

So right here it says AI Trends compilation. Let me open this. Let me bring this to the center a little bit.

You know, if I unzip this, so if I kind of open this up, I mean, this is going to look exactly like you've seen, right?

Like here's the configuration for the task, the task in the agent YAML file. Here's the crew file, the main file, here's the custom tools pack.

I mean, all of this is here, right? That you need.

And then this is also, this is also like a node-based way of looking at it, and you can actually modify where each of these go, where this goes if you still want to.

Like if I had a reason to, you can, but now I don't really want to do anything with this.

The crew is called AI Google Trends compilation. I just wanted to deploy this crew.

So in the actions, I'm going to click deploy crew. This is going to, it does take a few minutes for it to deploy online so that we can run this.

But it's going to first deploy, and it can take up to 10 minutes.

The one thing that we need to do is we know that it uses server, right? We know that it uses server, and actually, I already have it set up.

But in your environment variable, you need to create the server API key environment variable.

And then go to server.dev, which I have already mentioned in this course, and then you create your key or copy the key that you've already used, and then you just put that here, right?

So you can, you'll put server.dev or server API key here and then your key, and then hit save variables, and then it will be listed here so it can be used within the crew.

So we come back to crew, and while we're waiting, let me just go over a couple quick things in the sidebar here so you understand or at least can see them.

So in the templates here, what you can do is these are kind of geared towards marketing and sales, but this is like a private repo of templates of crews, right?

So this Enterprise content marketing, this is something that you can either download the code for or you can deploy it within Crew AI Enterprise.

Here's a sales offer generator, job change monitoring crew, prospect analysis. I mean, any of these that you can use, right?

Here's even a Zenes integration, so you would need to have a Zenes account, get your API token, email, all this stuff, right?

It kind of hints at that inside of this, inside of this, each template.

But this is a pretty cool place to start if you're not really sure what to do. You can just come down here.

Here's a meeting preparation. You can download this, use it locally, or this can be your first one that you use here in the crew.

When you deploy it, it'll come back to the crews sidebar menu.

There's also integrations. Right now, there's only three. So I've already integrated my HubSpot account, but you can also integrate Slack and Zapier.

And you can mention when you create a crew that would like to create a crew that maybe just retrieves all my contacts I have and all their emails.

And then, you know, maybe you can save them to an air table or save them into Google Sheets, and then you can maybe prepare an email to send to those, whatever that may be, right?

But you can also integrate these into your crews just by connecting your accounts, and there will be adding more things to this as it goes on, as this is still relatively new.

But this is just kind of showing the power of what you can do with Crew AI's Enterprise.

Okay, now that it's done, you may need to refresh the browser to show this, but I can go to manage, and then I'm just going to simply click trigger crew.

And what this is, is kind of like a combo board, right? So I'm going to click trigger crew.

I didn't really have any inputs for this, so it's just waiting execution, and then this will eventually move to running.

You know, whatever it's started. Sometimes you may need to refresh, which they have up here.

Now it's actually running the crew, and then whenever it gets to the completed stage, we'll actually have the output for me, right?

Sometimes it takes a few, depending on what your crew is, it could take a little bit to run everything, right?

It's got to, in this one in particular, it's got to search online for Google Trends, and that's going to compile them together and make them into a nice format for me.

All right, it is now in the completed board. So if I click on this, you know, it gives you some metrics, right?

The total tokens that were used between the prompt and the completion, I think it got to over like about 7 LLM calls in total.

This is the output, right? This is the structured document of AI Trends, and this is kind of giving me a full in-depth analysis and even gives me the references of where it got these trends from.

Like, you know, this is amazing, right? This is actually like the markdown of the output, and you can simply copy it here at the task, right?

You can come in here and see the task also as they're being completed. You can see if there's an error, which one was completed, and so forth, right?

But this is, you know, that was amazing, right? I took, you know, I went to Crew Studio. There was no code involved.

I didn't do anything code-related. It created the crew for me. I simply ran it, and I got this output.

You know, this whole idea of having a no-code component to complete something, especially if you're not familiar or you don't really care too much about coding things, you know, this is the way to go.

Now, if you want to have a lot of crews, of course, you have to do, you have to pay for a bigger plan.

You know, the free plan lets you do so much, right? But this is to get your feet wet, and I highly recommend trying this out.

Thank you so much for watching this course, and I hope you got a lot of value out of this.

If you have any questions at all, you can leave them in the comment section down below, email me, join the Discord, and ask me there like people do, or also join my school community.

Either way, I know if you watch this, you'll be able to do more with AI agents.

Thank you for watching. I'll see you in the next video.