Gateway Setup
Gateways are the runtime environments where agents execute. Each gateway runs OpenClaw and connects to Mission Control.Prerequisites
- OpenClaw Gateway installed and running
- Gateway accessible via WebSocket (default port: 18789)
- Active organization in Mission Control
Gateway Configuration
OpenClaw Gateway Setup
Edit~/.openclaw/openclaw.json:
Start Gateway
Register Gateway in Mission Control
Gateway verification
Mission Control:
- Validates gateway version (
>= GATEWAY_MIN_VERSION) - Tests WebSocket connection
- Creates gateway record
- Provisions main agent automatically
backend/app/api/gateways.py:89-110
Gateway Fields
Required Fields
name- Human-readable identifierurl- WebSocket URL (e.g.,ws://host:18789orwss://host:18789)workspace_root- Absolute path for agent workspaces
Optional Fields
token- Authentication token for gateway RPC (recommended)disable_device_pairing- Set totruefor Mission Control management (required)allow_insecure_tls- Allow self-signed certificates (dev only)
backend/app/schemas/gateways.py
Gateway Main Agent
Each gateway has a main agent that coordinates gateway-level operations.Automatic Provisioning
The main agent is created automatically when you:- Create a gateway
- Update gateway connection settings
board_idisNULL(gateway-scoped, not board-scoped)- Session key:
agent:gateway-<gateway-id>:main - OpenClaw agent ID:
mc-gateway-<gateway-id> - Workspace:
{workspace_root}/workspace-gateway-<gateway-id>
backend/app/services/openclaw/admin_service.py
Main Agent Templates
Main agents receive:TOOLS.md- Mission Control API accessIDENTITY.md- Gateway coordinator roleSOUL.md- Gateway management behaviorUSER.md- Organization context
backend/app/services/openclaw/constants.py:MAIN_TEMPLATE_MAP
Template Sync
Template sync updates agent workspace files with the latest configuration.When to Sync
Run template sync after:- Creating new boards
- Adding agents to boards
- Changing board rules or objectives
- Updating agent identity profiles
- Gateway configuration changes
Sync Command
| Parameter | Default | Description |
|---|---|---|
include_main | true | Sync gateway main agent |
lead_only | false | Only sync board lead agents |
reset_sessions | false | Force reset agent sessions |
rotate_tokens | false | Generate new auth tokens |
force_bootstrap | false | Overwrite BOOTSTRAP.md |
overwrite | false | Overwrite all files |
board_id | null | Limit to specific board |
backend/app/api/gateways.py:170-184
Sync with Token Rotation
Use when:- First-time gateway setup
- Agents removed from
openclaw.json - Tokens compromised
- Generate new auth tokens for all agents
- Update database with new token hashes
- Rewrite all
TOOLS.mdfiles with new tokens - Preserve agent-editable files (MEMORY.md, USER.md)
Sync Response
backend/app/schemas/gateways.py:GatewayTemplatesSyncResult
Gateway RPC Protocol
Mission Control communicates with gateways via WebSocket RPC.Connection Flow
Source:backend/app/services/openclaw/gateway_rpc.py
Available RPC Methods
Agent management:agents.create- Create agent entryagents.update- Update agent metadataagents.delete- Remove agentagents.files.list- List workspace filesagents.files.get- Read file contentagents.files.set- Write file contentagents.files.delete- Remove file
sessions.ensure- Ensure session existssessions.reset- Clear session historysessions.delete- Remove session
config.get- Read gateway configconfig.patch- Update config (heartbeat settings)
chat.send- Send message to agent
backend/app/services/openclaw/provisioning.py:498-620
Gateway Health Check
Verify gateway connectivity:backend/app/api/gateway_runtime.py
Update Gateway
Modify gateway configuration:url, token) triggers main agent reprovisioning.
Source: backend/app/api/gateways.py:128-167
Delete Gateway
backend/app/api/gateways.py:210-248
Troubleshooting
Gateway version too old
Error: “Gateway version 2026.01.5 is below minimum 2026.02.9” Fix: Update OpenClaw:.env:
backend/app/services/openclaw/gateway_compat.py
Connection refused
Causes:- Gateway not running
- Firewall blocking port 18789
- Incorrect URL in gateway record
RPC timeout
Causes:- Gateway overloaded
- Network latency
- Large file operations
backend/app/services/openclaw/gateway_rpc.py:GatewayClientConfig
”unable to read AUTH_TOKEN from TOOLS.md”
Cause: Agent missing fromopenclaw.json or TOOLS.md not synced
Fix: Run sync with token rotation:
List Gateways
backend/app/api/gateways.py:75-86
Database Schema
backend/app/models/gateways.py