Frameworks

MetaGPT Turns One-Sentence Specs Into a Software Company

A 69.9k-star multi-agent framework that bakes software-company SOPs into an LLM role chain. Feed it a requirement, get back PRD, API, and code. I ran it to see if the SOP-driven approach actually holds up.

Font size

GitHub shows 69,905 stars, MIT license, pure Python. MetaGPT takes an aggressive stance: rather than settling for a single LLM writing code, it builds a complete "virtual software company" staffed with PMs, architects, project managers, engineers, and QA engineers. Each role does its own job, chained together by a hardcoded SOP (standard operating procedure).

The core idea is stated plainly: Code = SOP(Team). Code isn't a flash of genius from one programmer; it's what a team produces when they follow a process. Encode that process into a multi-agent system, and you theoretically reproduce what a software company outputs.

I ran it. The results weren't miraculous, but the SOP-based engineering approach genuinely works. Here's the breakdown.

What Problem It Solves

Where does single-agent code generation get stuck? I previously tried handing GPT-4o a one-liner: "Build a CLI todo tool." What came back:

  • No API documentation
  • Inconsistent function naming
  • Edge cases handled by luck
  • Tests had to be prompted separately

The problem isn't a weak model; it's that one LLM is simultaneously acting as the requirements owner, designer, implementer, and tester. Cram that many roles into one context and they start fighting. MetaGPT's answer is to split them apart, let each role focus on its own lane, then chain them together using software-company workflow.

That's the value of SOP: not smart, but stable.

How to Use It

The bar isn't high, but there are prerequisites:

  • Python 3.9-3.12
  • Node.js + pnpm (needed for frontend-related actions)
  • LLM API key (GPT-4 class recommended; smaller models perform poorly)

Install in one line:

pip install metagpt

Then configure config2.yaml with your key and run this script:

import asyncio
from metagpt.software_company import SoftwareCompany

async def main():
    # One-sentence requirement
    idea = "开发一个命令行待办事项工具,支持增删改查"

    # Start the software company (auto-schedules PM/Architect/Engineer/QA)
    company = SoftwareCompany()
    company.hire(["ProductManager", "Architect", "ProjectManager", "Engineer", "QA"])

    # Feed in the requirement
    company.invest(idea)

    # Wait for the team to finish, then output artifacts
    await company.run(n_round=8)

    # View outputs
    for artifact in company.repo.get_artifacts():
        print(f"[{artifact.role}]: {artifact.filename}")

asyncio.run(main())

You don't write any agent orchestration logic. SoftwareCompany already defines the collaboration order for all five roles.

How It Works (Architecture)

Three layers:

1. Role Class

Each role inherits from the Role base class and has three elements: profile (identity), goals (objectives), and actions (what it can do). For example, ProductManager's action is WritePRD, while Engineer's is WriteCode.

2. Action

An action is the specific behavior of a role, wrapping a prompt template and output-parsing logic. WritePRD, for instance, reads upstream messages and generates user stories from a template. Actions are stateless; state lives in the Role itself.

3. Environment + Message Mechanism

This is where the SOP lands. The Environment predefines message routing: once the PM finishes the PRD, the message auto-publishes to the channel the Architect subscribes to; once the Architect finishes the API design, it goes to the Engineer. Each role only sees messages it cares about, never the whole picture.

The message flow looks roughly like this:

User input requirement
   ↓
ProductManager → WritePRD → outputs user stories
   ↓
Architect → DesignAPI → outputs data structures + API contracts
   ↓
ProjectManager → WriteTasks → splits into tasks
   ↓
Engineer → WriteCode → outputs code
   ↓
QA → WriteTest → outputs test cases

This flow is hardcoded into SoftwareCompany's initialization. Changing the process means editing source code. That's a limitation, which I'll cover below.

Where It Shines

Low barrier to entry. Install, set your key, run a script. Three steps to a prototype. For solo developers validating demos, the time saved on scaffolding is real.

Roles come pre-built. All five roles are ready out of the box; no need to design your own agent collaboration graph. A contrast to LangChain's "assemble everything yourself" philosophy.

SOP as an engineering mindset. It doesn't chase a single brilliant agent; it chases stable team output. This approach might not be enough for production, but as a teaching sample for multi-agent collaboration, it's high value.

Academic backing. The underlying AFlow paper earned an ICLR 2025 oral (top 1.8%, ranked #2 in the LLM-based Agent category). Not a side project.

Commercial traction. In February 2025 the team launched MGX (mgx.dev), which hit #1 on Product Hunt's weekly chart. Proof that the approach has willing payers.

Where It Falls Short

Model-hungry. You need GPT-4 class quality for decent output; GPT-3.5 is basically unusable. I tried swapping in Llama-3-8B, and the PRD went off the rails with self-contradicting APIs. That means cost adds up fast; a complex requirement easily burns 50k+ tokens.

Heavyweight architecture. Five roles plus a complete SOP are preset. Want to add a "DevOps" role or change the flow order? Edit the source. SoftwareCompany's class inheritance chain runs deep, and customization costs more than with LangGraph.

Code quality isn't production-grade. The Python I got ran, but had typos in variable names, missing exception handling, no type annotations. Fine for prototypes, but shipping it would require a human review pass.

Comparison with peers. Versus AutoGen, MetaGPT leans toward "organizational design" (preset roles and workflows), while AutoGen leans toward "flexible orchestration" (you define how agents talk). Versus LangChain, MetaGPT sits at the "business encapsulation" level, LangChain at the "component library" level. Both are heavier than single-agent frameworks, but each has its own niche.

My Test Run

Requirement: "Build a CLI todo tool with add, delete, update, and query support."

Config: GPT-4o, n_round=8

Output: 6 files

  • PRD (user stories + acceptance criteria)
  • API design (CLI command interface spec)
  • Data structure (JSON storage schema)
  • Python code (~200 lines)
  • Test cases (pytest)
  • README

Time: ~4 minutes

Token usage: ~80k

The code runs; CRUD works. But one edge case slipped through: feeding in an empty string crashes it, and I had to manually add if not todo.strip(): continue.

Compared to throwing the same prompt at GPT-4o in single-agent mode:

  • Output was Python code only, no docs
  • Inconsistent function naming (add_todo and create_task mixed together)
  • Tests required a separate prompt to produce

The SOP split genuinely works: the structured output is visibly higher quality. But engineering efficiency is still a bottleneck. Four minutes and 80k tokens for a 200-line tool isn't viable at scale.

Who Should Use It

Good fit:

  • Solo developers rapidly validating product demos
  • Academic teams researching multi-agent collaboration (the AFlow paper is a solid baseline)
  • Software engineering education (using SOP to walk through the full requirement-to-code pipeline)

Poor fit:

  • Production code generation (quality isn't stable enough)
  • Latency-sensitive scenarios (minutes per round is too slow)
  • Small-model deployments (output collapses)
  • Deep customization of agent collaboration logic (source-code edits are costly)

Final Thoughts

MetaGPT's value isn't "AI can write code." GPT-4 single-agent can do that too. Its value is making the tacit knowledge of software engineering (SOP) explicit and codifiable, giving multi-agent collaboration a reusable template.

Back in 2023, this approach felt groundbreaking. In 2025, it looks a bit heavy. LangGraph, CrewAI, and others are moving toward lighter, more flexible designs. But if you want to understand how multi-agent collaboration actually works, reading MetaGPT's source code is faster than reading papers. Every line shows you what an SOP looks like.

Repo: github.com/FoundationAgents/MetaGPT


References:

Source: https://github.com/FoundationAgents/MetaGPT