CLI Reference#
MassGen Command Line Interface reference.
Basic Usage#
massgen [OPTIONS] ["<your question>"]
Default Behavior (No Arguments):
When running massgen with no arguments, configs are auto-discovered with this priority:
.massgen/config.yaml(project-level config in current directory)~/.config/massgen/config.yaml(global default config)Launch setup wizard if no config found
First-Time Setup:
The wizard consists of two steps:
API Key Setup (if no cloud provider keys detected)
Prompts for OpenAI, Anthropic, Google, or other cloud provider API keys
Saves to
~/.config/massgen/.envSkipped if keys already exist
Configuration Setup
Option to browse ready-to-use configs/examples
Option to build from templates (Simple Q&A, Research, Code & Files, etc.)
Asks “Save as default?” when browsing existing configs
Launches directly into interactive mode
After Setup:
No arguments → Starts multi-turn conversation mode if default config chosen
With question → Runs single query using default config
CLI Parameters#
Parameter |
Description |
|---|---|
|
Path to YAML configuration file with agent definitions, model parameters, backend parameters and UI settings.
With |
|
Interactively select from available configurations (user configs, project configs, current directory, package examples). Uses hierarchical navigation: category → config |
|
Backend type for quick setup without config file. Options: |
|
Model name for quick setup (e.g., |
|
System prompt for the agent in quick setup mode. Omitted if |
|
Add the current working directory to |
|
Planning-only mode. Agents create a structured task plan without auto-executing it |
|
Controls plan granularity for |
|
Optional explicit task-count target for planning output (must be > 0) |
|
Optional explicit chunk-count target for planning output (must be > 0) |
|
Planning collaboration mode: ask user questions, coordinate among agents, or run fully autonomous |
|
Full workflow: create a plan, then execute it immediately |
|
Execute an existing plan by plan directory, plan ID, or |
|
Disable real-time streaming UI coordination display (fallback to simple text output) |
|
Disable real-time logging |
|
Enable debug mode with verbose logging. Debug logs saved to |
|
Load memory from a previous session by ID (e.g., |
|
List all available memory sessions with their metadata (session IDs, timestamps, models, status). Sessions are automatically tracked in |
|
Start the WebUI server instead of the terminal UI. Opens a browser-based interface with real-time agent streaming, vote visualization, and workspace browsing |
|
Host address for the WebUI server (default: |
|
Port for the WebUI server (default: |
|
Don’t auto-open browser when using |
|
Write final answer to specified file path. Works in any mode (automation, interactive, etc.). Useful for capturing agent responses in scripts or pipelines |
|
Enable Logfire observability for structured tracing of LLM calls, tool executions, and orchestration. Requires Logfire token (via |
|
Optional single-question input. If omitted, MassGen enters interactive chat mode |
Mode Settings#
These flags mirror the TUI mode bar toggles, allowing CLI control of execution modes.
Parameter |
Description |
|---|---|
|
Single-agent mode. Uses only one agent from the config. Optionally specify an agent ID; defaults to the first agent if omitted |
|
Coordination mode: |
|
Quick mode: disable refinement. Agents produce one answer with no voting loop. Equivalent to TUI “Refine OFF” toggle |
|
Enable parallel persona generation with specified diversity mode. |
Examples#
Default Configuration Mode#
# First time: Launch setup wizard
massgen
# After setup: Start interactive conversation
massgen
# Run single query with default config
massgen "What is machine learning?"
Interactive Config Selection#
# Browse and select from available configurations
massgen --select
# After selection, optionally provide a question
massgen --select "Your question here"
# The selector shows configs from:
# - User configs: ~/.config/massgen/agents/
# - Project configs: .massgen/*.yaml
# - Current directory: *.yaml
# - Package examples: Built-in example configs
Quick Single Agent#
# Fastest way to test - no config file
massgen --model claude-3-5-sonnet-latest "What is machine learning?"
massgen --model gemini-2.5-flash "Explain quantum computing"
With Specific Backend#
massgen \
--backend gemini \
--model gemini-2.5-flash \
"What are the latest developments in AI?"
Multi-Agent with Config#
# Recommended: Use YAML config for multi-agent
massgen \
--config @examples/basic/multi/three_agents_default.yaml \
"Analyze the pros and cons of renewable energy"
Interactive Mode#
# Omit question to enter interactive chat mode
massgen --model gemini-2.5-flash
# Multi-agent interactive
massgen \
--config @examples/basic/multi/three_agents_default.yaml
Quick CWD Context Access#
# Add current directory as read-only context
massgen --config my_config.yaml --cwd-context ro "Review this codebase"
# Add current directory as writable context
massgen --config my_config.yaml --cwd-context rw "Apply the requested refactor"
Note
In the Textual TUI, --cwd-context initializes the same CWD context state as the Ctrl+P toggle.
In Execute mode, Ctrl+P is intentionally blocked to avoid changing context scope mid-execution.
Mode Settings#
# Quick mode: one answer per agent, no refinement loop
massgen --quick --config my_config.yaml "Summarize this paper"
# Single agent from a multi-agent config
massgen --single-agent --config my_config.yaml "Quick question"
# Single agent by ID
massgen --single-agent agent_b --config my_config.yaml "Quick question"
# Fastest: single agent + quick mode
massgen --single-agent --quick --config my_config.yaml "What is 2+2?"
# Persona-diverse parallel execution
massgen --personas perspective --config my_config.yaml "Design a logo"
# Decomposition mode (subtask-based)
massgen --coordination-mode decomposition --config my_config.yaml "Build a web app"
Debug Mode#
massgen \
--debug \
--config @examples/basic/multi/three_agents_default.yaml \
"Your question here"
Disable UI#
# Simple text output instead of rich terminal UI
massgen \
--no-display \
--config config.yaml \
"Question"
Session Management#
# List available memory sessions
massgen --list-sessions
# Load session from previous run
massgen --session-id session_20251028_143000 \
"What did we discuss about the backend architecture?"
# Interactive mode with previous session
massgen --session-id session_20251028_143000 \
--config my_config.yaml
# Session can also be specified in YAML config
# Add to your config.yaml:
# session_id: "session_20251028_143000"
WebUI Mode#
# Start WebUI on default localhost:8000
massgen --web
# Custom host and port (for external access)
massgen --web --web-host 0.0.0.0 --web-port 3000
# With a specific config
massgen --web --config @examples/basic/multi/three_agents_default
# Combine with debug mode
massgen --web --debug --config my_config.yaml
OpenAI-Compatible HTTP Server (massgen serve)#
Run MassGen as an OpenAI-compatible HTTP API (FastAPI + Uvicorn).
Endpoints:
GET /health- Health check endpointPOST /v1/chat/completions- OpenAI-compatible chat completions (non-streaming only)
Note
Streaming (stream: true) is not yet supported. The server will return HTTP 501
if streaming is requested. Use stream: false for all requests.
# Start server (defaults: host 0.0.0.0, port 4000)
massgen serve
# Custom bind
massgen serve --host 127.0.0.1 --port 4000
# Provide a default config
massgen serve --config path/to/config.yaml
# Enable auto-reload for development
massgen serve --reload
# Health check
curl http://localhost:4000/health
# OpenAI-compatible Chat Completions
# Note: When running with --config, the "model" parameter is ignored
# to ensure the server uses the agent team defined in your YAML.
curl http://localhost:4000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"massgen","messages":[{"role":"user","content":"hi"}],"stream":false}'
Response Format:
The server returns responses with the final synthesized answer in content and all agent traces in reasoning_content:
{
"choices": [{
"message": {
"role": "assistant",
"content": "The final answer from the agent team.",
"reasoning_content": "[system] Starting coordination...\n[agent_1] Analyzing...\n[orchestrator] Vote: agent_1"
},
"finish_reason": "stop"
}]
}
Environment variables (optional):
MASSGEN_SERVER_HOST(default:0.0.0.0)MASSGEN_SERVER_PORT(default:4000)MASSGEN_SERVER_DEFAULT_CONFIG(default: unset)MASSGEN_SERVER_DEBUG(default:false)
Output to File#
# Save agent response to a file
massgen --output-file results.txt "Summarize the key points of machine learning"
# With config and output file
massgen --config my_config.yaml --output-file report.md "Generate a project report"
Logfire Observability#
# Enable structured tracing with Logfire
massgen --logfire --config your_config.yaml "Your question"
# Combine with debug mode for maximum observability
massgen --logfire --debug --config your_config.yaml "Your question"
# Or enable via environment variable
export MASSGEN_LOGFIRE_ENABLED=true
massgen --config your_config.yaml "Your question"
See Logging & Debugging for detailed Logfire setup instructions.
Additional Commands#
Log Analysis (massgen logs)#
Analyze and browse session logs without manual file navigation.
# Summary of most recent run
massgen logs
# Full tool breakdown
massgen logs tools
# List recent runs
massgen logs list
# Open log directory in file manager
massgen logs open
Subcommand |
Description |
|---|---|
|
Display run summary with tokens, rounds, and top tools |
|
Full tool breakdown table sorted by execution time |
|
Sort tools by call count instead of time |
|
List recent runs with timestamps, costs, questions, and analysis status |
|
Show only logs with ANALYSIS_REPORT.md |
|
Show only logs without analysis |
|
Show more runs (default: 10) |
|
Generate analysis prompt for use in coding CLIs |
|
Run multi-agent self-analysis using a preset MassGen team (customizable via |
|
Open log directory in system file manager |
Options:
Option |
Description |
|---|---|
|
Analyze a specific log directory instead of the most recent |
|
Output raw JSON for scripting |
|
For |
|
For |
|
For |
Session Viewer (massgen viewer)#
View any MassGen session in the full Textual TUI (read-only). Useful for observing --automation runs, replaying completed sessions, and monitoring cloud/CI runs.
# View the most recent session
massgen viewer
# View a specific log directory
massgen viewer /path/to/log_dir
# Interactive session picker
massgen viewer --pick
# Replay at real-time speed (default: instant)
massgen viewer /path/to/log_dir --replay-speed 1
# View in browser via textual-serve
massgen viewer /path/to/log_dir --web --port 9000
Option |
Description |
|---|---|
|
Path to log directory (positional, optional). Default: most recent session |
|
View a specific turn (default: latest) |
|
View a specific attempt (default: latest) |
|
Playback speed for completed sessions. |
|
Interactively pick from recent sessions |
|
Serve the viewer TUI in a browser via |
|
Port for |
The viewer shows the exact same TUI as a normal interactive run — agent panels, tool calls, votes, and final presentation — but in read-only mode with the input area hidden.
See Also#
Running MassGen - Detailed usage examples
YAML Configuration Reference - YAML configuration reference
Supported Models & Backends - Available models and backends
Logging & Debugging - Complete logging and debugging guide