Skip to main content

viben gateway

Start the Gateway - the core runtime connecting channels to the agent loop.

Commands

# Start the gateway
viben gateway start

# Start with specific options
viben gateway start --host 127.0.0.1 --port 18790 --log-level info --agent main

# Start in daemon mode
viben gateway start --daemon

# Stop a running gateway
viben gateway stop
viben gateway stop --port 18790 # Stop on specific port

# Restart the gateway (stop then start)
viben gateway restart
viben gateway restart --port 18790 --log-level debug

# Check gateway status
viben gateway status

Gateway Commands

CommandDescription
viben gateway startStart the gateway, supports --host, --port, --log-level, --agent, --daemon
viben gateway stopStop a running gateway, supports --port to specify port
viben gateway restartRestart the gateway (stop then start), supports all start options
viben gateway statusCheck gateway running status and health

Options

OptionDescriptionDefault
-h, --host <host>Gateway listen address127.0.0.1
-p, --port <port>Gateway listen port18790
-l, --log-level <level>Log level (debug, info, warn, error)info
-n, --agent <agent-id>Specify the agent to runmain
-d, --daemonRun in background modefalse

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ Gateway │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────┐ ┌────────────────────────────┐ │
│ │ Channels (Input) │ │ Message Bus │ │
│ │ ├── Telegram Bot │ │ ├── Inbound Queue │ │
│ │ ├── Discord Bot │ │ │ (messages from │ │
│ │ ├── WhatsApp (via │ │ │ channels) │ │
│ │ │ bridge) │ │ └── Outbound Queue │ │
│ │ ├── Feishu (WebSocket) │ │ (responses to │ │
│ │ └── CLI (direct input) │ │ channels) │ │
│ └─────────────────────────┘ └────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Agent Loop │ │
│ │ ├── Context Builder (system prompt + memory + skills) │ │
│ │ ├── LLM Provider (API calls) │ │
│ │ ├── Tool Registry (execute tool calls) │ │
│ │ └── Subagent Manager (background tasks) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘

Gateway Lifecycle

  1. Load configuration from ~/.viben/config.yaml
  2. Initialize enabled channels (Telegram, Discord, etc.)
  3. Start the message bus
  4. Start the agent loop
  5. Process messages until shutdown

Output Examples

viben gateway start (Human-readable):

Gateway starting...
Agent: main
Model: claude-sonnet-4-20250514
Channels:
✓ telegram connected @my_bot
✓ discord connected MyBot#1234
○ whatsapp disabled
○ feishu disabled

Gateway running. Press Ctrl+C to stop.

viben gateway start --json:

{
"success": true,
"data": {
"status": "running",
"agent": "main",
"model": "claude-sonnet-4-20250514",
"channels": [
{"name": "telegram", "status": "connected", "identifier": "@my_bot"},
{"name": "discord", "status": "connected", "identifier": "MyBot#1234"}
],
"pid": 12345
}
}

viben gateway status (Human-readable):

Gateway Status: Running

Host: 127.0.0.1
Port: 18790
PID: 12345
Agent: main
Uptime: 2h 15m

Channels:
telegram connected @my_bot 2h ago
discord connected MyBot#1234 2h ago

Health:
✓ Message bus: healthy
✓ Agent loop: healthy
✓ Memory usage: 128MB

API Endpoints

The gateway provides the following HTTP APIs after startup:

EndpointDescription
GET /healthHealth check
GET /api/agentAgent management
GET /api/sessionsSession management
POST /api/chatChat API
GET /api/providersProvider configuration
GET /api/modelsModel configuration

Default address: http://127.0.0.1:18790