The Multi-Role Meta Programming Framework
Project description
MetaGPT: Multi-Agent Meta Programming Framework
Assign different roles to GPTs to form a collaborative software entity for complex tasks.
- MetaGPT takes a one line requirement as input and outputs user stories / competitive analysis / requirements / data structures / APIs / documents, etc.
- Internally, MetaGPT includes product managers / architects / project managers / engineers. It provides the entire process of a software company along with carefully orchestrated SOPs.
Code = SOP(Team)
is the core philosophy. We materialize SOP and apply it to teams composed of LLMs.
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
It requires around $0.2 (GPT-4 api's costs) to generate one example with analysis and design, around $2.0 to a full project.
Installation
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
Installation by Docker
# Step 1: Download metagpt official image and prepare config.yaml
docker pull metagpt/metagpt:v0.1
mkdir -p /opt/metagpt/config && docker run --rm metagpt/metagpt:v0.1 cat /app/metagpt/config/config.yaml > /opt/metagpt/config/config.yaml
vim /opt/metagpt/config/config.yaml # Change the config
# Step 2: Run metagpt image
docker run --name metagpt -d \
-v /opt/metagpt/config:/app/metagpt/config \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:v0.1
# Step 3: Access the metagpt container
docker exec -it metagpt /bin/bash
# Step 4: Play in the container
cd /app/metagpt
python startup.py "Write a cli snake game"
The command docker run ...
do the following things:
- Start metagpt container with default command
tail -f /dev/null
- Map host directory
/opt/metagtp/config
to container directory/app/metagpt/config
- Map host directory
/opt/metagpt/workspace
to container directory/app/metagpt/workspace
Build image by yourself
# You can also build metagpt image by yourself.
cd metagpt && docker build --network host -t metagpt:v0.1 .
Configuration
- Configure your
OPENAI_API_KEY
in any ofconfig/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
python startup.py "Write a cli snake game"
After running the script, you can find your new project in the workspace/
directory.
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.
Contact Information
If you have any questions or feedback about this project, please feel free to contact us. We highly appreciate your suggestions!
- Email: alexanderwu@fuzhi.ai
- GitHub Issues: For more technical inquiries, you can also create a new issue in our GitHub repository.
We will respond to all questions within 2-3 business days.
Demo
https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file metagpt-0.1.tar.gz
.
File metadata
- Download URL: metagpt-0.1.tar.gz
- Upload date:
- Size: 97.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b0a31357f6189b3a312e3e29dd0695ae7b663531cccdc54eeb671b41783f0cb |
|
MD5 | 4fe52b03d97f66dd1550698b879810ec |
|
BLAKE2b-256 | 4f126d53ebb4a3b7faacbe66db9a54c6b4c7a85f0e669367c45b6efabf96cfde |
File details
Details for the file metagpt-0.1-py3.9.egg
.
File metadata
- Download URL: metagpt-0.1-py3.9.egg
- Upload date:
- Size: 315.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0762211c251305a3634a2b772922c66efb461e87ddb3572d6ae0515934fae867 |
|
MD5 | b07f8bca51911fbfd04f9346a3dda0f2 |
|
BLAKE2b-256 | de01cf015d0eadbb9335c6a16ff490ccbcbf3910e19212302c1499b612a6bc51 |
File details
Details for the file metagpt-0.1-py3-none-any.whl
.
File metadata
- Download URL: metagpt-0.1-py3-none-any.whl
- Upload date:
- Size: 140.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 109943748105b8e5cff73cbfcb604f956a73c56bb5a6246710fcaa22fd338a3b |
|
MD5 | e7bb38f972599692e4e313f7acdf62c7 |
|
BLAKE2b-256 | 0780e11d464a1466b9a3636ee416cde23506b0c096e746a338ec297e4f98809b |