🚀 MetaGPT Setup: Launch a Startup with One ✍️ Prompt!

MetaGPT is a multi-agent framework that builds product specs and code from a single prompt. This tutorial covers setup, API configuration, and running a Snake game example that generates user stories, architecture diagrams, and full documentation automatically.
Questions this video answers
MetaGPT (created with conda create -n MetaGPT).
Python 3.10.0.
GPT-4 (default model in the project's config YAML).
implement, run_tests, code_review (implement defaults to false).
It cost about $0.6 and the max budget shown was $3.
Chapters
A single prompt to set up a whole software company. The project is called Meta GPT, the Multi agent framework. It takes one line requirement as an input and outputs, user story, competitive analysis, requirements, data structure, APIs and documents. Everything by using the power of large language models. Basically there are a number of different agents that are working together. So for example, you have a boss agent that comes up with the requirements. Then you have product manager agents that writes the prds. There is an architect agent, project manager agent, there are engineers who implements the code, and then there is a QA agent which looks at the quality of the implementation. It's an amazing project because with a single line of requirement it feels like you have a whole group of people who are implementing different things for you. And you get these great visuals of the architecture as well. In this video, I'm going to walk you through a step by step installation process. I'll show you how to set it up on your local machine and then I'll walk you through an example project. We will also look at some of the limitations of the system. Okay, so we will start with a step by step installation process. First and foremost we need to create a CONDA virtual environment. For this, you need to have CONDA set up on your local machine. The first command that we're going to be using is CONDA create dash n, which means a new virtual environment. Let's call it Meta GPT. Then we want to use the Python version. So I like to use Python 3.10.0. Now in this case I have already a virtual environment named Meta GPT. So it's asking me whether I want to remove the existing virtual environment. So I'm going to say no, right? But in your case you need to say yes and it will go on and create the virtual environment for you. After that we need to activate the virtual environment that we just created. So I'm going to type conda activate and then META GPT and you see that the virtual environment is now activated on my computer. Next, we need to check if you have NODE installed on our machine. The way you check it is you type NPM and then version. I'm running this on a MacBook and I have already installed npm, so that's why I see this. But let's say if you don't have NPM installed, then you're going to type Groove Install NPM and that is going to reinstall NPM on your system. If you are on a Windows machine, the process is a bit different. In that case, you need to go to The Node JS website and simply download the installer, install it on your machine, and then restart your virtual environment. We also want to install the Mermaid package. So in order to do that on my MacBook, I'm just going to copy this part without the sudo. That's for installing on a Linux machine. So we'll come back to our terminal, simply paste that command and hit enter. So this will basically install the Mermaid JS package. Okay, next we need to actually clone the repo. So for that we will go to this green button, click on it, click on local, and then simply copy the repo link. Now here on the terminal, you need to have git installed on your machine. I'm going to use the git clone command and paste the link that we just copied, hit enter and that will start downloading all the files in the repo. After this, we need to actually move to this folder. So for that we're going to use cd, which is basically change directory and then meta GPT if you type ls. So it will give us all the files that are present within that folder. Okay, before doing anything else, I'm going to go open that folder here. All right, so this is the folder where we downloaded the repo. So I'm going to simply click on open. That will open the folder in Visual code Studio session. Okay, so it opened that folder in another session. So let me go to the terminal, click New terminal. And now we need to just reactivate the virtual environment that we created. So I'm going to go back and type in conda activate, then meta GPT. That will bring us back to our virtual environment. I also need to see. Okay, so I'm actually already here. I don't need to CD into that folder. Okay, so they have provided both the setup as well as requirements TXT file. So you can use either one of them in order to install all the required packages on their documentation, they recommend to use setup py. So let's try this command. So here I'll just paste that command and run this command. So it will start downloading all the required packages and start installing those packages. Okay, so the installation is complete. I think the only error that we got, it's not able to find HTTP X, but that is required by the anthropic models. So we'll simply ignore this for the time being. Okay, so we need to set a few more things before we can start working on meta GPT. So first we need to set some configurations. So come here to the config folder. Then there is a YAML file. Click on this. The first thing you want to do is to set your OpenAI API key. So I copied my OpenAI API key and I'm gonna just paste it here. Now a few other things to notice. By default it's using the GPT4 model. You can set the maximum and number of tokens that you want and you can also have the RPM set here. Now, apart from the OpenAI models, there is support for other models as well. So for example, if you want to use Azure endpoints, so you can set those here for search, you can set up different search engines. There is even support for text to speech, for example. This is text to speech using Azure, right? So there are different things that you can configure in here based on your application. But for this introductory video, I Simply set the OpenAI API key in the project. Okay, so how exactly do you run this? So for that we're going to look at this simple tutorial. So there are a few ways you can do this. So for example, in order to start creating things, you need to use this startup PY script. Then you need to provide a one line requirement. So let's say we say write a CLI Snake game, right? And then there are a couple of options that you can set. So for example, if you set the implementation to false, it will simply come up with the requirements and design docs, but not actually implement the project. But if you set it to true, it will write the code for you. Similarly, if you want to do code reviews, basically it will implement the project and then it will do a code review. In order to improve the project, you need to set this flag. But keep in mind in that case it's going to be using extra tokens and it will be costly. So what we're going to do is I'm going to simply copy this example prompt and then I'm going to use this implement equal to true so that it actually implements the code. Okay, so I wanted to check the startup PY file for default parameters. So in this case for the startup function, the implement is set to true, run tests is set to false. That, that's the unit test and code review is also set to false. But if you come down, actually even implement is set to false. So by the default it's not going to implement the code. Right? So we'll have to manually provide that. So what I'm going to do is I'm going to copy the command that we copied and after that I'm going to say dash dash Implement and we will set this to true. For this example, I'm not going to set code review to true because that's going to use extra tokens. And let's see what it comes up with. Okay, and we run into an issue. It says no module named 6. So what I'm going to do is I'm going to also run the installation using the requirements file and let's see if that fix it. If not, then we are going to manually install that package. Okay, so the requirements installation is complete. Let's run this command again and let's see what we get. Now it started the process, so it loaded the configuration. It says it can cost up to $3. So that's the total investment that we're making. Then here are the project or product goals. So create a CLI Snake game that is easy to play and understand. Then based on these requirements, it even came up with user stories. So basically for software engineers or product managers, you create different user stories. Now it also does the competitive analysis which will come up with competitive quadrant chart. So we'll look at some of the plots and images that it generates. So it talks about how it's going to implement it. It's going to implement these different Python files. Apart from the Python files, it also is going to implement data structures and interface definitions. Now these seem. This seems to be an evolution of projects like GPT Engineer and Aider. And it's doing a pretty good job so far. Now here you can see it started implementing the code. Okay, while this is being implemented, go and see this workspace folder. So if you click on this, it actually created another folder inside called CLI Snake Game. And within there there's another CLI Slate game which is actually implementing all the Python files right now. But then there is this Docs folder in there which has the different specifications as well as the task, the PRDS system design, right? And then there is another folder called Resources. So let's open this up. Now within this folder you will see that it implemented different charts. So for example, here is a competitive analysis. It creates this quadrant, for example, high engagement, low engagement, low reach, high reach. And then it puts different computators in here. Okay, so here's a more practical example. So I was actually trying to build a voice assistant. So it went ahead and did some market analysis. And the competitors that you see, I did not define them. For example, it says Google Assistant, Microsoft Cortana, then IBM Watson, right? So these are the ones that it founded by itself and listed in here. So that is Actually pretty neat. Now for the Snake game, here is how the API design is going to look like. So this is basically the implementation. Okay. There is even a sequence flow of how the actual implementation is going to look like and which different components are going to be executed and what sequence. Now here we are looking at a very simple and basic example, but it kind of gives you an idea of what is possible with Meta GPT. So the implementation is done. It cost us almost 0.$6 and max budget was around $3. And for this simple project, it used 2746 tokens for prompt and only 54 tokens for completion. Okay, let's look at the actual implementation and see if this is going to work or not. So we're going to go to the CNI folder. Now in here it also generated a requirements. TXT file that is specific to the project. And if you see here, it has two packages that needs to be installed. Okay, so what I'm going to do is I will actually change the directory to this workspace, the CD workspace, then cli, Snake game and let's list all the files. So there is this requirements. Txt file in here. So rather than creating a new virtual environment, let's just install everything in the same virtual environment that we are currently working in. So we're going to say pip install and then requirements. Txt file. Okay, so it will simply download those two files. Okay, so there was a small issue with the cursys package, so I had to rerun it again and I simply ask it not to use the cursors package. And this seems to be working. So let's run this and see how it looks like. Okay, so. Oh, okay. I am terrible at this. Let's run this again. Okay, I'm dead. So it seems to be working. Although it's pretty fast, I think we can adjust that. It doesn't have any score indicator in here. You can also adjust that by adding that into the requirements. Now, in terms of the project roadmap, they have some really interesting features in the roadmap that they are currently working on. So this project is going to evolve over time. Would love to see what the community will be able to do with this project. If you found this video useful, consider liking the video and subscribe to the channel. Thanks for watching and see you in the next one.










