Listen to this article

MetaGPT is easy to understand Multi-agent framework. You give it a short requirement, and it gives you different things like stories, analysis, and documents. Inside, there are different roles like product managers, architects, project managers, and engineers. They work together using clear procedures.

How MetaGPT Used?

Example

Imagine a software team. There are different people doing different jobs:

  • Product Managers: They decide what the project will do.
  • Architects: They plan how the project will be built.
  • Project Managers: They make sure the project stays on track.
  • Engineers: They write the code to make everything work.

MetaGPT uses these roles to create a smooth team that can do many things in software development.

Installation Guide : MetaGPT

Here’s a step-by-step metagpt installation guide.

Traditional Installation:

  1. Check NPM and Install Mermaid-js:
    Ensure you have Node Package Manager (NPM) installed on your system. Confirm by typing:
   npm --version

If NPM is available, proceed to install mermaid-js:

   sudo npm install -g @mermaid-js/mermaid-cli
  1. Verify Python Version:
    Make sure you have Python 3.9 or higher installed:
   python --version
  1. Clone and Install MetaGPT:
    Clone the MetaGPT repository to your local machine and navigate to the cloned directory:
   git clone https://github.com/geekan/metagpt
   cd metagpt

Run the installation script:

   python setup.py install

Note:

  • If you already have Chrome, Chromium, or MS Edge installed, you can skip downloading Chromium by setting the environment variable PUPPETEER_SKIP_CHROMIUM_DOWNLOAD to true.
  • Some users may face issues installing globally. Alternatively, you can install it locally using:
    npm install @mermaid-js/mermaid-cli
    Don’t forget to configure mmdc in config.yml:
    PUPPETEER_CONFIG: "./config/puppeteer-config.json" MMDC: "./node_modules/.bin/mmdc"
  • If python setup.py install gives a permission error, try python setup.py install --user.

Installation by Docker:

  1. Download MetaGPT Image and Prepare Configuration:
    Pull the official MetaGPT image and create necessary directories:
   docker pull metagpt/metagpt:v0.3.1
   mkdir -p /opt/metagpt/{config,workspace}

Copy the configuration file:

   docker run --rm metagpt/metagpt:v0.3.1 cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml

Edit the configuration file:

   vim /opt/metagpt/config/key.yaml
  1. Run MetaGPT Demo with Docker Container:
    Run the following command to execute the MetaGPT demo within a container:
   docker run --rm \
       --privileged \
       -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
       -v /opt/metagpt/workspace:/app/metagpt/workspace \
       metagpt/metagpt:v0.3.1 \
       python startup.py "Write a cli snake game"

Alternatively, start a container and execute commands inside it:

   docker 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
   docker exec -it metagpt /bin/bash
   $ python startup.py "Write a cli snake game"

The docker run command:

  • Runs in privileged mode to have browser permissions.
  • Maps host directories to container directories.
  • Executes the demo command.
Also Read:  ChatGPT Official Android App : Download & Use

Building Custom Image:

If you prefer customization, you can build your own MetaGPT image:

  1. Clone the repository and navigate to the directory:
   git clone https://github.com/geekan/MetaGPT.git
   cd MetaGPT
  1. Build the image:
   docker build -t metagpt:custom .

Configuration:

  • Configure your OPENAI_API_KEY in config/key.yaml, config/config.yaml, or as an environment variable. Priority order: config/key.yaml > config/config.yaml > env.
  • Replace OPENAI_API_KEY in config/key.yaml with your own key.
  • Optionally, set OPENAI_API_BASE if needed.

Getting Started:

  1. Initiate a startup idea:
   python startup.py "Write a cli snake game"
  1. Optionally, include code review for better code quality:
   python startup.py "Write a cli snake game" --code_review True

After running the script, you’ll find your new project in the workspace/ directory.

Preference of Platform or Tool:

You can specify your preferred platform or tool when expressing your requirements. For example:

python startup.py "Write a cli snake game based on pygame"

In conclusion, Whether you choose traditional or Docker-based setup, MetaGPT offers a lot of options that you can work with.

By GP

Leave a Reply

Your email address will not be published. Required fields are marked *