MetaGPT
🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
Top Related Projects
🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
JARVIS, a system to connect LLMs with ML community. Paper: https://arxiv.org/pdf/2303.17580.pdf
Examples and guides for using the OpenAI API
🦜🔗 Build context-aware reasoning applications
Quick Overview
MetaGPT is an open-source project that aims to create a multi-agent framework for AI-driven software development. It leverages large language models to simulate a collaborative software development team, automating various stages of the development process from requirement analysis to code generation and testing.
Pros
- Automates multiple stages of software development, potentially increasing efficiency
- Provides a novel approach to AI-assisted programming and project management
- Offers flexibility in customizing roles and workflows
- Can generate comprehensive project artifacts, including PRD, design documents, and code
Cons
- May require significant computational resources due to multiple LLM instances
- The quality and consistency of generated code and documents may vary
- Potential over-reliance on AI-generated content could lead to overlooking human expertise
- Still in early stages of development, which may result in limitations or instabilities
Code Examples
- Creating a MetaGPT instance:
from metagpt.software_company import SoftwareCompany
company = SoftwareCompany()
company.hire([
"ProductManager",
"Architect",
"ProjectManager",
"Engineer",
"QaEngineer"
])
- Running a project:
company.start_project("Create a web-based task management application")
- Customizing roles:
from metagpt.roles import Role
class CustomEngineer(Role):
def __init__(self, name="CustomEngineer", profile="I am a specialized engineer"):
super().__init__(name, profile)
self.set_actions([CustomAction1(), CustomAction2()])
company.hire([CustomEngineer()])
Getting Started
To get started with MetaGPT:
-
Install the package:
pip install metagpt
-
Set up your OpenAI API key:
import os os.environ["OPENAI_API_KEY"] = "your-api-key-here"
-
Create a simple project:
from metagpt.software_company import SoftwareCompany company = SoftwareCompany() company.hire(["ProductManager", "Architect", "ProjectManager", "Engineer"]) company.start_project("Build a simple calculator app")
Note: Ensure you have sufficient API credits and computational resources before running large projects.
Competitor Comparisons
🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
Pros of MetaGPT
- More comprehensive documentation and examples
- Larger community and more frequent updates
- Broader scope of features and capabilities
Cons of MetaGPT
- Higher complexity, potentially steeper learning curve
- May require more computational resources
- Less focused on specific use cases
Code Comparison
MetaGPT:
from metagpt.roles import ProjectManager, ProductManager, Architect, Engineer
from metagpt.team import Team
team = Team()
team.hire([ProjectManager(), ProductManager(), Architect(), Engineer()])
team.run(idea)
FoundationAgents:
from foundationagents import Agent, Team
team = Team()
team.add_agent(Agent("Project Manager"))
team.add_agent(Agent("Developer"))
team.execute_task(task_description)
The code comparison shows that MetaGPT offers more specialized roles out-of-the-box, while FoundationAgents provides a more flexible, generic approach to agent creation and team composition.
Pros of TaskMatrix
- More focused on task decomposition and execution
- Simpler architecture, potentially easier to understand and implement
- Designed for general-purpose task solving across various domains
Cons of TaskMatrix
- Less comprehensive documentation and examples
- Fewer built-in tools and integrations
- Limited support for complex, multi-stage projects
Code Comparison
TaskMatrix:
def decompose_task(task):
subtasks = llm.generate_subtasks(task)
return [Subtask(description=st) for st in subtasks]
def execute_task(task):
subtasks = decompose_task(task)
for subtask in subtasks:
subtask.execute()
MetaGPT:
class SoftwareCompany:
def __init__(self, idea: str, investment: float = 3.0):
self.idea = idea
self.investment = investment
self.environment = Environment(self.investment)
self.staff = [
ProductManager(),
Architect(),
ProjectManager(),
Engineer(),
]
The code snippets highlight the different approaches: TaskMatrix focuses on task decomposition and execution, while MetaGPT simulates a software development process with multiple roles and stages.
JARVIS, a system to connect LLMs with ML community. Paper: https://arxiv.org/pdf/2303.17580.pdf
Pros of JARVIS
- More comprehensive multimodal capabilities, including vision and speech
- Stronger focus on real-world interaction and embodied AI applications
- More extensive documentation and examples for implementation
Cons of JARVIS
- Steeper learning curve due to complexity of the system
- Less emphasis on software development automation compared to MetaGPT
- Potentially higher computational requirements for full functionality
Code Comparison
MetaGPT example:
from metagpt.roles import ProjectManager, ProductManager, Architect, Engineer
team = [ProjectManager(), ProductManager(), Architect(), Engineer()]
company = Company(members=team)
company.run(idea)
JARVIS example:
from jarvis import JARVIS, VisionModule, SpeechModule
jarvis = JARVIS()
jarvis.add_module(VisionModule())
jarvis.add_module(SpeechModule())
jarvis.process_input(user_input)
While MetaGPT focuses on simulating a software development team, JARVIS provides a more modular approach for building multimodal AI assistants. MetaGPT's code emphasizes role-based collaboration, whereas JARVIS allows for flexible module integration for various AI capabilities.
Examples and guides for using the OpenAI API
Pros of OpenAI Cookbook
- Comprehensive collection of practical examples and tutorials
- Direct integration with OpenAI's API and models
- Regularly updated with new features and best practices
Cons of OpenAI Cookbook
- Focused solely on OpenAI's offerings, limiting broader AI applications
- Less emphasis on autonomous agent development
- Lacks a unified framework for complex AI system development
Code Comparison
MetaGPT example (agent-based approach):
from metagpt.roles import ProjectManager, ProductManager, Architect, Engineer
team = [ProjectManager(), ProductManager(), Architect(), Engineer()]
company = Company(members=team)
company.run(idea)
OpenAI Cookbook example (direct API usage):
import openai
response = openai.Completion.create(
engine="text-davinci-002",
prompt="Translate the following English text to French: '{}'",
max_tokens=60
)
MetaGPT focuses on creating autonomous AI agents that collaborate to complete complex tasks, while OpenAI Cookbook provides direct examples of API usage for specific applications. MetaGPT offers a more abstract, agent-based approach to AI development, whereas OpenAI Cookbook emphasizes practical, immediate implementation of AI capabilities using OpenAI's services.
🦜🔗 Build context-aware reasoning applications
Pros of langchain
- More mature and widely adopted project with a larger community
- Extensive documentation and examples for various use cases
- Supports multiple programming languages (Python, JavaScript, etc.)
Cons of langchain
- Can be complex for beginners due to its extensive feature set
- May require more setup and configuration for specific tasks
- Potentially higher resource usage for simple applications
Code Comparison
MetaGPT:
from metagpt.roles import ProjectManager, ProductManager, Architect, Engineer
team = [ProjectManager(), ProductManager(), Architect(), Engineer()]
company = Company(members=team)
company.run(idea)
langchain:
from langchain import OpenAI, LLMChain, PromptTemplate
llm = OpenAI(temperature=0.9)
prompt = PromptTemplate(input_variables=["product"], template="What is a good name for a company that makes {product}?")
chain = LLMChain(llm=llm, prompt=prompt)
print(chain.run("colorful socks"))
Summary
MetaGPT focuses on simulating a software development team with predefined roles, while langchain provides a more flexible framework for building language model applications. MetaGPT may be better suited for end-to-end software development tasks, whereas langchain offers more versatility for various NLP applications.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
MetaGPT: The Multi-Agent Framework
[ En | ä¸ | Fr | æ¥ ] Assign different roles to GPTs to form a collaborative entity for complex tasks.
News
ð Mar. 10, 2025: ð mgx.dev is the #1 Product of the Week on @ProductHunt! ð
ð Mar. 4, 2025: ð mgx.dev is the #1 Product of the Day on @ProductHunt! ð
ð Feb. 19, 2025: Today we are officially launching our natural language programming product: MGX (MetaGPT X) - the world's first AI agent development team. More details on Twitter.
ð Feb. 17, 2025: We introduced two papers: SPO and AOT, check the code!
ð Jan. 22, 2025: Our paper AFlow: Automating Agentic Workflow Generation accepted for oral presentation (top 1.8%) at ICLR 2025, ranking #2 in the LLM-based Agent category.
ðð Earlier news
Software Company as Multi-Agent System
- 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-Agent Schematic (Gradually Implementing)
Get Started
Installation
Ensure that Python 3.9 or later, but less than 3.12, is installed on your system. You can check this by using:
python --version
.
You can use conda like this:conda create -n metagpt python=3.9 && conda activate metagpt
pip install --upgrade metagpt
# or `pip install --upgrade git+https://github.com/geekan/MetaGPT.git`
# or `git clone https://github.com/geekan/MetaGPT && cd MetaGPT && pip install --upgrade -e .`
Install node and pnpm before actual use.
For detailed installation guidance, please refer to cli_install or docker_install
Configuration
You can init the config of MetaGPT by running the following command, or manually create ~/.metagpt/config2.yaml
file:
# Check https://docs.deepwisdom.ai/main/en/guide/get_started/configuration.html for more details
metagpt --init-config # it will create ~/.metagpt/config2.yaml, just modify it to your needs
You can configure ~/.metagpt/config2.yaml
according to the example and doc:
llm:
api_type: "openai" # or azure / ollama / groq etc. Check LLMType for more options
model: "gpt-4-turbo" # or gpt-3.5-turbo
base_url: "https://api.openai.com/v1" # or forward url / other llm url
api_key: "YOUR_API_KEY"
Usage
After installation, you can use MetaGPT at CLI
metagpt "Create a 2048 game" # this will create a repo in ./workspace
or use it as library
from metagpt.software_company import generate_repo
from metagpt.utils.project_repo import ProjectRepo
repo: ProjectRepo = generate_repo("Create a 2048 game") # or ProjectRepo("<path>")
print(repo) # it will print the repo structure with files
You can also use Data Interpreter to write code:
import asyncio
from metagpt.roles.di.data_interpreter import DataInterpreter
async def main():
di = DataInterpreter()
await di.run("Run data analysis on sklearn Iris dataset, include a plot")
asyncio.run(main()) # or await main() in a jupyter notebook setting
QuickStart & Demo Video
- Try it on MetaGPT Huggingface Space
- Matthew Berman: How To Install MetaGPT - Build A Startup With One Prompt!!
- Official Demo Video
https://github.com/user-attachments/assets/888cb169-78c3-4a42-9d62-9d90ed3928c9
Tutorial
- ð Online Document
- ð» Usage
- ð What can MetaGPT do?
- ð How to build your own agents?
- ð§âð» Contribution
- ð Use Cases
- â FAQs
Support
Discord Join US
ð¢ Join Our Discord Channel! Looking forward to seeing you there! ð
Contributor form
ð Fill out the form to become a contributor. We are looking forward to your participation!
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@deepwisdom.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.
Citation
To stay updated with the latest research and development, follow @MetaGPT_ on Twitter.
To cite MetaGPT in publications, please use the following BibTeX entries.
@inproceedings{hong2024metagpt,
title={Meta{GPT}: Meta Programming for A Multi-Agent Collaborative Framework},
author={Sirui Hong and Mingchen Zhuge and Jonathan Chen and Xiawu Zheng 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 and J{\"u}rgen Schmidhuber},
booktitle={The Twelfth International Conference on Learning Representations},
year={2024},
url={https://openreview.net/forum?id=VtmBAGCN7o}
}
For more work, please refer to Academic Work.
Top Related Projects
🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
JARVIS, a system to connect LLMs with ML community. Paper: https://arxiv.org/pdf/2303.17580.pdf
Examples and guides for using the OpenAI API
🦜🔗 Build context-aware reasoning applications
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot