The PraisonAI Gateway enables multi-channel agent deployment through a WebSocket server that coordinates communication between agents and various platforms.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
Install Gateway Dependencies
Install both bot and API dependencies for gateway functionality:The
[api] extra provides uvicorn, fastapi, and starlette required by the gateway server.How It Works
| Component | Role |
|---|---|
| Gateway Server | Manages WebSocket connections and routes messages |
| Channels | Platform-specific integrations (Telegram, Discord, etc.) |
| Router | Directs messages to appropriate agents based on rules |
| Agents | Process messages and generate responses |
Architecture Principles
Single Instance Rule
Critical: Only run one gateway process per machine. Multiple processes conflict:- Both try to bind port 8765
- Both poll the same Telegram token (causes 409 conflicts)
- Session state becomes inconsistent
Channel Isolation
Each channel operates independently:- Separate token per platform
- Independent routing rules
- Isolated session management
- Per-channel error handling
Fail-Safe Design
The gateway implements fail-safe patterns:- Health checks at
/healthendpoint - Automatic reconnection for platform polling
- Graceful degradation when agents are unavailable
- Request timeout handling (25-30 seconds for RAG)
Gateway Modes
Multi-Channel Mode
Multi-Channel Mode
Run multiple platforms simultaneously:Each channel requires a unique token and can route to different agents.
WebSocket-Only Mode
WebSocket-Only Mode
Pure WebSocket server without chat platforms:Provides WebSocket endpoint for custom client integration.
Agent File Mode
Agent File Mode
Load agents from separate configuration:Separates agent definitions from gateway configuration.
Health Monitoring
The gateway exposes health information:Health Check Limitations
Current implementation limitations:"running": truedoesn’t guarantee platform polling health- No detection of Telegram 409 conflicts until PraisonAI fix ships
- Manual verification required for silent bot issues
Configuration Options
For complete configuration reference, see the auto-generated SDK documentation. The table below shows common options.
| Option | Type | Default | Description |
|---|---|---|---|
host | str | "127.0.0.1" | Gateway bind address |
port | int | 8765 | Gateway port |
max_connections | int | 100 | WebSocket connection limit |
heartbeat_interval | int | 30 | WebSocket ping interval |
session_timeout | int | 3600 | Session expiration in seconds |
Best Practices
Use environment variables for secrets
Use environment variables for secrets
Never hardcode tokens in configuration files:Store tokens in
.env file or environment variables.Implement proper error handling
Implement proper error handling
Monitor gateway logs for platform-specific errors:
Configure resource limits
Configure resource limits
Set appropriate limits based on expected load:
Use unique tokens per channel
Use unique tokens per channel
Each channel must have its own platform token:Never reuse tokens across channels.
Related
Windows Deployment
Complete Windows setup guide
Multi-Channel Telegram
Hermes-style workforce deployment

