Skip to main content

Gateways

Gateways are OpenClaw instances that run AI agents and execute tasks. Mission Control connects to one or more gateways to orchestrate agent lifecycles, monitor sessions, and sync agent configurations.

List Gateways

Retrieve all registered gateways with connection status and health metrics.
curl http://localhost:3000/api/gateways \
  -H "x-api-key: YOUR_API_KEY"

Response

gateways
array
Array of gateway configurations
id
integer
Gateway ID
name
string
Gateway name (unique)
host
string
Hostname or IP address (e.g., 127.0.0.1, gateway.example.com)
port
integer
Gateway port (default: 18789)
token
string
Redacted authentication token (shows -------- or empty)
token_set
boolean
Whether authentication token is configured
is_primary
boolean
Whether this is the primary gateway
status
string
Connection status: online, offline, degraded, unknown
last_seen
integer
Unix timestamp of last successful health check (null if never checked)
latency
integer
Health check latency in milliseconds (null if unavailable)
sessions_count
integer
Number of active sessions on this gateway
agents_count
integer
Number of agents registered to this gateway
created_at
integer
Unix timestamp
updated_at
integer
Unix timestamp
If no gateways exist, Mission Control automatically seeds a default gateway using environment variables (OPENCLAW_GATEWAY_HOST, OPENCLAW_GATEWAY_PORT, OPENCLAW_GATEWAY_TOKEN).

Add Gateway

Register a new gateway connection.
curl -X POST http://localhost:3000/api/gateways \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "name": "production",
    "host": "gateway.prod.example.com",
    "port": 18789,
    "token": "your-gateway-auth-token",
    "is_primary": false
  }'

Request Body

name
string
required
Unique gateway name for identification
host
string
required
Gateway hostname or IP address
port
integer
required
Gateway port (typically 18789)
token
string
Authentication token for gateway API (if required)
is_primary
boolean
default:false
Mark as primary gateway (automatically unsets other primaries)

Response

gateway
object
Created gateway object (see List response for schema)

Update Gateway

Update gateway configuration or health metrics.
curl -X PUT http://localhost:3000/api/gateways \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "id": 1,
    "name": "primary-gateway",
    "is_primary": true
  }'

Request Body

id
integer
required
Gateway ID to update
name
string
New gateway name
host
string
New hostname
port
integer
New port
token
string
New authentication token
is_primary
boolean
Update primary status (unsets other primaries if true)
status
string
Update connection status (typically set by health checks)
last_seen
integer
Update last seen timestamp (set by health checks)
latency
integer
Update latency metric (set by health checks)
sessions_count
integer
Update session count (set by sync operations)
agents_count
integer
Update agent count (set by sync operations)

Delete Gateway

Remove a gateway registration.
curl -X DELETE http://localhost:3000/api/gateways \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"id": 2}'

Request Body

id
integer
required
Gateway ID to delete
You cannot delete the primary gateway. Assign another gateway as primary first.

Health Check Gateway

Probe gateway connectivity and update health metrics.
curl -X POST http://localhost:3000/api/gateways/health \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"gateway_id": 1}'

Request Body

gateway_id
integer
Gateway ID to check (omit to check all gateways)

Response

healthy
boolean
Whether gateway is reachable
latency_ms
number
Round-trip latency in milliseconds
details
object
Additional health check details (gateway version, uptime, etc.)

Gateway Configuration

Environment Variables

Mission Control reads default gateway settings from environment variables:
# Default gateway settings (auto-seeded if no gateways exist)
MC_DEFAULT_GATEWAY_NAME="primary"
OPENCLAW_GATEWAY_HOST="127.0.0.1"
OPENCLAW_GATEWAY_PORT="18789"
OPENCLAW_GATEWAY_TOKEN="your-token-here"

# Legacy aliases (also supported)
GATEWAY_PORT="18789"
GATEWAY_TOKEN="your-token"
NEXT_PUBLIC_GATEWAY_PORT="18789"

Primary Gateway

The primary gateway is used for:
  • Default agent spawning
  • Configuration sync operations
  • Health monitoring dashboard
Only one gateway can be primary at a time. Setting a new gateway as primary automatically unsets the previous one.

Integration with OpenClaw

Mission Control communicates with OpenClaw gateways over HTTP:
OperationGateway EndpointDescription
Spawn agentPOST /spawnStart a new agent session
Control sessionPOST /controlPause/resume/kill session
List sessionsGET /sessionsQuery active sessions
Health checkGET /healthProbe gateway status
Sync configGET /configRead agent configurations

Authentication

If token is set, Mission Control includes it in requests:
Authorization: Bearer <token>

Agent Synchronization

Mission Control can sync agent definitions from gateway configuration files:
curl -X POST http://localhost:3000/api/agents/sync \
  -H "x-api-key: YOUR_API_KEY"
This reads the primary gateway’s agent config and:
  1. Creates new agents not in Mission Control
  2. Updates existing agents with new configuration
  3. Returns sync statistics

Response

{
  "synced": 5,
  "created": 2,
  "updated": 3
}

Session Management

Monitor active agent sessions across all gateways:
curl "http://localhost:3000/api/sessions?agent=researcher" \
  -H "x-api-key: YOUR_API_KEY"

Query Parameters

agent
string
Filter sessions by agent name
limit
integer
default:50
Maximum sessions to return

Response

sessions
array
key
string
Session key (unique identifier)
agent
string
Agent name
model
string
LLM model in use (e.g., claude-sonnet-4)
status
string
Session status: active, paused, completed
totalTokens
integer
Total tokens used in this session
updatedAt
integer
Unix timestamp of last activity

Control Session

Pause, resume, or kill a gateway session.
curl -X POST http://localhost:3000/api/sessions/researcher:main/control \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"action": "pause"}'

Request Body

action
string
required
Session control action:
  • pause - Suspend session execution
  • resume - Resume paused session
  • kill - Terminate session immediately

Multi-Gateway Support

Mission Control supports multiple gateway connections for:
  • Load distribution: Spread agent execution across gateways
  • Geo-distribution: Run agents closer to data sources
  • Environment separation: Dev/staging/prod gateways
  • High availability: Failover to backup gateways

Gateway Selection

When spawning an agent, Mission Control selects a gateway based on:
  1. Agent config - If agent has gateway_config.preferred_gateway
  2. Primary gateway - Default if no preference set
  3. Load balancing - Future: route to least-loaded gateway

Monitoring & Observability

Health Check Automation

Mission Control automatically health-checks all gateways:
  • Frequency: Every 5 minutes
  • Updates: status, last_seen, latency fields
  • Circuit breaker: Marks offline after 3 consecutive failures

Gateway Dashboard

View gateway status in the Mission Control UI:
Settings → Gateways
Displays:
  • Connection status (online/offline/degraded)
  • Latency graph (last 24h)
  • Active session count
  • Registered agent count

Security Considerations

  • Token protection: Tokens are redacted in API responses
  • Admin-only: Only admin role can add/update/delete gateways
  • Network isolation: Use private networks or VPNs for gateway communication
  • TLS: Recommended for production (configure reverse proxy)

Best Practices

  1. Use descriptive names - prod-us-east, dev-local, etc.
  2. Monitor latency - High latency (>500ms) indicates network issues
  3. Set primary wisely - Choose geographically closest or most reliable
  4. Regular health checks - Enable automatic health monitoring
  5. Backup gateways - Configure at least 2 gateways for production

Rate Limits

  • Gateway operations: 100 requests/minute per API key
  • Health checks: Manual checks limited to 1 request/10 seconds
  • Session control: 10 requests/minute per session
Automatic health checks and sync operations run independently and are not rate-limited.