• Stars
    star
    39,097
  • Rank 347 (Top 0.01 %)
  • Language
    Python
  • License
    MIT License
  • Created 10 months ago
  • Updated 14 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

MetaGPT: The Multi-Agent Framework

MetaGPT logo: Enable GPT to work in software company, collaborating to tackle more complex tasks.

Assign different roles to GPTs to form a collaborative software entity for complex tasks.

CN doc EN doc JA doc Discord Follow License: MIT roadmap Twitter Follow

AgentStore Waitlist Open in Dev Containers Open in GitHub Codespaces Hugging Face

  1. MetaGPT takes a one line requirement as input and outputs user stories / competitive analysis / requirements / data structures / APIs / documents, etc.
  2. Internally, MetaGPT includes product managers / architects / project managers / engineers. It provides the entire process of a software company along with carefully orchestrated SOPs.
    1. Code = SOP(Team) is the core philosophy. We materialize SOP and apply it to teams composed of LLMs.

A software company consists of LLM-based roles

Software Company Multi-Role Schematic (Gradually Implementing)

Examples (fully generated by GPT-4)

For example, if you type python startup.py "Design a RecSys like Toutiao", you would get many outputs, one of them is data & api design

Jinri Toutiao Recsys Data & API Design

It costs approximately $0.2 (in GPT-4 API fees) to generate one example with analysis and design, and around $2.0 for a full project.

Installation

Installation Video Guide

Traditional Installation

# Step 1: Ensure that NPM is installed on your system. Then install mermaid-js.
npm --version
sudo npm install -g @mermaid-js/mermaid-cli

# Step 2: Ensure that Python 3.9+ is installed on your system. You can check this by using:
python --version

# Step 3: Clone the repository to your local machine, and install it.
git clone https://github.com/geekan/metagpt
cd metagpt
python setup.py install

Note:

  • If 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 people are having issues installing this tool globally. Installing it locally is an alternative solution,

    npm install @mermaid-js/mermaid-cli
  • don't forget to the configuration for mmdc in config.yml

    PUPPETEER_CONFIG: "./config/puppeteer-config.json"
    MMDC: "./node_modules/.bin/mmdc"
  • if python setup.py install fails with error [Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test', try instead running python setup.py install --user

Installation by Docker

# Step 1: Download metagpt official image and prepare config.yaml
docker pull metagpt/metagpt:v0.3.1
mkdir -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

# Step 2: Run metagpt demo with 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"

# You can also start a container and execute commands in 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 command docker run ... do the following things:

  • Run in privileged mode to have permission to run the browser
  • Map host directory /opt/metagpt/config to container directory /app/metagpt/config
  • Map host directory /opt/metagpt/workspace to container directory /app/metagpt/workspace
  • Execute the demo command python startup.py "Write a cli snake game"

Build image by yourself

# You can also build metagpt image by yourself.
git clone https://github.com/geekan/MetaGPT.git
cd MetaGPT && docker build -t metagpt:custom .

Configuration

  • Configure your OPENAI_API_KEY in any of config/key.yaml / config/config.yaml / env
  • Priority order: config/key.yaml > config/config.yaml > env
# Copy the configuration file and make the necessary modifications.
cp config/config.yaml config/key.yaml
Variable Name config/key.yaml env
OPENAI_API_KEY # Replace with your own key OPENAI_API_KEY: "sk-..." export OPENAI_API_KEY="sk-..."
OPENAI_API_BASE # Optional OPENAI_API_BASE: "https://<YOUR_SITE>/v1" export OPENAI_API_BASE="https://<YOUR_SITE>/v1"

Tutorial: Initiating a startup

# Run the script
python startup.py "Write a cli snake game"
# Do not hire an engineer to implement the project
python startup.py "Write a cli snake game" --implement False
# Hire an engineer and perform code reviews
python startup.py "Write a cli snake game" --code_review True

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

Preference of Platform or Tool

You can tell which platform or tool you want to use when stating your requirements.

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

Usage

NAME
    startup.py - We are a software startup comprised of AI. By investing in us, you are empowering a future filled with limitless possibilities.

SYNOPSIS
    startup.py IDEA <flags>

DESCRIPTION
    We are a software startup comprised of AI. By investing in us, you are empowering a future filled with limitless possibilities.

POSITIONAL ARGUMENTS
    IDEA
        Type: str
        Your innovative idea, such as "Creating a snake game."

FLAGS
    --investment=INVESTMENT
        Type: float
        Default: 3.0
        As an investor, you have the opportunity to contribute a certain dollar amount to this AI company.
    --n_round=N_ROUND
        Type: int
        Default: 5

NOTES
    You can also use flags syntax for POSITIONAL ARGUMENTS

Code walkthrough

from metagpt.software_company import SoftwareCompany
from metagpt.roles import ProjectManager, ProductManager, Architect, Engineer

async def startup(idea: str, investment: float = 3.0, n_round: int = 5):
    """Run a startup. Be a boss."""
    company = SoftwareCompany()
    company.hire([ProductManager(), Architect(), ProjectManager(), Engineer()])
    company.invest(investment)
    company.start_project(idea)
    await company.run(n_round=n_round)

You can check examples for more details on single role (with knowledge base) and LLM only examples.

QuickStart

It is difficult to install and configure the local environment for some users. The following tutorials will allow you to quickly experience the charm of MetaGPT.

Try it on Huggingface Space

Citation

For now, cite the Arxiv paper:

@misc{hong2023metagpt,
      title={MetaGPT: Meta Programming for Multi-Agent Collaborative Framework},
      author={Sirui Hong and Xiawu Zheng and Jonathan Chen and Yuheng Cheng and Jinlin Wang and Ceyao Zhang and Zili Wang and Steven Ka Shing Yau and Zijuan Lin and Liyang Zhou and Chenyu Ran and Lingfeng Xiao and Chenglin Wu},
      year={2023},
      eprint={2308.00352},
      archivePrefix={arXiv},
      primaryClass={cs.AI}
}

Contact Information

If you have any questions or feedback about this project, please feel free to contact us. We highly appreciate your suggestions!

We will respond to all questions within 2-3 business days.

Demo

demo-cli-blackjack-compress.mp4

Join us

📢 Join Our Discord Channel! https://discord.gg/ZRHeExS6xv

Looking forward to seeing you there! 🎉

More Repositories

1

HowToLiveLonger

程序员延寿指南 | A programmer's guide to live longer
27,114
star
2

scrapy-examples

Multifarious Scrapy examples. Spiders for alexa / amazon / douban / douyu / github / linkedin etc.
Python
3,061
star
3

one-python

We don't need a lot of libraries. We just need the best ones. | Unofficial recommended first choice.
712
star
4

awesome-awesome-awesome

An awesome-awesome list.
280
star
5

source-insight-vim

source-insight-like vim.
Vim Script
91
star
6

openflow_translation

OpenFlow中文翻译工作。
50
star
7

cowry

Private plage, storing all my cowries.
Python
46
star
8

MetaGPT-docs

TypeScript
40
star
9

HowToLiveWithCovid

40
star
10

google-scholar-crawler

Crawl google scholar with least code.
Python
38
star
11

path-to-cs-engineer

(金色传说)程序员之路
34
star
12

coding_marathon

12
star
13

python-dnspod-ddns

a python client for dnspod's ddns
Python
7
star
14

citation-graph

Citations are like a graph, follow the history, citations show how knowledge inherited.
HTML
7
star
15

anwcl.about

My personal site's about page.
JavaScript
6
star
16

c-algorithm

Implement C algorithms with highest performance
C
5
star
17

grpc-python-demos

Python
5
star
18

crawl_imgs

Use 128 processes to crawl imgs.
Python
5
star
19

recsys-on-deeplearning

Awesome papers / frameworks / libraries focus on recsys on deep learning.
4
star
20

mini-games

收集好玩的迷你游戏以及相关内容(视频、站点)等
4
star
21

github_marathon

marathon for 365 days!
3
star
22

scrapy-general-spider

Create spider by writing a simple config.
Python
2
star
23

scrapy-live-portal

Python
2
star
24

lightmr

Lightweight map reduce framework.
Python
2
star
25

MetaGPT-demos

1
star
26

psu

Python shell-like utilities.
Python
1
star
27

dotfiles

Shell
1
star
28

china-coder-ranking

1
star
29

python-crawlers

About crawlers written in python.
1
star
30

geekan.github.com

a personal static website. (now redirect to www.anwcl.com)
CSS
1
star
31

scrapy-css-rule-spider

Python
1
star
32

django1.5-bootstrap3-templates

updated django-registration bootstrap templates
Python
1
star
33

css-rules

All public css rules.
Python
1
star