
Building a Virtual Software Company with MetaGPT A Step-by-Step Guide
MetaGPT is a powerful multi-agent framework introduced by brilliant minds from The Chinese University of Hong Kong, University of California, Berkeley, and DeepWisdom, led by Sirui Hong. It’s designed to simulate real-world software development teams, enabling agents like product managers, engineers, and architects to work together autonomously.
If you're new to multi-agent systems, you might want to check out our previous blog on Multi-Agent Frameworks, where we explored how these frameworks help build robust and multidimensional solutions.
MetaGPT offers both a command-line interface and a Chainlit-based UI for easier interaction. In this blog, we’ll walk through both options.
Key Features of MetaGPT
- Shared Workspace
- Task Queue
- Planner
- Prebuilt Tools (e.g., web browser, code interpreter, RAG, etc.)
- Diagram Generation (ER diagrams, etc.)
- Documentation Output (PRDs, user stories, competitive analyses)
- Prebuilt Roles (Team Leader, Product Manager, Architect, Engineer, etc.)
- Hierarchical Agent Orchestration
- Fully Customizable
Getting Started
You can get started with MetaGPT in two ways:
- Install via pip (quick and simple)
- Install from source (ideal for customization)
Create a Virtual Environment
Using Conda:
conda create -n metagpt python=3.9 && conda activate metagpt
Using venv
:
python -m venv metagpt && source metagpt/bin/activate
If you're on VS Code:
- Open Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
) - Search for "Python: Select Interpreter"
- Click “Create New Virtual Environment”
- Choose
conda
orvenv
- Pick your Python version (3.9–3.11 recommended)
Install via pip
MetaGPT supports Python 3.9 to 3.11 (for version 0.8.2
and below), for more details checkout https://pypi.org/project/metagpt/.
pip install metagpt
Today chainlit is not supported if you install via pip. If you want to use Chainlit, please install from source.
If you face dependency issues, then either you can adjust your OS environment or try installing lower version of MetaGPT, for example:
pip install metagpt==0.8.1
Install from Source
git clone [email protected]:FoundationAgents/MetaGPT.git
cd MetaGPT
After cloning install metaGPT in editable mode:
pip install -e .
The reason being any changes you make to the source code will be immediately reflected in your environment, allowing for flexible customization.
After running the above command you should be able to access metagpt
command in your terminal and if not then checkout lower version of MetaGPT, for example
git checkout v0.8.1
Setup Configuration
Initialize the config file:
metagpt --init-config
This will generate a config at ~/.metagpt/config2.yaml
. Customize it as needed. For reference, see the example config.
Below is a sample config of Azure AI foundary:
llm:
api_type: "azure"
base_url: "https://<service-name>.services.ai.azure.com"
api_key: "<your-api-key>"
api_version: "2024-10-21"
model: "<deploy-model-name>"
Or you can directly modify the config located at MetaGPT/config/config2.yaml
.
Running Your Software Company
MetaGPT's main interface is command line but supports a Chainlit UI for more interactive experiences.
Option 1: Command Line Interface
metagpt "Design a web app for a company that sells shoes"
All outputs—including documents and code—will be generated under the ./workspace
directory.
Option 2: Chainlit UI (Manual Setup Required)
⚠️ Note: As of June 7, 2025, the official Chainlit UI support is deprecated. You’ll need to modify some files manually to get it working.
Install Chainlit
Using pip:
pip install chainlit
Using conda:
conda install -c conda-forge chainlit
Modify the Chainlit UI Setup
Modify file init_setup.py
located at MetaGPT/examples/ui_with_chainlit/
:
from metagpt.environment import Environment
from metagpt.logs import logger, set_llm_stream_logfunc
from metagpt.roles import Role
from metagpt.utils.common import any_to_name
+from metagpt.environment.mgx.mgx_env import MGXEnv
import chainlit as cl
def log_llm_stream_chainlit(msg):
cl.run_sync(cl.Message(content=msg).send())
set_llm_stream_logfunc(func=log_llm_stream_chainlit)
- class ChainlitEnv(Environment):
+ class ChainlitEnv(MGXEnv):
...
+ async def ask_human(self, question: str, sent_from: Role = None) -> str:
+ rsp = await cl.AskUserMessage(content=question, timeout=120).send()
+ return "Human response: " + rsp['output']
What we change here is:
- This file responsible to create the MetaGPT environment for Chainlit, environment give place for agents/tools/human to interact with each other.
- Instead of using default
Environment
, we useMGXEnv
which is advanced version ofEnvironment
that supports more features like planning, orchestration etc. - We override the
ask_human
method to use Chainlit'sAskUserMessage
, which allows agents to ask questions to humans and get responses in a Chainlit UI.
Then, modify app.py
in the same folder:
from init_setup import ChainlitEnv
@cl.on_message
async def startup(message: cl.Message) -> None:
idea = message.content
company = Team(env=ChainlitEnv())
- company.hire([
- ProductManager(),
- Architect(),
- ProjectManager(),
- Engineer(n_borg=5, use_code_review=True),
- QaEngineer(),
- ])
+ company.hire([
+ TeamLeader(),
+ ProductManager(),
+ Architect(),
+ ProjectManager(),
+ Engineer2(),
+ DataAnalyst(),
+ ])
What we change here is:
- We hire
RoleZero
roles instead of base roles, which are more flexible, independent and can handle complex tasks.
Run the app:
chainlit run MetaGPT/examples/ui_with_chainlit/app.py
Open your browser at http://localhost:8000
, and start by typing your project idea into the input box.
If icons/images don’t load properly, it's expected—feel free to ignore.
Role Customization
MetaGPT supports multiple roles. You can explore them under metagpt/roles/
. There are two types:
- Base Roles – suited for specific, predictable tasks.
- Role Zero – dynamic, multi-capability roles.
Available Roles
- TeamLeader: Plans tasks, assigns work, and tracks progress.
- Engineer2: Can edit, browse, review code, deploy, and use Git.
- Product Manager: Writes PRDs, user stories, and manages team.
- Architect: Designs system architecture.
- Project Manager: Breaks down tasks from PRD and design docs.
- swe_agent: A issue resolver agent, can fix github issues (can access github issues) or any bug in the codebase.
- Data Analyst: Generates reports and can manage data tasks.
- assistant: A general-purpose assistant for various tasks.
- customer_service: Handles customer inquiries and support.
- engineer: A basic engineer role for coding tasks.
- invoice_ocr_assistant: Processes invoices using OCR.
- product_manager: Manages product requirements and specifications and can write PRDs.
- project_manager: Oversees project timelines and deliverables.
- qa_engineer: Write tests and perform quality assurance in multiple rounds.
- researcher: Conducts research and generate reports, visit websites, collect links and summarize information.
- sales: Honest sales man, with good communication skills and handle customer inquiries.
- searcher: Sole responsibility is to search the web and summarize information.
- teacher: Language teacher, can write teaching plans, tutorials, and answer questions.
- tutorial_assistant: Assists in writing tutorials and educational content.
- data_interpreter: Analyzes and interprets data, can write analysis code.
Built-In Tools
- metagpt_text_to_image: Specialized tool for generating images from text prompts.
- openai_text_to_embedding: Generates embeddings for text using OpenAI's API, mainly used for semantic search.
- openai_text_to_image: Generates images from text prompts using OpenAI's API.
- prompt_writer: Assists in writing prompts for various tasks, such as wikihow.
- search_engine_bing: Bing search engine integration for web searches.
- search_engine_ddg: DuckDuckGo search engine integration for web searches.
- search_engine_googleapi: Google search engine integration for web searches.
- search_engine_meilisearch: Meilisearch integration for fast and relevant search results.
- tool_recommend: Recommends tools based on the task at hand.
- web_browser_engine_playwright: A web browser automation tool using Playwright, allowing agents to interact with web pages.
- web_browser_engine: A web browser automation tool using Selenium, allowing agents to interact with web pages.
- web_browser_engine_selenium: A web browser automation tool using Selenium, allowing agents to interact with web pages.
Actions
Actions represent what agents can do (Standard Operating Procedures).
- analyze_requirements: Analyzes requirements and generates insights.
- debug_error: Debugs errors in code and provides solutions.
- design_api: Designs APIs based on requirements.
- design_api_review: Reviews API designs based on given requirements.
- generate_questions: Generates questions based on requirements or documents.
- invoice_ocr: Processes invoices using OCR technology.
- prepare_interview: Prepares for interviews by generating questions and topics.
- research: Conducts research on a given topic and generates reports.
- run_code: Executes code snippets and returns results.
- search_and_summarize: Searches the web and summarizes information.
- summarize_code: Summarizes code snippets and provides insights.
- write_code: Writes code based on requirements or specifications.
- write_code_review: Reviews code and provides feedback.
- write_docstring: Generates docstrings for code functions and classes.
- write_prd: Writes Product Requirements Documents (PRDs) based on requirements.
- write_prd_review: Reviews PRDs and provides feedback.
- write_teaching_plan: Creates teaching plans based on educational requirements.
- write_plan: Writes plans for projects or tasks based on requirements.
- evaluate_framework: Evaluates frameworks based on requirements and provides recommendations.
- write_framework: Writes framework specifications based on requirements.
- evaluate_trd: Evaluates Technical Requirements Documents (TRDs) based on requirements and provides feedback.
- write_trd: Writes Technical Requirements Documents (TRDs) based on requirements.
These actions define the capabilities each role can execute, such as writing PRDs, designing systems, or performing analysis.
Conclusion
MetaGPT stands out in the rapidly evolving world of AI-powered software development. By mimicking the structure of real-world teams and allowing deep customization of agents and their actions, it brings powerful automation to product ideation and engineering processes. Whether you're looking to spin up a virtual software team for a side project or exploring advanced use cases in enterprise environments, MetaGPT offers a compelling and extensible foundation.
Give it a spin—and let your agents do the heavy lifting.