Quick Start
How It Works
| Component | Role |
|---|---|
| Gateway | Central hub managing connections and routing |
| Session | Isolated conversation context per client |
| Agent | AI worker processing requests |
| Event | Structured message for communication |
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
host | str | "127.0.0.1" | Host to bind to |
port | int | 8765 | WebSocket port |
auth_token | str | None | Authentication token |
max_connections | int | 1000 | Maximum concurrent connections |
heartbeat_interval | int | 30 | Heartbeat interval in seconds |
reconnect_timeout | int | 60 | Reconnection timeout |
ssl_cert | str | None | SSL certificate path |
ssl_key | str | None | SSL key path |
Event Types
Gateway uses typed events for communication:| Event Type | Description |
|---|---|
MESSAGE | Text message between parties |
CONNECT | Client/agent connected |
DISCONNECT | Client/agent disconnected |
ERROR | Error notification |
HEARTBEAT | Keep-alive ping |
BROADCAST | Message to all clients |
Common Patterns
- Multi-Agent Chat
- Secure Gateway
- Session Management
CLI Commands
Best Practices
Use authentication in production
Use authentication in production
Always set
auth_token when exposing the gateway beyond localhost. This prevents unauthorized access to your agents.Configure appropriate timeouts
Configure appropriate timeouts
Set
session_config.timeout based on your use case. Long-running tasks need longer timeouts, while chat applications can use shorter ones.Enable SSL for remote access
Enable SSL for remote access
Use
ssl_cert and ssl_key when the gateway is accessible over the network. This encrypts all WebSocket traffic.Monitor connection limits
Monitor connection limits
Set
max_connections based on your server capacity. Monitor active connections to prevent resource exhaustion.
