Preface
Many friends who want to experience MetaGPT are stuck in the first step: installing and configuring the basic environment.
The goal of this article is to weaken the environmental restrictions and let everyone quickly experience the charm of MetaGPT. On the basis of not relying on any local environment (as long as you have a browser), it takes about 5 to 10 minutes for MetaGPT to start working.
Metagpt github repo:geekan/MetaGPT
Step 1: Prepare the cloud environment
Instead of relying on the local environment, then we need a cloud environment. Here we choose to use Docker Playground, because this environment has Docker and can access https://api.openai.com/v1 at the same time, the environment is free.
Specific operation:
- Visit Docker Playground, and log in with your docker hub account. If you don’t have an account, register for one, it’s free.

Note: Due to limited resources, sometimes the login may fail and the error message: We are really sorry but we are out of capacity and cannot create your session at the moment. Please try again later.
If the above prompt appears, you can wait for a while and log in again, or you can use Kubernetes Playground instead. Of course, if you have a more suitable cloud environment, it is also possible.
- After logging in to Docker Playground, click
ADD NEW INSTANCEto start a virtual machine.
Step 2: Prepare MetaGPT configuration
Refer to the Installation by Docker section of the document MetaGPT README, and perform the following operations:
Download mirror
1
docker pull metagpt/metagpt:v0.3.1

Prepare to mount directory and configuration files
1
2
3mkdir -p /opt/metagpt/{config,workspace}
docker run --rm metagpt/metagpt:v0.3.1 cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml
vim /opt/metagpt/config/key.yaml # Change the config

编辑 key.yaml 时,如果使用的是OPENAI的API,那么只需要修改 OPENAI_API_MODEL 和 OPENAI_API_KEY,这两个值需要对应,gpt-4要对应 gpt-4 的KEY,gpt-3.5-turbo要对应 gpt-3.5 的KEY。
When editing key.yaml, if you are using the OPENAI API, you only need to modify OPENAI_API_MODEL and OPENAI_API_KEY, these two values need to correspond, gpt-4 should correspond to the KEY of gpt-4, gpt-3.5 -turbo should correspond to the KEY of gpt-3.5.
Step 3: Make MetaGPT work
Run a MetaGPT container
1
2
3
4
5docker run --name metagpt -d \
--privileged \
-v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:v0.3.1
Enter the container to execute the command
1
2docker exec -it metagpt /bin/bash
$ python startup.py "write a cli snake game"

The files generated in the container will be stored in the directory /app/metagpt/workspace, which corresponds to the host directory /opt/metagpt/workspace.
Step 4: Download the project
Package workspace
1
2
3# Execute on the host machine
cd /opt/metagpt
tar -czvf workspace.tgz workspaceStart the web service to download the project
1
python -m http.server 9999
Docker Playground open port
ClickOPEN PORTon the page, enter9999, and click OK to open the web page.

- Download project
On the web page, click workspace.tgz to download the project generated by MetaGTP.