Multi-gateway setup
Most deployments should run a single gateway. One gateway can handle many channels and many agents at once, so a second instance is rarely needed. You only need multiple gateways for stronger isolation or redundancy — for example a separate “rescue” bot that can debug or repair the main bot while it is down, or hard trust separation between two boundaries on the same machine.For mixed-trust or adversarial-user separation, prefer separate OS users or hosts over multiple gateways on one host. See Security hardening.
Isolation checklist
Every gateway instance on the same host must have its own:| Setting | Purpose |
|---|---|
OPENCLAW_CONFIG_PATH | Per-instance config file |
OPENCLAW_STATE_DIR | Per-instance sessions, credentials, and caches |
agents.defaults.workspace | Per-instance workspace root |
gateway.port (or --port) | Unique base port |
| Derived ports (browser, canvas, CDP) | Must not overlap between instances |
Recommended: profiles
The--profile flag is the simplest path. A profile auto-scopes OPENCLAW_STATE_DIR and OPENCLAW_CONFIG_PATH, and suffixes the installed service name so each instance gets its own systemd/launchd unit.
Rescue-bot pattern
A rescue bot is a second gateway on the same host with its own profile, config, state directory, workspace, and base port. Keeping it isolated means it can still respond and apply config changes even if the primary bot is wedged.Derived ports
The base port isgateway.port (or OPENCLAW_GATEWAY_PORT / --port). Other services derive from it:
- Browser control service port = base + 2 (loopback only)
- Canvas host is served on the gateway HTTP server (same port as
gateway.port) - Browser profile CDP ports auto-allocate from
browser.controlPort + 9through+ 108
Manual environment variables
If you prefer not to use profiles, set the isolation variables explicitly per instance:Quick checks
Related: Gateway configuration · Doctor · Security hardening