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.
A BotOS(agent=..., ...) or praisonai gateway start with no reliability= argument is now safe by default — the gateway picks a bounded admission ceiling, a fair wait queue, strict outbound ordering, and a drain window sized to the bind (loopback → 5s, real interface → 15s). The reliability= preset is still there for callers who want to override that.
Any code that passes nothingBotOS(agent=agent) or praisonai gateway start with no --reliability — silently upgrades to the safe posture. Two behaviours change observably: a burst that used to fan out unboundedly now queues (or rejects when the queue is full), and a SIGTERM-then-kill loop now waits 5–15s for in-flight turns. To revert, pass reliability="off" (or --reliability off). Code that already passes reliability="default" keeps its exact current behaviour (PraisonAI #3438).

Quick Start

1

Simplest — safe by default

No reliability= needed. The gateway resolves admission, a fair queue, strict ordering, and a bind-aware drain:
2

Force the full production window even on loopback

3

Explicit opt-out (revert to pre-#3438 immediate teardown)

4

YAML — set reliability: at the top level

Run with:
5

CLI flag — override any YAML value

The CLI flag takes the highest precedence and overrides whatever is in the YAML file.
6

Override individual settings after the preset

Explicit kwargs on BotOS always win over the preset:

Profiles

Four distinct postures. The unset posture is bind-aware, so it appears twice. The safe posture (unset) and production both enable strict per-conversation FIFO delivery on the outbox — see Outbound Ordering. "default" and "off" keep best_effort for backward compatibility.

How It Works

The resolver _reliability.py converts the profile string into concrete values for drain_timeout, max_concurrent_runs, and admission_policy. Those values are passed directly to the underlying WebSocketGateway build step. Precedence (highest → lowest):
  1. Explicit kwargs on BotOS.__init__ — e.g. drain_timeout=30, outbound_ordering="strict"
  2. reliability= preset — e.g. "production"
  3. SDK defaults
outbound_ordering= is also an explicit kwarg that overrides the preset. Passing outbound_ordering="strict" (or "best_effort") always wins over the profile’s choice; unknown values raise ValueError at resolve time.

Configuration Surfaces

Python

YAML

Both placements are accepted:

CLI


Common Patterns

Production deployment

A non-loopback bind auto-selects the full production window — no reliability= argument needed:

Extend the drain window for slow agents

Production preset with per-thread ordering

The production preset enables strict ordering; pass a custom lane_key to order sends within a shared channel:

Disable all backpressure for development


Best Practices

Pass reliability="off" for no drain and no admission, or reliability="default" for a 5 s drain with no admission ceiling. Neither is a recommended default — they exist for callers who explicitly want the pre-#3438 shape.
Explicit YAML keys like gateway.drain_timeout override the preset. That is correct behaviour when you need to tune a single value, but it can surprise you if you forget the preset was set.
An unrecognised profile (e.g. reliability: "fast") raises at startup, not at first request. This fail-fast behaviour is intentional — silent fallback to default would hide misconfiguration.
Deploying a new preset to a single pod via the CLI flag lets you validate behaviour before updating the shared gateway.yaml.

Gateway Overview

Bot gateway architecture and core concepts

Gateway Graceful Drain

In-flight turn drain on shutdown or reload

Gateway Admission Control

Cap concurrent runs and queue overflow requests

Gateway Flow Control

Back-pressure and send-policy options

Outbound Ordering

Per-conversation FIFO delivery the production preset turns on