Gateway provides a WebSocket-based control plane for coordinating multiple agents, managing sessions, and enabling real-time communication between agents and clients.Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
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 |
push | PushConfig | PushConfig() | Push notification service configuration (disabled by default) |
Push Notifications
Gateway hosts real-time push notification channels for WebSocket and polling-based pub/sub communication between clients.Real-Time Push Notifications
Learn about channel-based pub/sub, presence tracking, and delivery guarantees
YAML Configuration (gateway.yaml)
Configure the gateway with a gateway.yaml file for multi-platform deployment:
Multi-Instance Platforms
Run multiple bots on the same platform using theplatform: field:
Routing Rules
Route messages to different agents based on context:| Context | Description | Example |
|---|---|---|
dm | Direct/private messages | Personal assistant |
group | Group/guild messages | Team support |
channel | Channel messages | Announcements |
default | Fallback for unmatched | General agent |
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
Graceful Shutdown
Long-running servers can stop the wrapper’s background async loop explicitly:shutdown() is also registered via atexit, so it runs automatically on interpreter exit. Call it manually when you need deterministic cleanup (flushing telemetry exporters, closing async HTTP/DB clients) before the process exits.
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.Related
Multi-Agent Workflows
Coordinate multiple agents
Sessions
Manage conversation state

