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
| Command | Description |
|---|---|
viben gateway start | Start the gateway, supports --host, --port, --log-level, --agent, --daemon |
viben gateway stop | Stop a running gateway, supports --port to specify port |
viben gateway restart | Restart the gateway (stop then start), supports all start options |
viben gateway status | Check gateway running status and health |
Options
| Option | Description | Default |
|---|---|---|
-h, --host <host> | Gateway listen address | 127.0.0.1 |
-p, --port <port> | Gateway listen port | 18790 |
-l, --log-level <level> | Log level (debug, info, warn, error) | info |
-n, --agent <agent-id> | Specify the agent to run | main |
-d, --daemon | Run in background mode | false |
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
- Load configuration from
~/.viben/config.yaml - Initialize enabled channels (Telegram, Discord, etc.)
- Start the message bus
- Start the agent loop
- 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:
| Endpoint | Description |
|---|---|
GET /health | Health check |
GET /api/agent | Agent management |
GET /api/sessions | Session management |
POST /api/chat | Chat API |
GET /api/providers | Provider configuration |
GET /api/models | Model configuration |
Default address: http://127.0.0.1:18790
Related Commands
- viben channel - Channel management
- viben cron - Scheduled task management
- viben agent - Agent management