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.yaml against the running config and restarts only affected agents or channels. The WebSocket server keeps running.
gateway.yaml on disk; the watcher diffs changes and reloads only affected agents or channels while the WebSocket server stays up.
How It Works
Quick Start
Edit live
Change agent instructions or a single channel token in
gateway.yaml and save. The watcher applies a selective reload within ~5 seconds (1s debounce).Event-driven vs Polling
The watcher prefers event-driven file notifications via the optionalwatchdog package and falls back gracefully to mtime polling when watchdog is unavailable or an observer cannot start.
| Mode | How it works | When used |
|---|---|---|
| Event-driven | OS file-system events via watchdog | watchdog>=3.0.0 installed |
| mtime polling | Periodic stat check every 5s | watchdog not installed or observer fails |
watchdog for faster reload detection:
watchdog is optional — without it, polling continues exactly as before. Install it only when faster reaction times matter.Operator-triggered Reload via SIGHUP
start_with_config installs a SIGHUP handler that runs the same reload_config path as a file-change reload — no shutdown, no dropped connections.
Reload via SIGHUP is best-effort — it is silently skipped on platforms without SIGHUP support (e.g. Windows).
Drain-coordinated Channel Restart
When a reload triggers a channel restart, the gateway drains in-flight turns before bouncing the channel — no mid-conversation cuts. The drain window for reload-triggered restarts is controlled by a new YAML key:Restart Scope
| Changed section | Effect |
|---|---|
agents.* | Recreate agents only — channels keep running |
channels.<name>.* | Restart only that channel |
provider.*, guardrails.* | Recreate agents |
scheduler.*, routes.*, routing.* | Full channel restart |
Entire channels section | Full channel restart |
| Invalid YAML on save | Keep last-known-good config |
Observability
Reloads log a concise summary line on completion:reload applied: <changed-sections>; restart[<channels>]. Grep for reload applied to trace all reloads in your log stream.
Tuning
| Setting | Default | Description |
|---|---|---|
| Poll interval | 5.0s | How often the mtime watcher checks the file |
| Debounce | 1.0s | Wait after last write before applying |
gateway.reload_drain_timeout | falls back to gateway.drain_timeout | Bounded drain window before a reload-triggered channel restart |
Backward compatibility: Leaving
reload_drain_timeout unset preserves the prior immediate-restart behaviour. Not installing watchdog keeps polling as before. This is a fully additive change.Best Practices
Prefer agent-only edits for prompt tweaks
Prefer agent-only edits for prompt tweaks
Changing
agents.* avoids dropping live Telegram/Discord sessions.Scope channel edits narrowly
Scope channel edits narrowly
Edit one channel block to restart only that platform.
Validate YAML before saving
Validate YAML before saving
Invalid saves are ignored — the previous config keeps running.
Use SIGHUP in systemd for zero-downtime config pushes
Use SIGHUP in systemd for zero-downtime config pushes
Add
ExecReload=kill -HUP $MAINPID to your systemd unit so systemctl reload triggers a drain-coordinated reload without stopping the process.Related
Bot Gateway
Gateway server overview
Gateway Channel Supervision
Self-healing channels
Code-Skew Guard
Detect in-place code updates and refuse hot operations until the process restarts.
Gateway Reliability Preset
One switch to compose drain + admission control

