MassGen: Multi-Agent Scaling System for GenAI#

MassGen Logo MassGen Logo

PyPI GitHub Stars Python 3.11+ License

Follow on X Follow on LinkedIn Join our Discord


Multi-agent scaling through intelligent collaboration

MassGen Demo - Multi-agent collaboration in action MassGen Demo - Multi-agent collaboration in action

MassGen is a cutting-edge multi-agent system that leverages the power of collaborative AI to solve complex tasks. It assigns a task to multiple AI agents who work in parallel, observe each other’s progress, and refine their approaches to converge on the best solution to deliver a comprehensive and high-quality result. The power of this “parallel study group” approach is exemplified by advanced systems like xAI’s Grok Heavy and Google DeepMind’s Gemini Deep Think.

What is MassGen?#

MassGen assigns your task to multiple AI agents who work in parallel, observe each other’s progress, and refine their approaches to converge on the best solution. The system delivers comprehensive, high-quality results by leveraging the collective intelligence of multiple AI models.

How It Works:

  • Work in Parallel - Multiple agents tackle the problem simultaneously, each bringing unique capabilities

  • See Recent Answers - At each step, agents view the most recent answers from other agents

  • Decide Next Action - Each agent chooses to provide a new answer or vote for an existing answer

  • Share Workspaces - When agents provide answers, their workspace is captured so others can review their work

  • Natural Consensus - Coordination continues until all agents vote, then the agent with most votes presents the final answer

Think of it as a “parallel study group” for AI - inspired by advanced systems like xAI’s Grok Heavy and Google DeepMind’s Gemini Deep Think. Agents learn from each other to produce better results than any single agent could achieve alone.

This project extends the classic “multi-agent conversation” idea from AG2 with “threads of thought” and “iterative refinement” concepts presented in The Myth of Reasoning.

Key Features#

🤝 Cross-Model Synergy

Use Claude, Gemini, GPT, Grok, and other models together - each agent can use a different model.

⚡ Parallel Coordination

Multiple agents work simultaneously with voting and consensus detection.

🛠️ MCP Integration

Model Context Protocol support for tools via YAML configuration.

🔗 AG2 Framework Support

Integrate AG2 agents with code execution alongside native MassGen agents.

📊 Live Visualization

Real-time terminal display showing agents’ working processes and coordination.

🔒 File Operation Safety

Read-before-delete enforcement and workspace isolation for secure file operations.

🔄 Multi-Turn Interactive Mode

Continue conversations across multiple turns with full context preservation and session management.

📁 Project Integration

Work directly with your codebase using context paths with granular read/write permissions.

Recent Releases#

v0.1.5 (October 2025) - Memory System

Long-term memory with semantic retrieval via mem0, automatic context compression, and memory sharing for multi-turn conversations.

v0.1.4 (October 2025) - Multimodal Generation Tools & Binary File Protection

Comprehensive generation tools for images, videos, audio, and documents with OpenAI APIs, binary file blocking for security, web crawling integration, and enhanced documentation infrastructure.

v0.1.3 (October 2025) - Post-Evaluation Tools & Multimodal Understanding

Post-evaluation workflow with submit/restart capabilities, custom multimodal understanding tools, Docker sudo mode, and enhanced config builder.

Quick Start#

Get started with MassGen in minutes:

Install:

pip install massgen

Option 1: Use the setup wizard (recommended for first time):

# Run without arguments to launch the interactive setup wizard
massgen

The wizard will guide you through configuring your API keys and creating your first agent team.

After setup, you can:

# Run a single query with your configured agents
massgen "Your question here"

# Or start an interactive conversation (no prompt needed)
massgen

Option 2: Quick single-agent test:

# No config needed - specify model directly
massgen --model gemini-2.5-flash "What are LLM agents?"

Option 3: Multi-agent collaboration:

# Use a built-in configuration
massgen --config @examples/basic/multi/three_agents_default \
  "What are the pros and cons of renewable energy?"

Watch agents discuss, vote, and converge on the best answer in real-time!

Ready to dive deeper?

Supported Models#

MassGen supports a wide range of AI models across different providers:

API-based Models:

  • Claude (Anthropic): Haiku, Sonnet, Opus series

  • Gemini (Google): Flash, Pro series with MCP support

  • GPT (OpenAI): GPT-4, GPT-5 series

  • Grok (xAI): Grok-3, Grok-4 series

  • Azure OpenAI: Enterprise deployments

  • And many more

Local Models:

  • LM Studio: Run open-weight models locally

  • vLLM & SGLang: Unified inference backend

External Frameworks:

  • AG2 Agents with code execution capabilities

Tip

Choosing the right backend? Different models have different strengths. See the complete Backend Capabilities Matrix in Backend Configuration to understand which features (web search, code execution, file operations, etc.) are available for each model.

Core Concepts#

Simple CLI Interface

Get started with just massgen - install via pip, run the interactive setup wizard, and you’re ready to go.

Multi-Agent Coordination

Multiple agents work in parallel, observe each other’s progress, and reach consensus through natural collaboration with real-time visualization.

Interactive Multi-Turn Mode

Have ongoing conversations with your multi-agent team! Session history is preserved in the .massgen/sessions/ directory, allowing you to continue conversations across multiple sessions with full context preservation.

Flexible Model Support

Use Claude, Gemini, GPT, Grok, and more - each agent can use a different model. Mix and match models for optimal results.

MCP Tool Integration

Extend agent capabilities with Model Context Protocol (MCP) tools. Supports planning mode to prevent irreversible actions during coordination.

Workspace Isolation & File Operations

Each agent gets its own isolated workspace for safe file operations. The .massgen/ directory keeps all MassGen files organized and separate from your project.

Project Integration

Work directly with your existing codebases! Use context paths to grant agents read/write access to specific directories with granular permission control.

Configuration

After using the setup wizard, customize your agent teams via YAML configuration files for advanced scenarios.

Documentation Sections#

Community#

License#

MassGen is licensed under the Apache License 2.0. See the LICENSE file for details.

Indices and tables#