foundationagents/metagpt
🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
Multi-agent AI framework for collaborative software development
User requirements flow through specialized AI agents that collaborate to produce software artifacts, with each agent contributing domain expertise and passing results to the next stage.
Under the hood, the system uses 4 feedback loops, 5 data pools, 5 control points to manage its runtime behavior.
Structural Verdict
A 12-component ml inference with 16 connections. 913 files analyzed. Highly interconnected — components depend on each other heavily.
How Data Flows Through the System
User requirements flow through specialized AI agents that collaborate to produce software artifacts, with each agent contributing domain expertise and passing results to the next stage.
- Requirements Input — User provides natural language requirements or task descriptions
- Product Planning — ProductManager analyzes requirements and creates product requirements document (config: llm.model, llm.api_type)
- Architecture Design — Architect designs system structure, APIs, and data models (config: llm.model, llm.api_type)
- Project Management — ProjectManager breaks down work into tasks and manages execution (config: llm.model)
- Code Implementation — Engineers write code based on architecture and requirements (config: llm.model, llm.api_type)
- Quality Assurance — QaEngineer tests and validates the implemented solution (config: llm.model)
- Output Generation — Complete software project with documentation generated in workspace
System Behavior
How the system actually operates at runtime — where data accumulates, what loops, what waits, and what controls what.
Data Pools
Persistent memory for agent conversations and context
Vector database for RAG document retrieval
Generated code, documentation, and project artifacts
Bot observations, inventory, and world blocks
Screenshots and UI element hierarchies
Feedback Loops
- Code Review Loop (retry, balancing) — Trigger: Code quality issues detected. Action: Engineer revises code based on QA feedback. Exit: Code passes quality checks.
- Multi-Round Agent Collaboration (convergence, reinforcing) — Trigger: Team.run() called with n_round parameter. Action: Agents exchange messages and refine outputs. Exit: Max rounds reached or task complete.
- Workflow Optimization (training-loop, reinforcing) — Trigger: Optimizer starts evolutionary process. Action: Generate new workflow variants and test performance. Exit: Convergence criteria met.
- Android Learning Loop (training-loop, reinforcing) — Trigger: Learning stage activated. Action: Observe UI, take actions, refine operation docs. Exit: Task successfully learned or max attempts.
Delays & Async Processing
- LLM API Calls (async-processing, ~variable) — Agents wait for LLM responses before proceeding
- Minecraft Bot Ticks (rate-limit, ~50ms per tick) — Bot actions throttled to game tick rate
- Android Action Delays (async-processing, ~configurable) — Wait for UI changes after each action
- File I/O Operations (async-processing, ~variable) — Code generation and document creation delays
Control Points
- LLM Model Selection (env-var) — Controls: Which AI model powers agent reasoning. Default: gpt-4-turbo
- Investment Budget (runtime-toggle) — Controls: Maximum cost for LLM API usage. Default: 3.0
- Max Rounds (runtime-toggle) — Controls: Number of agent collaboration iterations. Default: 5
- Code Review Enabled (feature-flag) — Controls: Whether engineer uses code review process. Default: true
- Minecraft Wait Ticks (threshold) — Controls: Bot action timing and responsiveness
Technology Stack
Primary language for framework and agents
Data validation and settings management
Large language model providers
Web UI for chat-based interactions
Web UI for SPO optimizer
CLI application framework
Minecraft bot environment
Minecraft plugins and tools
Minecraft bot framework
Testing framework
Configuration files
Key Components
- Team (class) — Orchestrates multiple AI agents working together on projects
metagpt/team.py - Role (class) — Base class for all AI agent roles with action execution capabilities
metagpt/roles/role.py - Action (class) — Base class for all executable actions that agents can perform
metagpt/actions/action.py - Environment (class) — Base environment for agent interactions and state management
metagpt/environment/base_env.py - ProductManager (class) — AI agent that handles requirements analysis and product planning
metagpt/roles/product_manager.py - Architect (class) — AI agent that designs system architecture and APIs
metagpt/roles/architect.py - Engineer (class) — AI agent that writes and reviews code implementations
metagpt/roles/engineer.py - AndroidAssistant (class) — Specialized agent for learning and automating Android app interactions
metagpt/ext/android_assistant/roles/android_assistant.py - Optimizer (class) — Optimizes AI agent workflows using evolutionary algorithms
metagpt/ext/aflow/scripts/optimizer.py - LLMProvider (class) — Abstraction layer for different LLM API providers
metagpt/provider/base_llm.py - Config (class) — Centralized configuration management for the framework
metagpt/config2.py - CollectBlock (class) — Minecraft bot plugin for automated block collection and mining
metagpt/environment/minecraft/mineflayer/mineflayer-collectblock/src/CollectBlock.ts
Sub-Modules
Evolutionary optimization of AI agent workflows using genetic algorithms
Learning and automating Android app interactions through UI observation and action
Bot automation and interaction within Minecraft game world
Streamlit web app for prompt optimization using self-playing optimization
Retrieval-augmented generation for document-based AI assistance
Configuration
config/config2.example.yaml (yaml)
llm.api_type(string, unknown) — default: openaillm.base_url(string, unknown) — default: YOUR_BASE_URLllm.api_key(string, unknown) — default: YOUR_API_KEYllm.model(string, unknown) — default: gpt-4-turbollm.proxy(string, unknown) — default: YOUR_PROXYllm.pricing_plan(string, unknown)embedding.api_type(string, unknown)embedding.base_url(string, unknown)- +45 more parameters
config/config2.yaml (yaml)
llm.api_type(string, unknown) — default: openaillm.model(string, unknown) — default: gpt-4-turbollm.base_url(string, unknown) — default: https://api.openai.com/v1llm.api_key(string, unknown) — default: YOUR_API_KEY
config/examples/anthropic-claude-3-5-sonnet.yaml (yaml)
llm.api_type(string, unknown) — default: claudellm.base_url(string, unknown) — default: https://api.anthropic.comllm.api_key(string, unknown) — default: YOUR_API_KEYllm.model(string, unknown) — default: claude-3-5-sonnet-20240620
config/examples/aws-bedrock.yaml (yaml)
llm.api_type(string, unknown) — default: bedrockllm.access_key(string, unknown) — default: YOUR_API_KEYllm.secret_key(string, unknown) — default: YOUR_API_SECRETllm.region_name(string, unknown) — default: us-east-1llm.model(string, unknown) — default: meta.llama2-70b-chat-v1
Explore the interactive analysis
See the full architecture map, data flow, and code patterns visualization.
Analyze on CodeSeaRelated Ml Inference Repositories
Frequently Asked Questions
What is MetaGPT used for?
Multi-agent AI framework for collaborative software development foundationagents/metagpt is a 12-component ml inference written in Python. Highly interconnected — components depend on each other heavily. The codebase contains 913 files.
How is MetaGPT architected?
MetaGPT is organized into 5 architecture layers: Core Framework, Agent Roles, Actions & Tools, Examples & Extensions, and 1 more. Highly interconnected — components depend on each other heavily. This layered structure enables tight integration between components.
How does data flow through MetaGPT?
Data moves through 7 stages: Requirements Input → Product Planning → Architecture Design → Project Management → Code Implementation → .... User requirements flow through specialized AI agents that collaborate to produce software artifacts, with each agent contributing domain expertise and passing results to the next stage. This pipeline design reflects a complex multi-stage processing system.
What technologies does MetaGPT use?
The core stack includes Python (Primary language for framework and agents), Pydantic (Data validation and settings management), OpenAI/Claude/Gemini APIs (Large language model providers), Chainlit (Web UI for chat-based interactions), Streamlit (Web UI for SPO optimizer), Typer (CLI application framework), and 5 more. This broad technology surface reflects a mature project with many integration points.
What system dynamics does MetaGPT have?
MetaGPT exhibits 5 data pools (Agent Memory, Document Store), 4 feedback loops, 5 control points, 4 delays. The feedback loops handle retry and convergence. These runtime behaviors shape how the system responds to load, failures, and configuration changes.
What design patterns does MetaGPT use?
5 design patterns detected: Role-Action Pattern, Multi-Agent Orchestration, Provider Pattern, Environment Abstraction, Configuration-Driven.
Analyzed on March 31, 2026 by CodeSea. Written by Karolina Sarna.