All right. So from the get-go I'm going to add some of our boilerplate soon where I'm going to import all of the three classes that we care about: the agent, the task and the crew. Now we're also going to be using serper for this. So I'm going to make sure that we are using GPT-4 turbo. And that we are also using our serper API key. You're going to be provided with one. You can also just get a one from their website. They do offer free credits. So we're going to be using two tools here, the search tool and the scrape two. So we already have used those tools in other examples. So you're probably familiar with that. The search tool allows allows your agents to search Google and the scrape tool allows your agents to look into one where else they find and kind of extract all the content out of that. So now that we have our tool set up, let's create our agents. And we're going to use four agents here. We're going to have a data analyst agent responsible to analyze the market, trying to find good opportunities for us to invest on. We also going to have our trading strategy agent here, that is going to look at those options and kind of like weigh in what are the movements that we should do regarding any stocks. There we have the execution agent. This is the one that really thinks about the timing, the price, the entry points. It's going to help us set up out there. And then the final one is the risk management agent. This agent is basically making sure that you understand the risks of buying stock and balancing things out. So again this is not a recommendation an investment in any shape or form. It's just one example of how you can use multiple agent systems to also interact with financial problems. So we wrapped up creating more agents and we are ready to create our tasks. This is not a financial recommendation in any shape or form, but I have personally seen working with companies, even fortune 500 companies that are actually doing risk analysis and financial analysis, using crewAI to the book, to financial documents that are public and private in order to understand how are those companies doing? So this is not a far at what people are actually building out there. With that said, let's start creating our tasks. Our first task is the data analysis. Basically monitoring the market, trying to find good angles, good stocks that we could use. The second one is the strategy. It's once that it knows what is your tolerance to the risk and what is stock selection, it can decide on how to move those stocks. The third one is the execution task. That's the one that is going to make the calls around the price, the entry points, the right timing. And then, the final task, is the risk assessment task. that wrap things up and make sure that it's taking into account the risk before making any recommendations. So now that we have created all our agents and tasks, we are ready to put our crew together. But you're going to notice a few different things in this script. First thing, you're going to notice that we're importing a new class called process. This process class, allows you to basically set a different way for agents to work together. You can see how we are using here when we're creating a crew by setting this crew to operate it hierarchically. By doing that, we're going to have one manager and it's going to delegate the work to the agents to perform their tasks. So this agent, is going to be a manager that crewAI will create automatically for you. So in future versions of crew, you're going to be able to set your manager yourself, and you're going to be able to pass this agent as the manager agent. Meanwhile, you can set one as the LLM that this agent will use. And crewAI, I will create this agents for you internally. So you don't have to worry about any of that. So here you can already see some of the differences between using the regular sequential processes and now the hierarchical process. So let's create our crew. And now that we have our crew ready we can work on what inputs we're going to be sending to it. So if you look through our agents and tasks declarations, you're going to find a few variables, namely the stock selection, the initial capital, our risk tolerance and our trading strategy and also using packets. So we can set all that from the get go to make sure we can use it when we're kicking off. And I would say feel free to kind of like stop the video off after this and play around with some of those numbers. Bring your stocks, the stocks that you care about. Play around with the initial capital. Play around with the risk tolerance. Make sure that you can really see how these agents behave differently, given the different inputs that you can send to it. All right. We are ready to kick off this screw. In order to do that, we basically call the kickoff method and pass or find the initial trading inputs to it. So let's do that. From the get-go, you can see that the crew manager kicks things off. So this is crewAI and their manager. It creates this manager automatically for you. And it's going to use this manager to delegate the work around. So you can see that it starts by delegating the work to the data analyst. So that this agent can do some work around finding information about Apple Inc. And from that point on, it's going to keep delegating work to all the different agents up to the point that it completes all the tasks and gives us a report on what we want to accomplish. What are the moves that we should do. What are the right values to get into the stock or whatnot. So let's tag along this execution. You can see that the data analyst decides to do a web search for the current stock price in volume. And when doing that, it finds a bunch of results. Among these results, each finds the Yahoo finance links and decides to dig into that. It reads the website code dig by using our other two in order to get all the information from the Yahoo website. From that point on, it now knows, what is the Apple inc actual value in the closed value from April 24th. It also understands everything about the stock that it was able to extract from that a Yahoo finance. Now that information goes back to our crew manager, that will decide what to do next. In this case, it's delegating work to our trading strategy developer. And you can see how it's passing some of the information that it learned about the Apple stock price increase in the after hours, everything that the previous agents learned, is now being sent to this new agent. And all of that is being coordinated by this crew manager that is autonomously delegating your work. So you can see that our agents now actually Google for trading strategy Insights trying to kind of learn a little bit more about how Apple is doing. And then he decides to look into a specific website itself in order to extract information from that. So you can see throughout the execution how this pattern repeats, where like the agents who learned through research and digging into these websites informations about the stock and the company and sending that back to the manager, and the manager kind of decides where to go from there. So next up to the point that he completes all the tasks that we want to complete. So let's dig along and see what the final result actually is. So you can see through this execution how a lot of delegation is happening. The crew manager keeps learning throughout this delegation in that getting even further. So now it's delegating works to data analyst, asking to provide analysis on the recent market trends and price movements. So you can see that throughout our lessons we have been building more complex crews. We started with four simple crew to write an article, and now we're building fully fledged crew that are able to do stock research, risk analysis and look into websites and extract information delegate work and do work in parallel. There is a lot going on there, and this is honestly super exciting because it opened up so many opportunities. So I would definitely say play around with this. Make sure to play with some of the attributes, change some of the crew, change some of the agents and tasks. Make sure that you build something that you find value and give it a try and share it online. People are super excited to see what people are building with crewAI in multiple agents nowadays. All right, so our crew finished in the task output is the comprehensive risk analysis report for Apple Trading Strategies. So you can see that it kind of like started with an overview and mentioned that you should utilize a technique called 20 day and 200 day SMA. So you can see that raw the execution. Well we we kind of like skip that because it's a long running crew. But throughout the execution it learned about all those different market trends and ways to kind of like assess the risk and decide what is the best entry point. But it mentions things like RSI or MACD in order to identify potential to buy in the market. It also mentioned, like for you to establish top wins and stop loss as a way to also do risk management, identify some risks, mentioning what you should be watching for, it also mentioned operation challenges and also mentioned market volatility pact. So how can that impact your your decision in there. The conclusion is that you have a good strategy to basically invest in Apple. However, you should be careful about how you deploy it. So you can see in here that the end result just kind of like more from the view. There is a lot of work during the execution that we could dig into. And it did offer some recommendations on how we should try to think about entering these, these stocks, specifically how it should analyze it. What I would invite you to do now is pause the video and play around with this agent. These are very complex crew. It has a lot of moving pieces, it's using a hierarchical process. So to play around with some of that, maybe make it sequential, see what changes, maybe remove some of this tasks or maybe change some of this task to is likely to see what you can get out of it. But this is a very interesting use case on how you can use crews to do thorough analysis on stocks and links and texts and methods. It's very interesting what you put out together. All right. So let's go back real quick. So by now you have acquired a complete understanding of how multi-agent system works in all of their components. This is more of a simplistic representation of crewAI specifically, but this is very similar to what you find on other frameworks out there. You have crews, you have agents, you have do's, you have processes, you have tasks. And the end goal is to produce a good outcome out of that. So you probably learn all the moving pieces. And should you ready to start building more complex crews to gather. So, on our next lesson, we're going to put together a more complex crew that you can actually start using today, and that can help you find your next job opportunity. So I hope to see you there. And so congratulations on all progress so far. Make sure to try things out. You set up jump straight in the next lesson. Make sure that you play with the Jupyter Notebook, and I'll see you in a second.