 Hey, Wiz. So do you know, are FANG companies still pretty dope tech stocks to buy? Yes. I think, you know, they got to be good. It's FANG. It's FANG, right? They drive the S&P 500, right? I think so. But there's also like new dope stocks like Microsoft, like NVIDIA. Everybody's talking about these ones, right? And they're top of the market cap. Yeah, I think so. That's right. Yeah. So like those ones feel like no brainers. But to me, from like an AI perspective, it kind of feels like it's not real clear where we shouldn't be investing our money if we want to play the stock market game on FANG. I wonder, you think we could build an AI to help us decide on the best non-obvious FANG tech stocks? I think so. i think probably we could do that yeah we could we could do that okay you think we could use some agents we definitely use some agents yeah we can use like a bunch of agents like multiple agents and really like maybe like even build an extra smart crew of agents to help us out i think we could build an extra smart crew yeah i think we could do that yeah yeah okay so my gut tells me that if i had to pick a fang stock today and put like 1k into it like meta it feels to me like they're crushing the hardest based on what i know about the industry you think what do you think? I, you know what, to be honest with you, uh, I, I'm not quite sure, but the only way that we can really find out is to build a crew of agents, right? So that's right. That's right. I think, I think we should build, ship and share an awesome LLM application to help us out with this. And it does seem like Crew has set us up pretty well to do this. Also worth noting, everybody, financial services firms around the world today are building out specific tools to help analysts, human in the loop, augment their ability to look critically at specific stocks. So through our application today, Wiz, it should be fun to imagine like ourselves as financial analysts, build some AI to help us and even build a whole crew of virtual assistants to see what we can do. Sound like a plan? Sounds like an awesome plan. All right, let's get into it, everybody. Today we talk crew, AI. I'm Dr. Greg. That was the whiz. And it's really interesting to try to find use cases out there today that multi-agent crews are actually leveraged for, that are actually built out for industry. We think we've stumbled upon one by talking to our partners around the industry and what the companies that are coming to them, financial services firms, insurance organizations, or healthcare organizations, what these types of companies are doing out on the edge, we decided to go with a stock predictor tool analyzer today to really root our discussion of multi-agents in something that's relevant to the industry right now. You'll learn all about one of the latest tools that you've probably heard about already, Crew AI. You'll learn about the core constructs and you'll learn about when to choose it over some of the latest tools that you've probably heard about already, Crew.ai. You'll learn about the core constructs, and you'll learn about when to choose it over some of the other tools out in the industry. If you have questions, obviously, jump into the chat and ask. But if you want your questions to get prioritized, please use our Slido link that will drop into the live chat now and upvote your favorite questions. We might not have a chance to get to each and every single one. All right, everybody, let's dig into multi-agent crews with Crew AI today. And as we align our AIM towards the sesh, we want to make sure that we understand the multi-agent app pattern. This kind of brings together all of the core foundational aspects of generative AI. And it's really important to kind of understand the fundamental concepts. Crew AI is just another set of constructs that we can leverage these concepts with. Those core constructs, they do matter. And we're going to take a look at them. And then we're also going to talk about probably one of the questions we're hearing a lot, we're thinking about a lot. When should I use crew AI versus land graph? It's almost becoming the land chain versus Lama index discussion on the multi-agent front. So we'll talk multi-agents, we'll talk crew AI, and then we'll build our FANG stock predictor. And we'll try to see, like, should we be investing in Meta, in Apple? What does the data tell us? We have our own sort of insights and intuitions as people out here paying attention to what's happening at the edge. But what does the data tell us? If we hired experts to help us out with this, what would they say? And what data would they use? So let's talk about multi-agent systems for a minute. You know, agent, when you see the word, it just indicates a specific pattern. It indicates the pattern of reasoning followed by action. LLMs are great at this and sort of thinking about the simple action. LLMs are great at this and sort of thinking about the simple two-step loop, we're going to ask a question or assign our system a task. The LLM is going to decide if it knows how to complete this thing or if it can answer the question. And it might go straight to an output, just like a simple LLM application would. But it also might go and search and find some information. It might use any number of tools that it has access to, to find some additional info that might help out the task it's trying to solve or the question it's trying to answer. And it might loop through reason about the new data, the subsequent question that should be asked, the type of tool we should pick up next, and then it might continue this loop until we get our final answer. So this sort of agent here is just a single agent system. We've done a lot of work talking about agents in the past. If you're new to our channel or if you're new to agents, I highly recommend checking out our For Everyone series. These are shorter, less technically detailed discussions of agents and multi-agent systems. And if you're into development of these tools, check out some of our work that we've done on Langchain and Lama Index, talking about agents and multi-agents. We don't want to cover all that here. What we want to do is we want to sort of give only the essentials and want to focus on the tool of the day, the application of the day. One first bit of terminology is that don't get confused by the agent, agentic, agent-like divide. It doesn't exist. It's not real. We're seeing a lot of people say, well, you know, maybe I like it when I see agent or agentic and it feels less marketing-y. or agentic and it feels less marketing-y. That might be true, but at the end of the day, you can sort of sound smarter by saying agentic, but we're not actually talking about something different. We're talking about this pattern. And when we talk about multi-agent systems, now we have more than one independent agents in our system. And they're connected in some sort of specific way. The way that they're connected and the complexity of the system can vary pretty greatly amongst the type of systems that we're seeing built today. And in fact, there's a distinction that we like to put out there, and that we'll try to talk about today a little bit, that this idea of multiple agents sort of sequentially doing, moving towards a specific task versus a multi-agent, more flexible system where it's more able to solve broader scope problems instead of specific tasks. We'll talk about this in the context of crew AI and also crew AI versus Landgraf. And if we sort of have the image in our mind of a crew, this can be kind of helpful today. Because what is a crew on a boat doing? They are all rowing in the same direction. It's not a complex game where many different crew members are moving in many different directions and all being orchestrated with one another. It's a very synchronous orchestration. We don't want people paddling in opposite directions. We would go nowhere quite fast. And when we talk about multi-agent systems, there's a couple key reasons that we would want these. You know, it's easy to group roles, responsibilities, access to tools. It's a very clean way to be able to separate the prompts that we're using that come together to solve our application. And it's easier to sort of demonstrate and conceptualize what you're building to others, to your boss or to anybody else that you want to share your application with. There's a number of tools that you'll hear about today. One of them that's been around and was kind of early on in this game was a tool called Autogen from Microsoft. And if we look at the description of Autogen, by Autogen, multi-agent conversation framework, build LLM applications via multiple agents. We see this sort of multi versus multiple distinction happening right here already, where it's sort of ambiguous, almost like the agent-agent-like distinction, can converse with one another to accomplish tasks. Okay. Now, if we look at Crew AI, Crew AI says it's designed to, quote, enable agents to assume roles, share goals, and operate in a cohesive unit, a well-oiled crew. And when we get to a tool like LandGraph, this is significantly more abstracted in its language. And I think there's reasons for that, that we'll get into a little bit today, to build stateful multi-actor applications. So really, really concerned with state when we talk about Landgraf. And we can add essentially cycles to any applications that we've built using the lane chain ecosystem. So I want to put forth a simpler way to think about this. If we think about LandGraph, we can think that agents with access to tools can help solve problems. When we think about crew AI today, we can think about agents with access to tools can accomplish tasks. Now, a task is more specific than a problem space. You might call it the task space. And I think this is one key difference between the two tools and the level of abstraction, the level of capability that they're at. So I want to bring Wiz up to talk a little bit about this before we get into the core constructs here. All right. So we've got this idea, first off, of multi-agent versus multiple agent that we continue to talk about, but isn't broadly a thing in the industry. And the idea is like the multiple agent is more like we're all moving in the same direction. It's more linear. It's more sequential. It's less dynamic. You can't sort of go anywhere. If you're any given agent, you're more constrained where the multi-agent system sort of more relaxed on constraints. That's the way I'm thinking about this. How are you thinking about this difference? Yeah. I mean, so for me, the big thing is like, you know, do the agents interact with one another, right? Do they depend on each other's outcomes? Can they evolve closer to, you know, you know, sharing ideas, right? So building off of each other versus a multiple agent system, which is like agent one executes plan, agent two executes plan, agent three executes plan, two executes plan agent three executes plan or you know we have a swarm of agents and so there's 15 agents but they're all doing the same task that's how i like to think about the difference between the two where multi-agent requires some interaction between the agents right uh that that can allow them to be a more cohesive system versus just like, say, a DAG of agents, which is, you know, we could consider multi-agent, but really it's just one agent, then the next agent. So it's just multiple agents in a row. That's right. That's how I like to think about it. And it's not even, as you mentioned, right, it could be a swarm. So it's not even about the sequential in a row thing. It could be parallelized agents doing the same thing, almost like the GPU analogy comes to mind here, right? Which, of course, gets us to multiple multi-agents, right? So if we have, we can just keep stacking the words, you know? That's right. That's right. We could just keep stacking the words, you know. That's right. That's right. And, you know, so if we think about this in the context of the tool that we're looking at today, we're looking at crew AI today. And obviously the image of a crew rowing a boat together, it's very aligned. It's very sequential. It's very focused on a specific goal. And my understanding is that crew AI is sort of built at a layer of abstraction because of that, that sort of focus on one task that allows us to actually write less code. It's like a lower code solution than like a land graph is. But it also limits the total flexibility of the system for agents to depend on one another. Is that right? Yeah, I think I would agree with that. The key insight is less ish code. We still have to write quite a lot of code. And in fact, perhaps the number of lines of code that you write might even be more with something like QAI. However, what you're really spending time writing is the things like tasks, prompts, so the prompt engineering piece. And you're not spending a lot of time describing the flow of process, right? So Landgraf, we're building this flow diagram or or this uh you know whatever you're going to call it anyway it doesn't matter but you're you're building some kind of you know graph obviously of nodes that dictate where to go and what edges to follow when and all of this so you're really being prescriptive with that flow versus crew where we're spending very little time actually writing that flow and a lot more time writing kind of you know making sure we have all of our tools set up to work in the ecosystem making sure we set up our tasks well and that that extra level of prescription especially through like a task layer uh where we're able to give it a task a directive as opposed to a land graph where we certainly can do that to be clear, but that's not, we have to do that separately. Right. I think that makes the, the, the crew AI feel less like you're writing a ton of code and you spend a lot more time thinking about your prompt strategy and how you're prompting them. Okay. Okay. So it's not no code. It's not even low code. It's less ish code. Yeah. Okay. Cause it's still, I mean, we're still doing multi-agent AI systems. Yeah. Right. Like it's going to be some code. You gotta write some code. And we are, we are looking like I, I personally am very interested in when we see sort of a no-code real-deal multi-agent application come out, sort of like the GPT store for multi-agent. I'm not really seeing that anywhere yet. I don't think we're seeing that anywhere yet. That's not crew AI. That's not what this is. Not in this implementation, no. We're absolutely defining tools in code. We're writing code for tools. We're writing code for agent and it is less, you know, less code or it is, you know, not as much code. And maybe the code is even easier to understand, but it works. I think so. Yeah. We're not at the no. Okay. And just on the production level, like, can we go to production with either one of these things or both of these sort of production ready tools? Or should we think about one over another? I would not at this time think of it as a production ready tool above anything else. So like, I wouldn't say like, it's, it's a production ready tool above the rest of our favorite frameworks. But it but also certainly not less. Again, production ready is a big word that has a lot of different meanings. Certainly you could use this in production. That's right. But I would say, you know, we're waiting for maturation for a number of these services in order to really get to the next level of production ready. Production means running and never going down. People are using it all the time. Yeah. I think it's hard enough to find applications that people want to use all the time that use multi-agents today. So yeah. Okay. So the jury's still out on production grade for multi-agent systems in general, but if we're going to have some on building, shipping and sharing, let's go ahead and pick up a tool like CREW AI as we'll do today. Thanks Wiz. Let's check out the constructs and see what he's talking about, the processes being a little more abstracted. The real focus of today and the real focus of, I think, any multi-agent system that you build today has to start with an understanding and a deep respect for the importance of prompt engineering. Now, just recall that the whole idea here is that we want to build systems that are more like humans. We don't require huge amounts of supervised data, you know, to just go tell a child, hey, can you go do this for me and give them a quick instruction? Or even kids talking to one another. Kids can do this kind of thing. And that's why instruction is the number one best practice in prompt engineering, to be clear and specific when you provide instructions. This is nowhere more important than in multi-agent systems as we try to scale out the prompting. It's also very important to give your prompts a place to stand. What's their role? How are they supposed to think of themselves? How are they feeling today? You can get a much different prompt if you say you're in a bad mood and it's gloomy outside versus if you're feeling bright and sunshiny today, depending on how you engage with an LLM. And this is why we see a lot of sort of the initial prompts, the baseline prompts, start off with things like, you are a helpful assistant. Or we can see things like, you are a teacher grading a quiz. This is very common when we have prompted evals and evaluation done just through prompting. So this role and persona is one aspect. Now, another aspect that we won't get into a ton, but will clearly make itself manifest when we talk about tools today is we can also talk about the retrieved context and how that's so important. Obviously, that's the entire basis for retrieval, augmented generation or RAG. And it's not going anywhere. It's very foundational, fundamental. It's as foundational and fundamental to Gen AI as search and retrieval has been to the way we engage with data systems for the past 20 years. Now, when we give input, it's nice to give examples. Sometimes you'll notice that less examples, more sort of chain of thought reasoning is sometimes used in the multi-agent systems, although sometimes examples are used as well. And you'll see a lot of sort of language in these systems that are sort of this think through step by step, sort of give the model time to think aligned with this kind of best practice. And then finally, we also want to be specifying the output. This is very obvious. If you say, hey, I always want JSON output. But if you also say, hey, I want this task to be output to the next task, specifying the output is very, very important. And so what we're kind of doing, whether we're prompting a single LLM or building a multi-agent system is we're sort of prompt engineering. We're wrangling in these LLMs to play nicely together. It's hard enough to get one of them to play nicely with a human. Now we want many of them to play nicely together. It's hard enough to get one of them to play nicely with a human. Now we want many of them to play nicely with each other. Let's remind ourselves, crew AI. Agents with access to tools can accomplish tasks. And so here we are at Constructs. 22 minutes in at Constructs here. We have agents, we have tasks, we have tools, we have crews, we have processes. This is the syntax for crew AI. And we can take a look first at agents. This is the boilerplate code for agents. No, we have role, define role, role persona, best practice for prompt engineering. Backstory, almost an enhanced role, best practice. Goal, what's my goal exactly here? That's almost aligning with the output of what we want from this particular agent. And then tools I have access to. of what we want from this particular agent. And then tools I have access to. This is obviously a very agentic thing and one that we will obviously discuss and is very important to augment our generations with retrieval. What are we retrieving while we're searching some sort of data using tools? So that's the baseline way to think about agents. If we think about tasks, we can check out the boilerplate code within Crew AI here. This is a fun one. The tip section here, return. If you do your best work, I'll give you a $10,000 commission. So we're bribing these LLMs to do a better job. Sometimes that works. You know, I personally like the missionary over mercenary model. But hey, if the LLMs are into it, maybe it works well for them to accomplish these tasks. Let's see what a task description looks like. Task one, description, obviously, do something. Thanks. Best practice, clear and specific instructions. Hopefully, they're a little bit more clear and specific for your use case than they are here in the boilerplate general example code. And then look at this. Do something. If you do your best work, 10k coming your way. Make sure to use the most recent data as possible. Think through the data that you're using step by step. Use this variable, specify input, and also this variable, specify input. Okay, so we're aligning with the best practices of prompt engineering as we're defining tasks. Now, what happens when we go to the next task? Well, of course, we want to do something else. And we want to take the input from task one, again, sequentially in the crew and do something with it. Of course, a little bribery never hurt, especially since we're talking sort of fungible tokens here, you might say. And you can go on and on and on. Do something, do something else, do something else, do something else. Use this variable as input, use this task as input, this is what I want as output, and so on and so on. Pretty straightforward, really, if you think about kind of the baseline architecture that we're using here. When we think about tools, one of the things that's really important is we want to remind ourselves that tools are all about improving search and retrieval. Now, I put this ridiculous image on here, even though you can't read it, because I highlighted rag in yellow. Rag tool, rag tool, rag tool, rag tool, rag tool, rag tool, rag tool, rag tool, rag tool, rag tool. It's just rag tools. What does that even mean? Well, it means it's retrieving stuff. That's it. What are these red underlines? Reading and processing, reading and extracting data, scraping and data extraction, scraping and data collection, extracting data, searches and data sources. Tools are all about giving our system access to additional data that it can go search and retrieve, and it can augment its generations. Each individual agent can augment the generation during each individual task, right? We're starting to stack these ideas hierarchically in our, you got it, you know what's coming next, crew, right? And here we are, where it's very simple once we have these abstractions and we have some of the boilerplate code going on in the background that we actually don't even need to touch to leverage crews. And crews are just saying, okay, well, give me the agents, give me the tasks. Within the agents, I've already specified the tools. And, you know, all I need to do is run this crew. And I need to return the result. Interestingly, we dot run crews in crew AI. In LandGraph, we dot invoke our graphs. And so the idea of running sounds awfully programmatic in nature. This is another sort of way we could think about this. We're simply running through the program. So it's got nice sort of, let's say, guardrails, bumpers on it to keep us in line, keep us in the canoe, within the crew. And so we finally have the processes. And what's really interesting here is that like, we don't actually need to care. The hood's closed. We can open it up. We can look inside. We can look at the source, but we don't have to. The processes, and this is where some of the magic happens. This allows us to work at the next layer of abstraction and focus only on the aspects that are changing things within the way our crew operates. And those primarily are the prompts, quite frankly, and the access to tools and the way we're conceptualizing our problem and trying to solve it at the task level. So this brings us to our stock predictor and our FANG stock predictor. We're going to take sort of the off the shelf example from crew AI that's on stock prediction. We're going to see if we can modify it a little bit, have some fun with it. Essentially, we take quarterly and annual public company SEC filings about their cash and about their goings on board of directors and so on. And we can produce an entire recommendation report for if we should buy, how we should buy, and exactly what we should be thinking about these stocks. We could have a crew that includes a financial analyst, a research analyst, and an investment advisor. That means maybe we're, you know, instead of like paying these people, sort of have our assistants doing this work for us. Let's take a look at the prompts for each of the members of our crew. The financial analyst, its role is you're a professional financial analyst. Oh my God, pretty straightforward. Goal, provide clean, concise, and actionable financial analysis. The backstory. You're an experienced financial analyst with a strong background in finance and economics, focused on providing safe and reliable financial advice to clients. Solid. What about the research analyst? Well, you're now a professional research analyst. You're gonna gather and analyze information to provide insights and recommendations. Instead of actionable financial analysis, we want insights and recommendations. So we want to take the actionable financial analysis and generate insights and recommendations from it. You're a seasoned research analyst with a keen eye for detail and a passion for uncovering valuable insights. Focus on delivering high quality research to clients. And then finally, we did our financial analysis. We did our research, our searching and researching through that financial analysis. What are we ready to do? We're ready for some investment advice. So our private investment advisor is here to provide personalized investment advice and recommendations. As a trusted investment advisor with a proven track record, crushing it in the market, focused on helping clients achieve their financial goals. So let's see how this crew comes together to help us decide, like, should we invest in Meta? Should we invest in Apple? What are the FANG companies that are worthwhile? Let's say I'm going to put $1,000 into NVIDIA. I'm going to put a thousand into Microsoft. I want to put a thousand into FANG. What company should I choose? Let's see what the AI says we should do. Wiz, show us how the meta Apple and FANG stock predictor works. Oh yeah. Okay. So at the base level, the first things first, I suppose what I'll say is that none of this is a legal advice. Okay. So none of this is a, well, none of it's legal advice. So we're building an agent that are, a couple agents to be clear, I guess, that are in this domain. But this is like GME moons, exactly. This is not like real financial advice, right? Anthropic, who's the LLM we're using today, doesn't permit their use for actual financial advice. So please don't use this to, you's the LLM we're using today, doesn't permit their use for actual financial advice. So please don't use this to, you get the, you get the thing. Okay. So yes, none of this is investment advice. Thank you, Aman. Okay. So how does it work? Well, let's just run it and see how it works. So we type Python main.py, a classic, right? We enter the company we want to analyze. Let's choose meta you know what let's choose gamestop because it's funnier uh so we'll go gamestop so you can see here that there's a there's some kind of like uh you know system message working age and professional research analysts starting task collect and summarize recent news articles okay and then it's going to use this to gather comprehensive information about gamestop I should start by searching recent news and financials. So we're going to search the internet for news using the query GameStop recent news stock market. And then when I look through, I can see it's returned some context. Okay, and then it says they provide some recent news about GameStop. I need more specific detailed information. So let's check Yahoo Finance News for GME. There is no recent Yahoo Finance News for the GME ticker. Okay, so let's search the internet again. We get some more information. We're going to try to search the internet for news. We're going to get an error using the tool. We're going to get another error using the tool. And so it's going to decide to not use that tool. So this is the first thing that we want to think about. Number one, if we run into errors with our tools, it doesn't stop working, right? It tries it again. It tries to adjust the way it calls it, and if that doesn't work, it bypasses it. So we have this graceful failure for tools, which is nice. So let's see here. We tried to call with Yahoo Finance again. We call it wrong with the ticker this time. And we try again without the ticker and it fails again. So we decide now we're just going to go to the news. It fails again. And then we finally have a final answer. the uh to the news it fails again and then we finally have a final answer so what is interesting is you'll notice that the first time we tried to call yahoo finance news we did manage to call it correctly and then we had a series of of forgetting how to call it however it does not mean that the tool fails okay, so that's good. So this is the researcher, right? All right, and the query rewrite is just happening. We didn't define it anywhere, as we'll see in the code. Okay, so then we, this is the research. Okay, that's cool. We need to go to the next guy. So we're gonna search the internet. We're gonna look for GameStop. We get no results. So we're going to look for some more data and recent news. Okay, this is great. And now we're going to go to the research analyst. Again, note we were already at the research analyst, right? So that's great. So we're going back to get more research. And now we're gonna go through professional financial analyst. So we're gonna look for the Yahoo Finance News ticker for GME. There's no news because they do it wrong, they do it wrong again, they try it again, there's no news. This is classic, right? So the basic idea here is that the search results are not returning the GME news, likely because the SEC is keeping them down, right? That's what we'll say. But we do have access to results that we've pulled outside, right? So we still have a bunch of results. We can still make a recommendation. So we'll go through, we're going to continue, it keeps going. The idea is blah, blah, blah, blah, keeps going, keeps going, keeps going. And eventually, we're going to result with a report. Of course, we've already pre-run one. We used meta here because metas got more news and things like yahoo finance uh and the google news category uh the idea is here for the meta report we wind up with this investment recommendation report meta platforms inc executive summary based on thorough analysis metal and on and on the idea is that we have the ability to generate a full report uh for investment for Meta and who maintain a strong buy recommendation for Meta. Too bad this isn't investment advice, but that's the idea, right? So, okay. So what are we going to do? We're going to look at how we actually implement this in code. So we're going to start by looking at our actual kind of file structure. So we can see here that we have our crew stock analyzer aims, and this is all, to be clear, this is all available on GitHub through the link that should have been provided in chat. But the idea is we have some tools in our tools folder. Our tools are calculator tools, search tools, and SCC tools. And then we have the main.py, which is what we ran, Python main.py. We have some stock analysis agents, Python file, and we have some analysis tasks.py, which is going to be our tasks. So this is our agents and our tasks, our main, and then our tools. So we'll start by looking at our main. What does main look like? Well, basically, it's where we set up our crew. So you'll notice that we can provide a company. That's what the, you know, that was the idea of letting the user choose a company. And then we're going to give it some agents and some tasks. We're going to create some agents and some tasks. We're gonna create specific agents from our agents class, and then specific tasks from our task class. And then we're gonna set up a crew with those agents, those tasks verbose equal true, so we can see all the print offs. And then we can run.kickoff..kickoff is the thing that lets us kind of, you know, just run the result. And this is going to happen when we use dot run. So dot run will call dot kickoff. You'll notice that while we did give it some agents and we did give it some tasks, that's all we did. We didn't specify any flow. We didn't specify how it should approach the problem in this code at all. Okay. So that's important to keep in mind. So let's look at the agents then that we set up. So for the agents, we make a class, which is going to hold all of our specific agents for this task. We're going to initialize it with a quote-unquote brain, right? This is the language they use. The idea is this is like the main LLM that's going to be used for these agents. We're going to use chat-anthropic. We're going to use Claude35-sonnet. So this is Claude's recent release. It's a great LLM. Makes sense to use it. Okay, then we're going to create the first agent. And you'll notice for an agent, all we do is we provide a role, which is what it is, a goal, which is what it's trying to do, a backstory, which is where we can provide more interesting and nuanced details about, you know, how it should operate. I'm going to zoom out one text or the text a little bit less readable, just so we can see, you know, a little bit further into the line here. We're going to say it's verbose. We're going to choose the LLM that we created above, which is our chat anthropic. So you'll notice that if you created more than one LLM here, we could address it here. We can have different LLMs from different agents. It's up to you. And then we're going to give it some tools. In this case, we're going to give it search news, calculate the finance tool and search 10Q. Okay. And then we're going to create a research analyst agent. And in that agent, we'll give it a role, a goal, a backstory. Verbose is just so we can see all the outputs and then we'll give it a brain and we'll give it access to some tools, right? So this is it. This is a crew AI. We're just making agents. We give them a role, a goal, a backstory. We give them a brain and then we give them a roll a goal a backstory uh we give them a brain and then we give them some tools that they have access to and we do the last thing as well which is for our investment advisor we do the same thing we give it a roll a goal a backstory we give it a brain and then we give it some tools that it can use and that's all we have to do with crew ai which is pretty awesome right so you'll notice it's very straightforward python we're just returning an agent the agent is built with these these things and that's all we have to do. Okay. So let's look at the tasks. Well, for tasks, it's the same kind of level. We build a task class, which is going to hold all of our classes. And then we're going to say, here's the research task. And we're going to describe the research task and we're going to give it this tip section, right? So we'll look at what that is in a second. And we'll tell it the company that the customer selected. We're going to give it an expected output. So the reason this is important is because it helps us ensure that the output is along the lines of what we want, right? Without doing this, we're kind of hosing ourselves. And then, of course, financial analysis. Financial analysis is just another task where we have to do financial analysis. We haven't expected output. Recommendation, same thing. And then our tip selection, right? We have, if you do an amazing job, you'll receive $25,000. And we had some chat, right? That was, does this really work? It can. It's low-hanging fruit. It's something that you can try. But the idea is that LLMs can be incentivized by fake money, which is hilarious. Okay. So let's look at our tools then. So we have the calculator tool, which is dangerous, right? Because it's just calling eval. So make sure you're using this responsibly. But the idea is that it just calling eval. So make sure you're using this responsibly. But the idea is that it just evaluates code. Then we have our search tools, our search tools, search the internet using SERP API, or SERP API, which we just set up here. You know, we get the searches, we return them. If there are no results, it's gonna error out, but it doesn't matter because the agent gracefully handles our errors, which is nice. And then we have our search news. This searches Google news category, as opposed to just the regular Google search, which can be useful. We have that there. And then our SEC tool, this is secretly rag. So what we do is we, you know, what we do is we basically give it a query and a ticker, right? And then we search for the SEC API to grab what's called the 10Q, which provides financial information in a parsable output. So it's just HTML. You don't have to worry about anything else, which is very nice. And then we're going to do this embedding search thing and return the answer. And if you know RAG, you know embedding search, hey, that sounds super familiar. And we look at embedding search. What do we do? We grab some text. We turn it into a big blob of string. So we grab like a bunch of text. We turn into a big blob of text. And then we split it. and then we get some embeddings, and we build a vector store, and we retrieve responses that are relevant to the query, right, so that straight up just rag, we just inject some rag into the system, because of course, why wouldn't you, and so what this does is it searches through those 10 queues for the most relevant information. Easy peasy, lemon squeezy. Okay. So I'm going to stop sharing this screen and I'm going to start sharing another screen where we're going to look into a little bit more about the actual library itself. So we can see, because it doesn't, you know, in our GitHub, we're not really, So we can see, because it doesn't, you know, in our GitHub, we're not really, we're not defining any process, right? We're not defining any ways to move through tasks. We're just kind of saying stuff. We're giving agents. We're giving tools. You know, the tools will fetch info and then return it to the LLMs. We build tasks. But how does this actually tie together? Well, basically, behind the scenes, what we're gonna do is we're gonna use some of these processes. The processes are fairly straightforward. As you can see, we have sequential and hierarchical. Then we can look into, okay, so what does that actually mean, right? Because that's not really telling us a lot. And we can look into our agent class and see, you know, behind the scenes, what's happening here. We, we have a bunch of flow that's actually set up for us. So here's our agent executor. If you remember from Langchain, uh, you know, uh, it's, it's, you know, we have the ability to execute our tasks and then return information and then add it to a description or a scratch pad that's shared between the agents, right? We have, again, this agent executor idea with its prompts. We have kind of everything that you would expect, right? And you'll notice very kind of common language from langchain here. And the idea is that behind the scenes, right, this is just building all of the stuff that we would build, if you see here, like, in parse tools, right? It's building all of the things that we would build if we were building this in lang graph, but we don't have to because it's being done for us. So the idea is, right, when we look at, say, in the tool handler, we can see that this is just being used to get that tool. They're also using some smart caching on the back, which is really nice, going to prevent us some cost, not a ton of cost, but some cost. But the idea is that this is all being handled away from us, right? So it's not like we're not, it's not like there's not a flow that happens behind the scenes, right? But it is the case that we don't have to come up with it. We don't have to worry about it, that crew AI is handling that all for us, which is awesome. Okay, what I'm going to do is I'm going to do the staple, ask you guys, you know, if you're enjoying our events every Wednesday, please like, comment, subscribe, ring the bell. You know, I know it's silly, but it does help us and make sure we're doing the events that you guys like. And with that, I'm going to pass us back to Greg for some discuss. Yeah, okay. that you guys like uh and with that i'm gonna pass us back to greg for some uh discuss yeah okay so it seems like there was actually lang chain happening under the hood is that right oh yeah yeah i mean really i guess if you think about it's not all that surprising right what would you choose to build this with if you were trying to put together a new tool so the layers of abstraction are increasing very cool to see that and just we got a new tool. So the layers of abstraction are increasing. Very cool to see that. And just, we got a lot of questions in the chat. So let's kind of get through this. What's the bang box of today? Well, it seems like Apple's a hold right now. The AI tells us Apple's a hold, cautious buy. I tend to agree, you know, and they're sort of basing this on. I don't know. Meta was a strong buy. I tend to agree, you know, and they're sort of basing this on. I don't know. Meta was a strong buy. Meta, moderate buy. Meta, yeah. And you know what? That aligns with my feeling, but it's interesting when I dig into the report, right? Meta says, the report on Meta says, you know, it's an investment opportunity for those willing to accept the risks blah blah blah of a high growth tech company the company's strong financial fundamentals dominant market position and future growth potential in ai and the metaverse right because again it really matters we're pulling 10K from last year. We're pulling 10Q from Q1. Meta's moving really, really quickly. And we haven't actually had a chance to necessarily update the cycle of SEC filing docs in a real super meaningful way. We're still talking about the metaverse here. I'm pretty sure they're not really all about that metaverse anymore. So it's important to use this as a tool to help you, the human today. And I think this is what the financial firms are doing. So I think, you know, at the end of the day, I'm maybe throwing my thou into meta. I don't know. I don't know about you, Wes, but... I'm going GME to the moon, you know? u.s but i'm going gme to the moon you know and then the last thing the last thing i want to do is is i want to just point out like it seems like prompt engineering role goal backstory and rag like all the tools were search and retrieval are still pretty important here with these systems right like maybe they're almost like the whole thing i mean it it's all rag it's all right all the way down all the tools do is they retrieve information and then they augment the prompt right so it's like it's like it's like uh we can twist it all to be rag if we really put our minds to it. Yeah. Okay. So maybe we are once we've achieved this multi-agent ninja status, just telling AI to be nice and hitting it with some rag. Okay. So remember the multi-agent is more that collaboration, more that flexibility. The multiple agent is more about that defined process. That's sort of what we're putting out there. Let's see if we can get it to stick in the industry. It's all about these grouping of tools and responsibilities, the separation of prompts and conceptual models. This is what the multi-agent setup helps us with today. It's hard to find use cases still that these are really practical in industry, but we saw that with Crewai, we got some fundamentals, agents, tasks, tools. It's all about agents with access to tools can help accomplish tasks. And even some long chain under the hood. So with that, we're going to start digging into questions, guys. Let's see how far we can get into this. Okay. So upvoted big time here. So how exactly does it make sure which agent uses which tool? Great question. So we tell it the tools that it can access. So what this means is like we provide a list of tools that it has access to. So that's how we ensure it. It can't call tools outside of that list, even if they're present in the application. Okay. Okay. Okay. And then from the tool, we've got sometimes LLMs generate the wrong tool name. How can we prevent that? Yeah. So I responded in chat, but I mean, prevent? There is no way. Mitigate. This happening is through good prompting strategies and things like few shot examples and basically showing the LLM how to call the tool properly is going to go a long way. What's interesting about Crew AI's implementation is it will retry the tool call and sometimes actually gets it right on the second try. Right. And then, so now we have like, we still get the info we want, but it's not, and it does look at like the error to try to determine what it should call with. So we can add that context there if it's wrong, but there's no way to prevent it. Unfortunately, we just have ways to mitigate the amount that it happens. Shots on goal and then good prompt engineering, right? I mean, that's what we're talking about. View shot, very specific, clear instructions on and on. So anonymous asks, how does it assign the right? I think this is the same question. how does it assign the right? I think this is the same question. How does it assign the tool to the correct agent? We're actually defining this out of the box, right? We hard code it. In the definition of the agent, each one, we give it access to specific tools. We give it a role, a goal, a backstory, a brain, and some tools. Yeah. Okay. So next question. How much does C crew AI bloat my agent app? Also, how does it compare with other approaches to building an agent and performance? I guess we talk about auto gen, but you talk about land graph. Yeah. It's a, it's a lot of bloat. I mean, it is. So, uh, we, we, we had some good chatter, uh, you know, during the, the, the kind of code part where people are talking about like, I have a ton of LLM calls and they're this and that. I think platforms like Cray do that. That's part of their thing. It is pretty bloated. But the idea is because it's so bloated, because there are so many LLM calls, typically we get to a a great final answer versus if we keep things lean and tight like like we can with land graph we might not get as uh as great of an answer at the end which makes sense right if we have less information gathering if we have less tries at getting the right answer we might wind up with uh with a wind up with a worse answer, but it'll be a lightweight response. So there's definitely situations where you can imagine either. In this example with financial advisement and stuff like this, and not that it's real financial investment advice or whatever, but it is good to take our time, do all of the research, get a bunch of numbers, figure things out, compare things with competitors, right? Versus like, if what we want is to route someone to the right tool and have it make an API call on their behalf to set up a calendar event, like we're not, you know, that isn't going to require the depth of, of review and process. going to require the depth of of review and process and so we can keep that lighter weight and unfortunately with any multi-agentic system we always run risks of them just kind of getting stuck in a in a wheel turning situation where we're not progressing and this is why platforms like crew ai and landgraf have have automated depth or recursion limits where it's like you can't just sit here forever. Eventually, you have to go to output mode. That's right. There you go. Yeah, and I think that bloat makes it a lot easier for folks that may be newer to building production coding systems. It allows them to start building with this thing as a nice step beyond some simple agent tools, you know, because there is that sort of, it retries for you. It doesn't let you sit there forever. All of the sort of, you know, cases where these are kind of hard to handle if you've never built these kinds of systems before. It takes care of that nicely. So a good starter and, you know, in your multi-agent starter pack. So Mahmood asks, would you please recommend some GitHub repos for multi-agent RAG system using the financial sector? I don't know, Mahmood, but I do think that I'd love to activate our community on this and see if we can come together. I think this is an important space. And I think that, you know, fundamentally the financial services firms are not very inclined to put these things out open source so i mean i'd love to see more of this kind of thing come out from our cohorts and our demo days i know there are some folks out in industry that are very interested in this if you know of any please throw them in the chat i don't know whiz do you know of any off the top of your head? No. Yeah. The one that we just built, start there. But, you know, I think outside of that, it is a use case that people are caring about. So you can imagine people have gone pretty far with it. This is a great starting point. And so it seems like as the models get better, they will do their own planning, generate their own graph. Multi-on, et cetera, seem to be going in that direction. Crew AI land graph support question mark. Does this question make sense to you? Yeah, I think the, the idea of like letting the LLM be part of the actual planning stage and making graphs to solve problems. So like doing the process work that we would typically do in a manual fashion with, say, line graph. I do think that that's something that is going to be more and more adopted, especially for simpler use cases. We still run into the same, it's actually the same problem, right? Like, like, the first time, let's say, it's this is exactly the same problem, which you have to figure out, how do I approach this situation? Right? How do I solve this problem? In the first time that you're doing that, typically, what you're gonna do is be solving the problem, but leaving behind an artifact of the path you took to get there, and then letting the next cycle review if that path was good, based on the success, yada, yada, I think that's where we're gonna get into where we kind of uh it feels more like your traditional safari hat wearing machete wielding jungle guide who's chopping through the long grass and someone comes in the next time and they notice hey actually like you missed a pretty short path here. So I'm going to chop this way. Like, I think that's, we're going to start seeing more trailblazer esque application flows as we mature these tools. Yeah. Industry specific ones too, to the financial analysis point. Right. And because I mean, there are roles that are real. And if we want to put humans in the loop to develop these, we need to start with current processes that exist today. And, you know, I think this is one of the most exciting sort of areas of building projects and doing consulting for us and seeing what people build and bring into our cohorts that we get to see. And a lot of people are thinking about this today. Nobody's really quite sure how to do it in a general way today. And okay, so Aman asks, actually, I really like this question. I don't think we put a sharp enough point on it. Can you please explain multi-agent versus multiple agent, Landgraf versus crew, which one falls in which bucket? I think this is an important question. It's not that straightforward, but my answer is like, if you must put one in one bucket, one in the other, then put crew AI and multiple agent, put Landgraf and multi-agent, but Landgraf can absolutely do multiple agent problems. Okay. Crew is a little bit more constrained. You're going to have a little bit harder time sort of modifying that to do a truly collaborative, big mix-it-up multi-agent system. But as we saw, it's kind of laying chain under the hood. So you could if you wanted to. I don't know what's your take on this, Chris. So typically, so Crew AI typically implements multi-agentic flows, Landgraf. We make the decision. So I think like Crew AI fits neatly into a box, LandGraph fits into whatever box we designed it to fit into. Multiple agentic flows or multi-agentic flows? Multi, multi, multi, where they collaborate together to come up with the final response. Yeah. But I think the big thing is like LandGraph doesn't fit into a box unless we design it to fit into a box. Yeah. But I think the the big thing is like laying graph. Doesn't fit into a box unless we design it to fit into a box. And so that's that flexibility. Just looking for state stateful complexity. Good old states. OK. Yeah. So actually, we're sort of at another layer of complexity when we talk about Landgraf versus CRU versus the layer of complexity when we talk about multi versus multiple. Just last question here. Let's do two quick ones. I know we're at time, but is this fair enough for Amman to say? Can you clearly define what is agentic and what is not? I feel like, quote, it's a looped behavior where a decision must be made on the output produced. What do you think? I'm not going to try to define agentic. No, no, no. What do you think about his? I don't think that's terrible, Amon. I think you can start with that. That can be agentic. Go read the reasoning action paper, the orig, the OG, and then let's keep the discussion going as we have more agentic events here. And then finally, chat GPT assistance API where everybody wants to understand where all these tools fit in. So just maybe address chat GPT assistance and the tools like, well, what about auto gen? Right. And it's like, okay, so how are we thinking about this landscape today, right now, June 26, 2024? Uh, yeah, I mean, they're all, they're all solving different formations of the same problems. They can all solve kind of the same problems. The actual technologies, the way we interface with it might be different, but the actual, like, if you just look at what the LLM sees, right? If you, if you remove everything and you just look at the inputs, the LLM receives at the end of the day, the inputs are going to look fairly similar, which is here's some information. What should I do? Here's some information. What do you think about that, etc. So it's, you know, the way I would think about these is it's like ways to design systems around what is ultimately the same core concept. And the way that you prefer to interface and the level you prefer to interface that, right? With laying graph being very, you know, very strict and giving you a lot of process control, crew AI being very prompt focused, not giving you a lot of that process control, Lama index, right? Requiring you to build some additional tooling in or or approach it from a more data focused perspective perspective right but there's it's the same thing just the way we it's it's exactly like every other framework difference or every other language difference right if i talk to you in french and i try to tell you to have a good day versus English and I try to tell you to have a good day, they're going to sound completely different. They're going to mean the same thing, right? So this is the way that I would think about them today. Nice, nice, nice. Okay. So it sounds like maybe Autogen fits in as we continue our sort of investigation into multi-agent systems and tools. And then, Wiz, we are covering agent ops next week. So join us next week. We're going to sort of look at what the operational level on top, sort of LLM ops for agents looks like with a really cool new tool. And we'll be having some of the founding team join us for that one. That's going to be a banger. Check that one out, Wiz. Thanks so much for showing us the way through crew today. And so with that, we've asked you to like and sub. We've thrown the community into the YouTube chat. If you're not in Discord, we'd love to see you in there. Get started building, shipping, and sharing today. And if you're ready to really accelerate your career and your understanding of prototyping and production, productionizing these AI engineering systems, please do check out our AI engineering bootcamp. It's our flagship course and product on Maven, top rated course. And we've got a lot of great people in the current cohort and people already signed up for the next cohort. If you sign up early, you'll be immediately put into the AI engineering on-ramp that will give you access to bite-sized learning each week about transformers, about fine-tuning, and about alignment to help get you on the path to make the most out of your 10 weeks spent with us starting in August. So you got some time. Think about it. Hit me up. If you have any questions, I'll be happy to respond to you guys directly. Hope to see you all next week at AgentOps and let us know if there's anything that you'd love to see from us in the future. We always send out a little feedback form and we'd love to hear what you have to say about this event and what events you want to see moving forward. Until next time, keep building, shipping, and sharing, and we will most certainly do the same. Have a great week, everybody. See you on YouTube Live next Wednesday. Bye, everybody.
Multi-Agent Crews with CrewAI
In this event, we'll explore how to define, build, and operate agents and crews—a collaborative group of agents designed to execute tasks efficiently. Learn the art of agent collaboration, strategy formulation for task execution, and the orchestration of these autonomous units as they work together like a well-oiled machine. We'll also compare the CrewAI framework with LangChain’s LangGraph, providing you with a comprehensive understanding of how these technologies stack up. Whether you're an AI enthusiast or a professional looking to enhance your skills, this session is packed with practical insights and live interactions to answer your questions. Join us to unlock the secrets of building, shipping, and managing agentic systems with CrewAI. Click now to be part of this groundbreaking exploration into the future of AI!


Event page: https://bit.ly/crewofagents

Have a question for a speaker? Drop them here: 
https://app.sli.do/event/49UemZaZDitJjS3bK7Fe7F

Speakers: 
Dr. Greg, Co-Founder & CEO
https://www.linkedin.com/in/gregloughane

The Wiz, Co-Founder & CTO
https://www.linkedin.com/in/csalexiuk/

Apply for our new AI Engineering Bootcamp on Maven today! 
https://bit.ly/aie1

For team leaders, check out!
https://aimakerspace.io/gen-ai-upskilling-for-teams/

Join our community to start building, shipping, and sharing with us today!
https://discord.gg/RzhvYvAwzA

How'd we do? Share your feedback and suggestions for future events.
https://forms.gle/nj5ZYsM9vG2KTzVv9