Quickstart¶
This guide will get you running your first MOSAIC experiment in minutes.
Prerequisites¶
Before launching, make sure:
You have completed the Installation guide
Your virtual environment is activated:
source .venv/bin/activate
The
.envfile exists in the project root (copy from the example if needed):cp .env.example .env
The
.envfile controls Qt rendering, GPU settings, environment defaults, API keys, and worker-specific configuration. See the comments inside.env.examplefor details.
Launching MOSAIC¶
MOSAIC uses a two-process architecture: a Trainer Daemon (gRPC backend) and the Qt6 GUI (frontend). The launch script handles both:
./run.sh
What run.sh does:
Loads environment variables from
.envActivates the virtual environment (if
.venv/exists)Creates
var/logs/andvar/trainer/directoriesKills any stale trainer daemon processes
Starts the Trainer Daemon in the background (
gym_gui.services.trainer_daemonon127.0.0.1:50055)Waits for the daemon to be ready (gRPC health check, up to 10 retries)
Launches the MOSAIC GUI (
gym_gui.app)
On exit, the script automatically shuts down the daemon.
Tip
To use a specific Python version:
PYTHON_BIN=python3.11 ./run.sh
Running a Single-Agent Environment¶
Select the Single Agent tab
Choose an environment family and environment, for example: Gymnasium > Classic Control > CartPole-v1
Click Load Environment
Select Human Keyboard as the actor
Click Play and use arrow keys to control the cart
Running a Multi-Agent Environment¶
Select the Multi Agent tab
Choose an environment, for example: PettingZoo > Classic > Chess
Click Load Environment
Configure agents:
Player 0: Human Keyboard
Player 1: Random Policy
Click Play
Project Structure¶
After launching, MOSAIC creates runtime directories under var/:
var/
├── logs/
│ └── trainer_daemon.log # Daemon stdout/stderr
├── trainer/
│ └── trainer.pid # Daemon PID file
└── operators/
└── telemetry/ # Per-run JSONL telemetry
Logs are the first place to look if something goes wrong.
Troubleshooting¶
- Daemon fails to start
Check
var/logs/trainer_daemon.logfor errors. Common causes:Port 50055 already in use (another daemon running)
Missing
.envfile or incorrectQT_APIsettinggRPC/protobuf version mismatch
- GUI shows a blank window
On WSL, make sure these are set in
.env:QT_QPA_PLATFORM=xcb QT_QUICK_BACKEND=software LIBGL_ALWAYS_SOFTWARE=1
- “No module named gym_gui”
Make sure MOSAIC is installed in development mode:
pip install -e .