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#
The simplest way to start: Just run massgen and youβll be guided through everything:
massgen
What happens next:
API Key Setup (only if needed)
MassGen detects if you have cloud provider API keys configured
If not, shows an interactive wizard to configure OpenAI, Anthropic, Google, etc.
Keys are saved to
~/.config/massgen/.envfor future useIf you already have keys, this step is skipped automatically
Choose Your Configuration
Youβll see two options:
π¦ 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
Type your questions and get collaborative agent responses
Session history is automatically saved
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!
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 .
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.
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.