Bot platform adapters now ship in the
praisonai-bot package. praisonai bot serve still works exactly as documented here; for a standalone install see praisonai-bot Migration.praisonai gateway start now applies the same smart defaults as praisonai bot start, resolving the previous “zero tools in daemon mode” issue. Both entry points produce identical behavior with safe tools auto-injected and auto-approval enabled by default.
Each channel bot gets an isolated agent via Agent.clone_for_channel() — fresh locks, fresh interrupt controller, and no shared handoffs state — so configuring tools or memory on one channel never leaks into another.
Quick Start
Create gateway.yaml
Create a
gateway.yaml file in your project (Gateway YAML files are read as UTF-8 — non-ASCII characters work on all platforms including Windows):Supported Channels
Telegram
Full support for DMs, groups, commands, voice, and media.
Discord
Guild channels, DMs, slash commands, and embeds.
Slack
Socket Mode, channels, DMs, slash commands, and threads.
Cloud API and Web mode. DMs, groups, media support.
Windows users: Gateway Telegram error replies are automatically sanitized to ASCII-safe text — non-ASCII exception content (warning symbols, emoji, accented characters) no longer crashes the error handler with a
charmap codec error. Real underlying errors (quota, rate limit, auth) surface cleanly.Configuration Reference
Gateway Section
| Field | Type | Default | Description |
|---|---|---|---|
| host | string | 127.0.0.1 | Address to bind the gateway server |
| port | integer | 8765 | Port for the WebSocket server |
Agents Section
Each agent is defined by a unique ID and its configuration:| Field | Type | Default | Description |
|---|---|---|---|
| instructions | string | "" | System prompt for the agent |
| model | string | None | LLM model (e.g., gpt-4o-mini, gpt-4o) |
| memory | boolean | false | Enable conversation memory |
| tools | list | [] | Tool names resolved via ToolResolver |
| reflection | boolean | true | Enable self-reflection / interactive mode |
| role | string | None | Agent role (CrewAI-style) |
| goal | string | None | Agent goal (CrewAI-style) |
| backstory | string | None | Agent backstory (CrewAI-style) |
| tool_choice | string | None | auto, required, or none |
| allow_delegation | boolean | false | Allow task delegation to other agents |
Channels Section
Each channel maps to a bot platform:Channel Security
Each channel enforces the same access-control pipeline as standalone bots.| YAML Key | Type | Default | Purpose |
|---|---|---|---|
token | str | required* | Bot auth token. *Optional for whatsapp web mode and email/agentmail. |
platform | str | channel name | Override channel platform (e.g. telegram). |
routing / routes | dict | {"default": "default"} | Route map: dm, group, default → agent id. |
allowed_users | list[str] | str | [] | User-ID allowlist. Comma-separated string also accepted (env-expansion friendly). |
allowed_channels | list[str] | str | [] | Channel/group-ID allowlist. Same string handling. |
group_policy | str | "mention_only" | One of "mention_only", "command_only", "respond_all". Sets mention_required automatically. |
auto_approve_tools | bool | str | True | Auto-approve safe tools. Strings "1"/"true"/"yes"/"on" are truthy. |
default_tools | list[str] | (BotConfig default) | Per-channel override for default safe tools. |
As of PR #1791, gateway-mode bots enforce the same security pipeline as standalone bots (
praisonai bot start). Previous versions silently bypassed allowed_users, pairing, and group_policy in gateway mode.Pair with
unknown_user_policy: "deny" for the most secure default. To intentionally allow everyone (e.g. internal staging), leave allowed_users empty and set unknown_user_policy: "allow" — both are required.Interactive presentations (optional)
GatewayMessage carries an optional presentation: MessagePresentation field. When set, channel adapters that implement SupportsPresentation render it as a native widget (Telegram inline keyboard, Slack Block Kit, Discord components). Channels that do not implement the protocol fall back to the message’s plain-text content. See Interactive Bot Messages for the full presentation model.
Hot-Reload
Editinggateway.yaml while the gateway runs triggers a diff-driven reload — only affected agents or channels restart. The WebSocket server stays up.
See Gateway Hot-Reload for the full restart-scope table.
CLI Commands
Python Usage
- From YAML
- Programmatic
- Inspect Bots
Advanced: Health Endpoint
Advanced: Health Endpoint
The gateway exposes a health endpoint at Returns:The
http://host:port/health:push section is only included when push notifications are enabled.Advanced: Channel isolation
Advanced: Channel isolation
The gateway calls
_create_bot() to build independent clones for each channel:Each clone has fresh locks and interrupt controllers, preventing cross-channel interference. Learn more about Agent Cloning.Advanced: Standalone Bot Mode
Advanced: Standalone Bot Mode
You can still run a single bot without the gateway:This starts just one bot connected to a single agent — no gateway needed.
BotOS Options
When creating aBotOS instance in Python, the following options control gateway-level behaviour:
| Field | Type | Default | Description |
|---|---|---|---|
bots | list[Bot] | [] | Pre-built Bot instances to orchestrate |
agent | Agent | None | Shared agent for auto-created bots (used with platforms) |
platforms | list[str] | None | Platform names; creates one Bot per platform using the shared agent |
health_monitor | HealthMonitorConfig | None | Channel health monitoring configuration |
enable_supervision | bool | True | Enable automatic channel supervision and recovery |
idle_policy | GatewayIdlePolicyProtocol | None | When set, schedules an idle-dormancy loop that quiesces transports after inactivity. Default None = always-on. See Scale-to-Zero Gateway. |
Observability
Gateway Metrics
Scrape
GET /metrics for Prometheus-format counters and gauges on every
hop of the message flow — no extra dependencies.Correlation IDs
One stable id joins ingress, session, and agent-run logs for every turn.
Read it inside any tool with
current_correlation_id().Gateway Tracing Hook
Open a distributed-tracing span around each pipeline stage — inbound,
admit, agent.run, llm.call, tool.call, outbox.enqueue, delivery.
Code-Skew Guard
After runninggit pull or pip install -U, the gateway’s /model command detects that the installed code version has changed and blocks the model switch with a “restart required” message. This prevents the model from changing when the running code is out of sync with the installed libraries.
To opt out (useful in development):
Best Practices
Lock down empty allowlists
Lock down empty allowlists
Leave
allowed_users empty only with unknown_user_policy: "deny" for production. Pairing mode is fine for personal bots; public gateways need explicit allowlists.Route by channel context
Route by channel context
Map
dm, group, and default to different agents when support and personal assistants should not share memory or tools. Isolated clones prevent cross-channel leakage.Use environment variables for tokens
Use environment variables for tokens
Reference tokens as
${TELEGRAM_BOT_TOKEN} in YAML — never commit secrets. Gateway resolves env vars at load time on all platforms including Windows.Monitor via /health and /metrics
Monitor via /health and /metrics
Poll the health endpoint during deploys and wire Gateway Metrics into Prometheus for message-flow visibility.
Related
Bind-Aware Auth
Token auth and loopback bypass for gateway operational endpoints.
Gateway Error Handling
Supervision, restarts, and error recovery in the gateway.
Gateway Metrics
Prometheus-format message-flow metrics from
GET /metrics.Correlation IDs
Join ingress, session, and agent-run logs on one stable id per message.

