Gateway Safe Mode
Boot the gateway core-only to isolate whether a fault is in the core or an extension
Safe mode boots the gateway with external plugins and inbound YAML hooks disabled so an operator can tell whether a fault is in the core or an extension in one restart.
Quick Start
- One restart
bash praisonai gateway start --config gateway.yaml --safe-mode # → logs: SAFE MODE: N inbound hook(s) disabled; external plugins skipped (PRAISONAI_NO_PLUGINS) - Via env var (crash loops / supervisors)
bash PRAISONAI_NO_PLUGINS=1 praisonai gateway start --config gateway.yaml
How It Works
The CLI flag sets PRAISONAI_NO_PLUGINS=1 for the gateway process and forwards safe_mode=True to the handler; the server then skips inbound hook registration and logs the SAFE MODE: line before it listens.
The flag has three equivalent names — --safe-mode, --pure, --no-plugins — matching the aliases already used by praisonai run / chat / code. The env var PRAISONAI_NO_PLUGINS=1 is equivalent and useful where editing CLI args is awkward.
What Is Suppressed vs. Kept
Safe mode suppresses only extensions — the core agent and your configured channels keep serving traffic.
| Component | Normal mode | Safe mode |
|---|---|---|
| Core agent | On | On |
| Configured channels (incl. entry-point channels) | On | On |
| External plugins (entry-point discovery) | Loaded | Skipped |
Inbound YAML hooks: block | Registered | Skipped (logged) |
| Forensics / scale-to-zero / crash-loop guard / config reload | On | On (own toggles) |
.praisonai/config.yaml | Unchanged | Unchanged |
When To Use It
Reach for safe mode first when you cannot tell whether a fault lives in the gateway core or in an extension.
Common Patterns
Bisect a fault — if a safe-mode boot is green, the problem is a plugin or hook; if it is still red, it is the gateway core:
praisonai gateway start --config gateway.yaml --safe-modeSupervised crash loop — set the env var in the service unit so the next crash-looped restart boots core-only:
PRAISONAI_NO_PLUGINS=1 praisonai gateway start --config gateway.yamlPair with the gateway doctor — confirm which plugins would load, then boot safe mode to compare:
praisonai gateway doctor --config gateway.yaml
praisonai gateway start --config gateway.yaml --safe-modeExit safe mode with a fresh start (not restart):
praisonai gateway start --config gateway.yamlBest Practices
Prefer the CLI flag over the env var in bug reports
The flag’s intent is explicit in the command line, so a reproduction is unambiguous.
Watch for the SAFE MODE: log line
That WARNING line is the single source of truth that safe mode is active and names how many inbound hooks were disabled.
Remember restart stays in safe mode
praisonai gateway restart replays the persisted safe-mode posture — exit with a fresh gateway start without the flag.
Safe mode is not a security posture
It is a triage switch, not authorization — use proper channel and token controls to secure the gateway.