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.For the composed one-switch experience, see Reliability Preset. This page documents the admission-control knob in isolation.
Admission control bounds concurrent inbound runs. For a bound on request rate per identity, see Gateway Rate Limit.
Quick Start
For a one-switch preset that turns on admission with sensible defaults alongside graceful drain, see Gateway Reliability Presets.
How It Works
| Decision | When | What the user sees |
|---|---|---|
ADMIT | in_flight < max_concurrent_runs | Immediate response |
QUEUE | At ceiling, queue has room | Brief wait, then response |
REJECT | Queue full and policy is reject (or shed_oldest can’t evict) | Friendly busy acknowledgement |
Configuration Options
The three fields live onGatewayConfig (read from praisonaiagents/gateway/config.py):
| Option | Type | Default | Description |
|---|---|---|---|
max_concurrent_runs | int | 0 | Max concurrent inbound agent runs across all users. 0 disables the gate (legacy behaviour). |
queue_depth | int | 128 | Max number of inbound turns that can wait when at the ceiling. |
overflow_policy | str | "reject" | Behaviour when at the ceiling and the queue is full: reject, queue, or shed_oldest. |
Python
YAML (gateway.yaml)
CLI
Common Patterns
Production multi-tenant bot — explicit busy ack under load; no OOM risk; no provider 429 storm:shed_oldest can’t evict a live waiter, the newcomer is rejected rather than overfilling the queue:
Observability
BotOS.admission_stats exposes live counters without any extra setup:
rejected alongside your LLM provider’s 429 rate. When both rise together, raise max_concurrent_runs. When only rejected rises, deepen queue_depth or switch to overflow_policy="queue".
Best Practices
Start with max_concurrent_runs ≈ 2× expected steady-state
Start with max_concurrent_runs ≈ 2× expected steady-state
Set
max_concurrent_runs to roughly twice your expected concurrent-user baseline. Watch admission_stats.rejected — if rejections are non-zero under normal load, raise the ceiling.Default to overflow_policy='reject' for multi-user deployments
Default to overflow_policy='reject' for multi-user deployments
Silent unbounded queueing under load is harder to debug than an explicit busy ack.
reject surfaces pressure immediately and lets users retry on their own schedule.Pair with flow control for full gateway protection
Pair with flow control for full gateway protection
Admission control bounds inbound concurrent runs; flow control bounds outbound send throughput and per-session inbox depth. Production gateways usually want both.
Leave the gate off only for single-user or local dev
Leave the gate off only for single-user or local dev
max_concurrent_runs=0 (the default) disables the gate entirely — every inbound turn runs immediately. Suitable for local development or single-operator deployments where there is no shared provider quota to protect.Related
Gateway Reliability Presets
One switch that turns on admission + graceful drain with sensible defaults
Gateway Flow Control
Outbound counterpart — bounded inboxes and slow-consumer disconnect
Gateway Rate Limit
Bound inbound turns per identity/scope with a sliding window or custom limiter
Gateway Overview
Full gateway architecture and feature index

