Skip to main content

Viben Gateway

Axum-based HTTP/WebSocket API server providing AI agent orchestration and management services.

Overview

Viben Gateway is the core backend service of Viben, running on port 18790, providing:

  • RESTful API services
  • WebSocket real-time communication
  • Server-Sent Events (SSE) streaming
  • Multi-agent orchestration and coordination

Architecture

Viben Gateway (Port: 18790)

├── HTTP Layer (Axum)
│ ├── CORS Middleware (Allow All Origins)
│ ├── Tracing Middleware (Request/Response Logging)
│ └── Router

├── API Routes
│ ├── /health Health Check
│ ├── /api/agent Agent Management
│ ├── /api/executors Executor Management
│ ├── /api/models Model Management
│ ├── /api/providers Provider Management
│ ├── /api/tasks Task Management
│ ├── /api/sessions Session Management
│ ├── /api/channels Channel Management
│ ├── /api/cron Scheduled Tasks
│ ├── /api/queue Task Queue
│ ├── /api/workspaces Workspace Management
│ ├── /api/mcp MCP Server Management
│ ├── /api/kanban Kanban Data Management
│ ├── /api/group-chats Group Chat Management
│ ├── /api/chat-list Chat List Aggregation
│ ├── /api/telemetry Observability Data
│ └── /api/events SSE Event Stream

├── WebSocket Routes
│ ├── /ws General WebSocket
│ ├── /api/group-chats/:id/sessions/:sid/ws Group Chat WS
│ └── /terminal/ws Terminal WebSocket

└── Storage Layer
├── Global: ~/.viben/
└── Workspace: <project>/.viben/

Service Configuration

SettingDefaultDescription
Port18790HTTP/WebSocket service port
CORSAllow AllCross-origin request configuration
LoggingTracingRequest/response logging

API Endpoint Index

ModulePath PrefixSpecification
Health Check/healthhealth.md
Agents/api/agentagents.md
Executors/api/executorsexecutors.md
Models/api/modelsmodels.md
Providers/api/providersproviders.md
Tasks/api/taskstasks.md
Sessions/api/sessionssessions.md
Channels/api/channelschannels.md
Scheduled Tasks/api/croncron.md
Task Queue/api/queuequeue.md
Workspaces/api/workspacesAPI Reference
MCP/api/mcpAPI Reference
Kanban/api/kanbanAPI Reference
Group Chats/api/group-chatsgroup-chats.md
Chat List/api/chat-listchat-list.md
Telemetry/api/telemetrytelemetry.md
Event Stream/api/eventsevents.md
WebSocket/ws, /terminal/wswebsocket.md

Workspace Scope

All resources support two scope levels:

Global Scope: ~/.viben/
├── agents/ Global Agents
├── providers/ Provider Configuration
├── models.yaml Model Configuration
├── channels.yaml Channel Configuration
└── sessions/ Session Storage

Workspace Scope: <project>/.viben/
├── agents/ Workspace Agents
├── group-chats/ Group Chats
└── config.yaml Workspace Configuration

Query Parameters:

  • workspace_path: Workspace path (absolute path)
  • include_global: Whether to include global resources (default true)

Common Response Format

Success Response

{
"id": "resource-id",
"name": "Resource Name",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"workspace_path": "/path/to/workspace",
"source": "global",
"is_global": true
}

Error Response

{
"error": "Error message",
"code": "ERROR_CODE",
"details": {}
}

Starting Gateway

# Start Gateway
pnpm gateway:build # Build and start
pnpm gateway:restart # Restart existing Gateway

# Health check
curl http://127.0.0.1:18790/health