Installation#
Prerequisites#
MassGen requires Python 3.11 or higher. You can check your Python version with:
python --version
If you need to install or upgrade Python, visit python.org/downloads.
Quick Start Installation#
Method 1: PyPI Installation (Recommended)#
The easiest way to get started with MassGen is via pip or uv:
# Install MassGen with uv (recommended - faster)
uv pip install massgen
# Or with pip
pip install massgen
Getting Started - Complete First-Run Flow#
Quickstart Setup (Fastest way to get running):
# Step 1: Set up API keys, Docker, and skills
uv run massgen --setup
# Step 2: Create a simple config and start
uv run massgen --quickstart
What ``βsetup`` does:
Configures your API keys (OpenAI, Anthropic, Google, xAI)
Offers to set up Docker images for code execution
Offers to install skills (openskills, Anthropic collection)
What ``βquickstart`` does:
Asks how many agents you want (1-5, default 3)
Asks which backend/model for each agent (or same for all)
Auto-detects Docker availability and configures execution mode
Creates a ready-to-use config and launches into interactive mode
After first-run setup:
# Start conversation with your default config
massgen
# Or run a single query
massgen "Your question here"
Tip
The entire flow takes 1-2 minutes. Youβll be in an interactive conversation with your agents immediately after setup!
Alternative: Full Setup Wizard
For more control over configuration, use the full wizard:
massgen --init
This guides you through:
Choose Your Configuration
π¦ Browse ready-to-use configs/examples - Select from 100+ pre-built configurations
Build from template - Create custom agents with guided setup (Simple Q&A, Research & Analysis, Code & Files, etc.)
Save as Default (optional)
When browsing existing configs or examples, youβll be asked: βSave this as your default config?β
Choose Yes to use it automatically on future
massgenrunsChoose No to try it once without saving
Start Chatting Immediately
After selection, youβre launched directly into interactive mode
Multi-turn conversation with your chosen configuration
Supported API Key Providers#
Main backends:
OpenAI, Anthropic (Claude), Google Gemini, xAI (Grok)
Azure OpenAI
ChatCompletion providers:
Cerebras AI, Together AI, Fireworks AI, Groq, Nebius AI Studio, OpenRouter
ZAI (Zhipu.ai), Kimi/Moonshot AI, POE, Qwen (Alibaba)
Note
You can skip all providers if youβre using local models (vLLM, Ollama, etc.) which donβt require API keys.
Manual API Key Setup (Optional)#
If you prefer to set up API keys manually before running MassGen:
# Unix/Mac: Create the .env file
mkdir -p ~/.config/massgen
vim ~/.config/massgen/.env
# Windows: Create the .env file
mkdir %USERPROFILE%\.config\massgen
notepad %USERPROFILE%\.config\massgen\.env
# Add your API keys (same format for all platforms)
OPENAI_API_KEY=sk-your-key-here
ANTHROPIC_API_KEY=sk-ant-your-key
GEMINI_API_KEY=your-gemini-key
XAI_API_KEY=xai-your-key
Complete API Key Reference:
# Main backends
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=...
XAI_API_KEY=xai-...
# Azure
AZURE_OPENAI_API_KEY=...
AZURE_OPENAI_ENDPOINT=...
# ChatCompletion providers
CEREBRAS_API_KEY=...
TOGETHER_API_KEY=...
FIREWORKS_API_KEY=...
GROQ_API_KEY=...
NEBIUS_API_KEY=...
OPENROUTER_API_KEY=...
ZAI_API_KEY=...
MOONSHOT_API_KEY=... # Also accepts KIMI_API_KEY
POE_API_KEY=...
QWEN_API_KEY=...
MassGen API Key Lookup Order#
MassGen looks for API keys in this order:
Environment variables (
OPENAI_API_KEY,ANTHROPIC_API_KEY, etc.)~/.config/massgen/.env(user config - recommended)Project-specific
.envfile in current directory (highest priority)
Reconfiguring API Keys#
You can re-run the API key wizard anytime:
# Launch API key setup
massgen --setup
First-Run Setup Flow Walkthrough#
When you run massgen for the first time, hereβs what youβll see:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π Welcome to MassGen! β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
API keys detected
Let's set up your default configuration...
Step 1 of 4: Select Your Use Case
Browse ready-to-use configs, or pick a template to build your own.
Β» π¦ Browse ready-to-use configs / examples
β or build from template β
βοΈ Custom Configuration [Choose your own tools]
π¬ Simple Q&A [Basic chat (no special tools)]
π Research & Analysis [Web search enabled]
π» Code & Files [File ops + code execution]
π³ Code & Files (Docker) [File ops + isolated Docker execution]
π Data Analysis [Files + code + image analysis]
π¨ Multimodal Analysis [Images, audio, video understanding]
Option 1: Browse Ready-to-Use Configs (Fastest)
Select this to browse 100+ pre-built configurations organized by category:
π¦ Browse ready-to-use configs / examples
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π€ Your Configs 1 β
β π Project Configs 0 β
β π Current Directory 2 β
β π¦ Package Examples 107 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Select a configuration:
Β» three_agents_default.yaml (3 agents, diverse perspectives)
research_team.yaml (Web search + analysis)
coding_assistant.yaml (File ops + code execution)
After selecting, youβll be asked:
π¦ You selected a package example
/path/to/massgen/configs/basic/multi/three_agents_default.yaml
Save this as your default config? [y/N]:
Choose y to save and use automatically on future runs
Choose n to try it once without saving
Then immediately launches into interactive mode! π
Option 2: Build from Template (Customized)
Select a template to create a custom configuration with guided setup:
π Research & Analysis [Web search enabled]
βββββββββββββββββββββββββββββββββββββββββββββββββ
Step 2 of 4: Agent Setup
βββββββββββββββββββββββββββββββββββββββββββββββββ
Available providers:
β’ β
OpenAI - gpt-5, gpt-5-mini, gpt-5-nano...
β’ β
Claude - claude-sonnet-4, claude-opus-4...
β’ β
Gemini - gemini-2.5-flash, gemini-2.5-pro...
How many agents? 3 agents (recommended)
Select provider: OpenAI
Select models: gpt-5-mini, gpt-5-mini, gpt-5-mini
β
Configuration saved to: ~/.config/massgen/config.yaml
π Launching interactive mode...
Your configuration is saved to ~/.config/massgen/config.yaml and will be used for all future runs.
Available Build Templates#
The wizard offers several preset configurations that auto-configure tools and capabilities for common use cases:
- Custom Configuration
Full flexibility to choose any combination of agents, models, and tools. Youβll configure everything manually. * Choose your own tools * Use for: Specialized workflows with specific requirements
- Simple Q&A
Basic question answering with multiple perspectives. No special tools configured. * Multiple agents provide diverse perspectives and cross-verification * Use for: General questions, discussions, brainstorming
- Research & Analysis (Auto-configured)
β Web Search: Real-time internet search for current information, fact-checking, and source verification
β Multi-Agent Collaboration: 3 agents recommended for diverse perspectives and cross-verification
Available for: OpenAI, Claude, Gemini, Grok
Use for: Research queries, current events, fact-checking, comparative analysis
- Code & Files (Auto-configured)
β Filesystem Access: File read/write operations in isolated workspace
β Code Execution: OpenAI Code Interpreter or Claude/Gemini native code execution
Claude Code recommended for best filesystem support
Use for: Code generation, refactoring, testing, file operations
- Code & Files (Docker) (Auto-configured)
β Filesystem Access: File read/write operations
β Code Execution: Backend-native code execution
β Docker Isolation: Fully isolated container execution via MCP, persistent packages, network controls
β οΈ Setup Required: Docker Engine 28.0.0+, docker Python library, and massgen-executor image (see massgen/docker/README.md)
Use for: Secure code execution with full isolation and persistent dependencies
- Data Analysis (Auto-configured)
β Filesystem Access: Read/write data files (CSV, JSON, etc.), save visualizations
β Code Execution: Data processing, transformation, statistical analysis, visualization generation
β Image Understanding: Analyze charts, graphs, and visualizations; extract data from images
Available for: OpenAI, Claude Code, Gemini, Azure OpenAI
Use for: Data analysis, chart interpretation, statistical processing, visualization
- Multimodal Analysis (Auto-configured)
β Image Understanding: Analyze images, screenshots, charts; OCR and text extraction * Available for: OpenAI, Claude Code, Gemini, Azure OpenAI
β Audio Understanding: Transcribe and analyze audio (where supported) * Available for: Claude, ChatCompletion
β Video Understanding: Analyze video content (where supported) * Available for: Claude, ChatCompletion, OpenAI
Note: Different backends support different modalities
Use for: Image analysis, screenshot interpretation, multimedia content analysis
Note
Presets marked (Auto-configured) automatically enable specific tools and capabilities during setup. You can still customize further if needed.
Quick Usage Examples#
After setup, using MassGen is simple:
# Use your default configuration
massgen "What is quantum computing?"
# Override with a specific model for this query
massgen --model gpt-5-mini "Quick question"
# Use a pre-built example configuration
massgen --config @examples/basic/multi/three_agents_default "Compare renewable energy sources"
# Start interactive multi-turn mode
massgen
Example Configurations#
MassGen ships with ready-to-use example configurations:
# List all available examples
massgen --list-examples
# Use an example configuration
massgen --config @examples/basic/single/single_gpt5nano "Your question"
massgen --config @examples/research_team "Research query"
# Copy an example to customize
massgen --example basic_multi > my-config.yaml
See Configuration for more details on customizing configurations.
Method 2: Development Installation (For Developers)#
If you want to contribute to MassGen or customize the source code:
# Clone the repository
git clone https://github.com/Leezekun/MassGen.git
cd MassGen
# Install in editable mode
pip install -e .
# Or with uv (faster)
pip install uv
uv pip install -e .
Automated Development Setup (Unix/Linux/macOS)
For a complete development environment setup including dependencies, skills, and Docker images:
# Full automated setup
./scripts/init.sh
# Or just install skills (Anthropic + Crawl4AI)
./scripts/init_skills.sh
The init.sh script will:
β Check system requirements (Python 3.11+, Node.js, Docker)
β Install uv package manager
β Install Python dependencies (
uv sync)β Install npm global packages (openskills, semtools, Claude Code CLI, Gemini CLI)
β Install skills (Anthropic collection + Crawl4AI)
β Build Docker runtime images (standard + sudo variants)
β Setup
.envfile from templateβ Verify installation
Script Options:
# Skip Docker builds (saves time)
./scripts/init.sh --skip-docker
# Skip skills installation
./scripts/init.sh --skip-skills
# Skip npm package installation
./scripts/init.sh --skip-npm
# Show help
./scripts/init.sh --help
Note
Windows Support: Windows support for init scripts is planned for a future release. Windows users should follow the manual installation steps for each component listed above.
Development installation gives you:
π Live changes: Edits are immediately reflected
π οΈ Full source access: Modify any part of MassGen
π¦ All features: Same as pip install, but with source code
Using uv tool for Multi-Turn Sessions
For the best experience with multi-turn conversations and working across different project directories, install MassGen as a uv tool:
# Install as a global uv tool (from MassGen directory)
cd MassGen
uv tool install -e .
# Now you can use massgen from anywhere
cd ~/your-project
massgen # Start interactive multi-turn session
# Sessions are saved to .massgen/sessions/ in your current directory
# Context is preserved across turns automatically
Benefits of uv tool for multi-turn:
π Global Access: Run
massgenfrom any directory㪠Session Isolation: Each project gets its own
.massgen/sessions/directoryπ Clean Workspaces: Sessions and workspaces stay organized per-project
π Live Updates: Changes to MassGen source are immediately available (editable mode)
See Interactive Multi-Turn Mode for complete multi-turn conversation documentation.
Using MassGen After Installation#
After installing via either method, you can use MassGen in several ways:
Command Line Interface#
# Single query with default config
massgen "Your question"
# Interactive multi-turn mode
massgen
# Quick single-agent mode
massgen --model gemini-2.5-flash "Quick question"
# Use example configuration
massgen --config @examples/basic/multi/three_agents_default "Complex question"
# Use custom configuration file
massgen --config ./my-agents.yaml "Your question"
Python API#
MassGen provides a simple async Python API:
import asyncio
import massgen
# Quick single-agent query
result = await massgen.run(
query="What is machine learning?",
model="gpt-5-mini"
)
print(result['final_answer'])
# Multi-agent with configuration
result = await massgen.run(
query="Analyze climate change trends",
config="@examples/research_team"
)
# Or from sync code
result = asyncio.run(
massgen.run("Question", model="gemini-2.5-flash")
)
See Python API for complete API documentation.
Configuration Management#
Configuration Files Location#
MassGen uses the following directory structure:
~/.config/massgen/ # Windows: %USERPROFILE%\.config\massgen\
βββ config.yaml # Your default configuration (from wizard)
βββ agents/ # Your custom named configurations
β βββ research-team.yaml
β βββ coding-agents.yaml
βββ .env # API keys (optional)
The config.yaml file is created by the setup wizard and used by default when you run massgen without specifying a config.
Reconfiguring MassGen#
You can re-run the setup wizard anytime:
# Launch configuration wizard
massgen --init
# This will:
# - Let you create a new default config (overwrites existing)
# - Or save as a named config in ~/.config/massgen/agents/ (Windows: %USERPROFILE%\.config\massgen\agents\)
Understanding the .massgen Directory#
MassGen organizes all its working files in a .massgen/ directory within your project. This keeps your project clean and makes it easy to exclude MassGen files from version control by adding .massgen/ to your .gitignore.
Whatβs inside?
sessions/- Multi-turn conversation historyworkspaces/- Agent working directories for file operationssnapshots/- Workspace snapshots shared between agentstemp_workspaces/- Previous turn results for context
When is it created?
The .massgen/ directory is automatically created when you use multi-turn mode, file operations, or workspace features. Simple single-agent queries donβt create it.
See also
For a complete explanation of workspace management and directory structure, see Core Concepts (State Management & .massgen Directory section)
Optional Dependencies#
AG2 Framework Integration#
If you want to use AG2 agents alongside native MassGen agents:
pip install massgen[external]
This is only required if you plan to use AG2 configuration files.
Docker Image Setup#
MassGen uses Docker containers for secure code execution. The Docker images provide a sandboxed environment where agents can safely run code, install packages, and execute shell commands.
Install Docker Images via CLI#
The easiest way to set up Docker images is using the built-in command:
# Pull Docker images from GitHub Container Registry
uv run massgen --setup-docker
This will pull:
ghcr.io/massgen/mcp-runtime:latest - Standard runtime image
ghcr.io/massgen/mcp-runtime-sudo:latest - Runtime with sudo support
Note
The --setup command will offer to run --setup-docker for you automatically.
Prerequisites:
Docker Desktop or Docker Engine must be installed and running
On macOS/Linux:
docker infoshould work without sudoOn Windows: Docker Desktop must be running
Verifying Docker Setup:
# Check Docker is running
docker info
# Check MassGen images are available
docker images | grep massgen
You should see both mcp-runtime and mcp-runtime-sudo images listed.
When is Docker needed?
Docker is required when using:
command_line_execution_mode: dockerin your configCode-based tools with Docker isolation
The
--quickstartcommand with Docker execution mode
If Docker isnβt available, --quickstart will automatically configure local execution mode (more restricted but still functional).
Skills Installation#
Skills enhance MassGen with additional capabilities like semantic search, LSP-based code understanding, and web scraping. You can install skills after setting up MassGen.
Install Skills via CLI (Recommended)#
The easiest way to install skills is using the built-in command (works on all platforms):
# Install skills automatically
massgen --setup-skills
This will install:
openskills CLI - npm package for managing skills
Anthropic skills collection - Official Claude Code and Gemini CLI skills
Crawl4AI skill - Web scraping and content extraction
The command works on Windows, macOS, and Linux and handles all dependencies automatically.
Manual Skills Installation#
If you prefer to install skills manually or need specific skills:
# Install openskills CLI
npm install -g openskills
# Install Anthropic skills collection
openskills install anthropics/skills --universal -y
# Skills are installed to ~/.agent/skills/
Development Scripts (Unix/macOS/Linux)#
For development installations, bash scripts are available that provide additional setup:
# Full development setup (dependencies, skills, Docker)
./scripts/init.sh
# Just install skills
./scripts/init_skills.sh
# With options
./scripts/init.sh --skip-docker # Skip Docker image builds
./scripts/init.sh --help # Show all options
Note
The bash scripts are Unix-only. Windows users should use massgen --setup-skills instead.
Verifying Skills Installation#
Check that skills are installed correctly:
# List installed skills
ls ~/.agent/skills/
# On Windows
dir %USERPROFILE%\.agent\skills\
You should see directories for each installed skill (e.g., pdf, xlsx, crawl4ai).
Optional CLI Tools#
Enhanced Capabilities#
Install these optional tools for enhanced MassGen capabilities:
Claude Code CLI#
Advanced coding assistant with comprehensive development tools:
npm install -g @anthropic-ai/claude-code
LM Studio#
Local model inference for running open-weight models:
For MacOS/Linux:
sudo ~/.lmstudio/bin/lms bootstrap
For Windows:
cmd /c %USERPROFILE%\.lmstudio\bin\lms.exe bootstrap
Verification Steps#
After installation, verify MassGen is correctly installed:
# Check MassGen is available
massgen --help
You should see the MassGen CLI help message with all available options.
Quick Test#
Try a simple query to verify everything works:
# Single agent mode (no config needed)
massgen --model gemini-2.5-flash "What is MassGen?"
# Or run the wizard and try your default config
massgen "Tell me about multi-agent systems"
Next Steps#
Great! Youβve installed MassGen. Hereβs your learning path:
β You are here: Installation complete
β¬ Next: Running MassGen - Run your first command and see MassGen in action
β¬ Then: Configuration - Learn how to customize agent teams
β¬ Advanced: Interactive Multi-Turn Mode - Explore interactive conversations
Quick jump: Want to dive into examples? Check out Basic Examples for copy-paste configurations.
Troubleshooting#
Setup Wizard Not Appearing#
If the wizard doesnβt appear on first run:
# Manually trigger the setup wizard
massgen --init
# Or check if a config already exists (Unix/Mac)
ls ~/.config/massgen/config.yaml
# Windows
dir %USERPROFILE%\.config\massgen\config.yaml
To start fresh, remove the existing config and run again.
Python Version Issues#
If you encounter Python version errors:
# Check your Python version
python --version
# If below 3.11, install a newer version from python.org
# Then reinstall MassGen
pip install --upgrade massgen
Missing Example Configurations#
If --list-examples shows no results:
# Reinstall MassGen to ensure package data is included
pip install --force-reinstall massgen
# Verify installation
massgen --list-examples
API Key Errors#
If you see βAPI key not foundβ errors:
Check your
.envfile exists:Unix/Mac:
~/.config/massgen/.envWindows:
%USERPROFILE%\.config\massgen\.env
Verify the key is correctly named (e.g.,
OPENAI_API_KEY)Re-run the wizard:
massgen --init
For more help, visit our GitHub Issues or join our community.
Note
Existing MassGen users: If you previously used MassGen via git clone, all your existing workflows continue to work. See Running MassGen (Backwards Compatibility section) for details on command syntax and migration.