Skip to main content
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.
Gateway CLI provides commands for starting, monitoring, and managing the PraisonAI Gateway server and its daemon service, including channel supervision controls for resilient bot management.
This page documents the WebSocket multi-agent Gateway daemon. The canonical CLI command is praisonai-bot gateway start (bot-tier package). When the praisonai wrapper is co-installed, praisonai gateway start works as a convenience alias.For the UI-Gateway (Pattern C integration), see praisonai serve ui-gateway.For detailed information about channel resilience and operator controls, see Channel Supervision.
The user runs praisonai gateway start; the CLI launches the daemon, supervises channels, and keeps the WebSocket gateway reachable.

How It Works

Quick Start

The gateway runs in the foreground. The daemon is installed by praisonai-bot gateway install (or automatically by praisonai-bot onboard).
1

Start Gateway

Only one gateway can run per host:port. Stop the existing one with praisonai-bot gateway stop first, or use a different port.
2

Check Status

3

Test Health Endpoint


Commands

Gateway Management

praisonai-bot gateway status is safe to run on any platform. On Windows, if PID-lock inspection can’t complete, the /health probe still runs and shows the authoritative gateway status.

Daemon Service

Channel Control

Inbound Hooks

See Gateway Inbound Hooks for full details.

Testing & Debugging


Command Reference

--reliability overrides the reliability: / gateway.reliability: key in YAML. See Gateway Reliability Presets for profile details and precedence rules.
Corporate proxies / SSL-inspecting networks. A preflight failure caused only by SSLCertVerificationError / certificate_verify_failed does not abort the start — the token is usually valid and the runtime adapter’s SSL stack is more permissive. The gateway prints a one-line warning naming the three CA-bundle env vars and continues.If any channel also fails for a non-SSL reason (bad token, unreachable host, timeout), preflight still hard-aborts — fix that channel or pass --no-preflight. See Corporate CA bundle (SSL-inspecting networks).

Pre-flight credential check

praisonai gateway doctor validates every channel’s token before the gateway starts, so a bad or expired credential fails fast with a precise per-channel reason instead of disappearing into the supervisor’s silent reconnect loop.

Examples

Quick health check:
A non-SSL failure keeps the bare error string:
CI-friendly JSON:
Same verdict via the listing command:

Pre-flight gate on start

praisonai gateway start runs the same probe automatically before launch when invoked with --config gateway.yaml:
To bypass during local dev (e.g. flaky probe network):

Corporate CA bundle (SSL-inspecting networks)

On networks that intercept TLS with a corporate CA (proxy / MITM), the probe’s HTTP client can reject the certificate chain even though the token is valid and the runtime adapter connects fine. Preflight classifies these SSL cert-verify failures separately and soft-fails when they are the only failures.
The probe decides its action from the mix of failures:
Only certificate-verify failures soft-fail. Other TLS handshake failures — WRONG_VERSION_NUMBER, NO_SHARED_CIPHER, HANDSHAKE_FAILURE — still hard-abort, because they usually indicate a real bug that also breaks the channel at runtime.
Point the probe at your corporate CA with one of three env vars, highest precedence first:
A configured-but-missing path warns and leaves the SSL env vars untouched:
The runtime adapter reads the same three env vars, so setting one fixes both the preflight probe and long-lived channel connections.

Token resolution

The probe loads ~/.praisonai/.env first, so ${VAR} placeholders set by praisonai onboard resolve exactly like they do at runtime — doctor, channels --probe, and start --preflight all share the same token-resolution path.

Per-channel timeout

Each probe is bounded by a 15-second deadline; a stuck adapter is reported as "probe timed out after 15s" and does not hang the aggregate.

Exit codes

When to use which


Environment Variables

The GATEWAY_PORT environment variable is used by start, stop, and status commands when the --port option is not explicitly provided. Invalid values silently fall back to 8765.

Single-Instance Enforcement

PraisonAI enforces a single gateway instance per host:port combination using PID locks. Lock File Location: ~/.praisonai/gateway-<safe_host>-<port>.pid The safe_host replaces : and . with _ (so 127.0.0.1 becomes 127_0_0_1). Each host:port combination gets its own lock file, allowing multiple gateways on different ports.

PID-Lock Status Reference

praisonai gateway status prints one PID-lock line before the /health probe. Look up any line you see: The port line (Port <host>:<port>: In use / Available) follows the same section unless PID-lock inspection fails, in which case the single PID lock status: Unavailable (<error>) line replaces both.

Restart the Daemon

Use these OS-specific commands to restart the daemon service (same commands shown in the onboard Done panel):

Status Output Examples

Healthy Gateway

PID Lock Unavailable (Windows)

On Windows, os.kill(pid, 0) can raise SystemError. From PraisonAI ≥ v4.6.141 the PID-lock inspection is advisory only — this line replaces Gateway PID lock: … / Port …: … when the check fails, and the /health probe still runs so you still see the real status.

Daemon Issues

Not Installed


Platform Support

Gateway CLI works across platforms with native daemon integration:

Configuration Files


Best Practices

Use --daemon-only flag when monitoring daemon status in scripts or CI/CD pipelines to avoid gateway connection attempts.
Always check praisonai gateway logs when the daemon is running but gateway is unreachable - this reveals startup errors.
Use praisonai gateway send to test channel bot configuration before deploying to production environments.
Set up monitoring that runs praisonai gateway status --daemon-only to detect service failures quickly.

Gateway Server

Gateway architecture and configuration

Troubleshooting

Common gateway issues and solutions