# OpenClaw Agent Instance Setup Each service in the OpenClaw fleet reads: - A per-agent environment file: `docker/openclaw-instances/.env` - A per-agent JSON5 config: `docker/openclaw-instances/.json` ## 1. Fill in API keys in `.env` files Set `ZAI_API_KEY` in each instance env file: - `jarvis-main.env` - `jarvis-projects.env` - `jarvis-research.env` - `jarvis-operations.env` ## 2. Generate unique gateway tokens per agent Generate one token per instance: ```bash openssl rand -hex 32 ``` Set a different `OPENCLAW_GATEWAY_TOKEN` in each `.env` file. ## 3. Deploy the Docker Swarm stack From repository root: ```bash docker stack deploy -c docker/openclaw-compose.yml jarvis ``` ## 4. First-time auth (if needed) If an instance requires first-time login, exec into the running container and run: ```bash openclaw auth ``` This uses OpenClaw's headless OAuth device-code flow. ## 5. Use Mosaic WebUI terminal for auth You can complete the device-code auth flow from the Mosaic WebUI terminal (xterm.js) attached to the service container.