Learn how to create AI agents and automate work...
All right, so here's how you can use AI agents. And so we're going to open our terminal and we're going to run the following commands right here. So I'm going to copy this. I'm going to open up cursor. I'm going to open up the terminal part, command, and then enter. And so this is going to install everything for crew AI. I've already installed it, so it goes pretty quick. All right, the next thing we're going to do is create a crew AI project. And so we're going to copy this. I'm going to put this in here. I actually want to go into CD Python, type this in. And so this is going to create the folder, everything. I already have a demo folder in there. I want to be able to overwrite that. Yes. It's going to ask me what provider do I want to use, OpenAI, Anthropic, Gemini, Gronk, right? In this case, we're going to just say OpenAI. Which model do I want to use? I'm just going to use GPT-4 for now. And OpenAI keys, this is where you have to enter your OpenAI API keys. And so you're going to go to platform, OpenAI.com slash API keys. Create new keys. I'm going to call this demo TikTok. I'm going to delete this, right? This is a FYI. You always want to delete your API keys. You don't want to share these with anyone. So I'm going to copy that. And then we're going to come back. I'm going to paste this in and press Enter. And so you're completed. So once you're completed, then you're going to open up this project inside of Cursor. So we're going to go in Cursor, open up a new folder, Python, demo, open. All right. So what's happening in this file, right? And so if we go in here and explore this file, this is where the real action happens, right? This is where all of the, so you can see this. So this is where main. And so this is, so consider main to be like the start button. Like this is where everything happens. This is how you get the ball rolling. And so right here, it says, hey, we're going to be able to create an AI agent or a crew of AIs that are going to search AI language models. And so there's a few different things that you can do. You can run. You can train, which is a little more advanced. Replay. Test. And so for now, you're just going to focus on run. And so then if you come in crew, crew is where all of the different members on the crew are organized. And so there's a main task here that says the crew is going to be able to run all of these folks in sequential order, that there are a bunch of agents that we're going to define. And then this right here, this crew function, is going to be able to say what they're going to do. And so right now, there's a researcher. There's a reporting analyst. There's a research task that they'll need to do. And then there's going to be a reporting task that they'll need to do. So how do we be able to control the task that they're doing? Well, if you go inside of config and these agents.yaml, tasks.yaml, this is what controls our agents and the tasks that they do. So if we go into agents, this gives us an idea of who our agents are. And so here's topic. You saw that topic that was in main.py. This is what's going to say a senior data researcher whose goal is to uncover cutting edge developments inside of the topic. You're a seasoned researcher with a knack for uncovering the latest develops in said topic. Then there's a reporting analyst that's going to be able to take the messaging from the researcher and then provide a report on what the researcher then generated. So you can see how these crews work. And so you go in the task, you'll see what is the task that's actually going to be done. So we have a research task and we have a reporting task. Conduct through a research on the topic as of current year 2024. Here's a reporting task. Review the context you have. So you kind of understand how all of these play together. So we have our main, we have our crew, and then we have our agents and tasks. All right, and so we just want to be able to test and see if any of this works. And so we're going to come down here. We're going to crew install. That's going to install all the dependencies that are needed to be able to run this. We noticed an environment has created. Do you want to select the workflow? Yes. All right, and then we're going to go to crew AI run. And if you hit crew AI run, it says we're running the crew. And we should have an expected output into a markdown folder of what the crew just created. And so remember, it's supposed to be a reporting agent. And you can see that right now it's saying that the senior data analyst is researching. And now the task is to conduct a thorough research about large language models. And it's still thinking, all right, this is the next phase. And now the report analyst is going to take all the information from the researcher and then provide a report on it. And this should be a markdown form. All right, and so you see the final. You see in conclusion. And so what we want to then go do is check and see this report.markdown. And so here is what the report looks like, right? Advanced AI and LLM programs, a comprehensive report. And so you can see that the crew team had a researcher and an analyst. And it created an entire report on the findings from the analyst. And so you can see how this can be developed to where you can have different agents, more agents doing different tasks. Let's say, for instance, right now it's NFL Sunday, if you wanted to be able to take agents and search all of the stats that existed on the game and then being able to compile some kind of answers. Not at all this is embedding advice, but I'm saying that you could potentially create agents and crews and tasks that could be able to do a lot of different things for you. And so let me know what you guys think about this.
No AI insights yet
Save videos. Search everything.
Build your personal library of inspiration. Find any quote, hook, or idea in seconds.
Create Free Account No credit card required