The gateway now ships in the
praisonai-bot package. praisonai serve gateway still works exactly as documented here; for a standalone install see praisonai-bot Migration.Quick Start
How It Works
TheRelayAdapter maintains a persistent outbound WebSocket connection to the relay gateway. Platform messages arrive through that channel instead of requiring an inbound webhook. Because the connection is outbound-only, the bot runs behind NAT or in a private network with no firewall rules.
When to Use Relay Transport
| Scenario | Recommended approach |
|---|---|
| Public cloud with static IP | Standard webhook |
| Private network / NAT | RelayAdapter |
| Ephemeral compute (Fly.io, serverless) | RelayAdapter + go_dormant() |
| Multi-region bot fleet | RelayAdapter (one relay per region) |
Configuration
RelayAdapter
| Parameter | Type | Default | Description |
|---|---|---|---|
url | str | (required) | WebSocket URL of the relay gateway |
reconnect_interval | float | 5.0 | Seconds between reconnect attempts |
max_reconnects | int | 0 | Max reconnect attempts (0 = unlimited) |
Bot(transport=...)
CLI
| Flag | Description |
|---|---|
--platform | Platform adapter to use (telegram, slack, discord, …) |
--to | WebSocket URL of the relay gateway |
go_dormant()
go_dormant() disconnects the relay transport cleanly when the bot is idle, enabling scale-to-zero hosting. The bot wakes up automatically when a new message arrives and the transport reconnects.
Best Practices
Keep relay URLs internal
Keep relay URLs internal
The relay URL is an internal control plane endpoint. Do not expose it publicly — it should only be reachable from your bot’s network.
Set reconnect_interval based on your SLO
Set reconnect_interval based on your SLO
The default 5-second reconnect is suitable for most bots. Reduce it if you need sub-second reconnection; increase it on flaky networks to avoid reconnect storms.
Combine with durable delivery
Combine with durable delivery
On reconnect the relay may miss messages. Enable Durable Delivery so the outbound outbox survives relay disconnections.
Use go_dormant() only when truly idle
Use go_dormant() only when truly idle
Call
go_dormant() only after all in-flight agent turns complete. The relay closes the WebSocket, so any in-progress sends will fail if the turn is still running.Related
Gateway Scale-to-Zero
Full idle policy and wake URL configuration
Bot Gateway
Core bot gateway concepts
Durable Delivery
Crash-safe outbound message delivery
Gateway CLI
All
praisonai gateway subcommands
