`praisonai gateway status` is not machine-consumable: no `--json`, a hardcoded `1.0.0` version, and no single unified snapshot
Summary
The gateway already computes almost everything an operator or monitoring system needs — uptime, active session/client counts, per-channel supervision state, degraded owners, applied-vs-on-disk config revision and drift, and back-pressure telemetry. But the top-level operator command that exposes it, praisonai gateway status, has no --json flag, so its output cannot be parsed by scripts, health checks, or dashboards. This is inconsistent with sibling commands: gateway doctor and gateway test both support --json.
Two further rough edges compound it:
- The lightweight
GET /infoendpoint reports a hardcoded version string"1.0.0"(and the MCPserverInfoversion is likewise hardcoded), rather than the installed package version — so automated version/upgrade checks are actively misled. - There is no single snapshot an operator can fetch in one call: the rich data (
applied_config_revision,config_drift, degraded owners, delivery backlog) lives only onGET /health, whileGET /inforeturns a different, thinner set. Answering "is my gateway healthy, on the right config, and what version" requires combining/info,/health, andgateway status --deep.
For a gateway that aims to be world-class and easy to operate, "what is the state of my gateway" should be answerable in one machine-readable call.
Current behaviour
gateway status has no --json (unlike gateway doctor/gateway test) — src/praisonai-bot/praisonai_bot/cli/commands/gateway.py:553:
def status(
deep: bool = typer.Option(False, "--deep"),
probe: bool = typer.Option(False, "--probe"),
daemon_only: bool = typer.Option(False, "--daemon-only"),
# no --json flag; output is human-only text
): ...GET /info returns a hardcoded version (src/praisonai-bot/praisonai_bot/gateway/server.py:1628):
# GET /info (server.py:1621)
return {"name": ..., "version": "1.0.0", "agents": ..., "sessions": ..., "clients": ..., "api": ...}The MCP server info is hardcoded the same way (src/praisonai-bot/praisonai_bot/gateway/api_endpoints.py:873):
"serverInfo": {"name": ..., "version": "1.0.0"}The genuinely rich data exists but only on /health (src/praisonai-bot/praisonai_bot/gateway/server.py:6374), not on /info:
def health(self):
return {
"status": ..., "uptime": ...,
"channels": ..., # per-channel health + supervision state
"degraded": ..., # degraded channels/owners
"applied_config_revision": ..., "on_disk_config_revision": ..., "config_drift": ...,
"pressure": ..., # back-pressure telemetry
...
}So the CLI cannot emit JSON, /info misreports the version, and no one endpoint returns health + sessions + degraded + delivery + config-revision together.
Desired behaviour
praisonai gateway status [--json]emits a single, stable, machine-readable JSON payload covering: version, uptime, daemon/service state, active sessions and clients, per-channel health/supervision, degraded owners, delivery backlog (outbox depth / DLQ / dead targets),applied_config_revision+config_drift, and protocol version./info(and the MCPserverInfo) report the installed package version from_version.py, not a hardcoded constant.- The unified snapshot is built once from the existing
GatewayStatusProtocol.snapshot()/GatewayStatuscore dataclass and reused by the CLI--json, the HTTP surface, and the agent-callablegateway_statustool, so all three stay consistent.
Layer placement
- Primary layer: wrapper (
praisonai/praisonai-bot) - Why not core: the introspection data contract already lives in core —
GatewayStatusProtocol.snapshot()returns aGatewayStatusdataclass (run/queued/active_sessions/sessions_by_channel/delivery/degraded). The missing capability is the wrapper surfacing it as--jsonand fixing the version source; the core contract does not need to change (only reuse). - Why not wrapper: — (this is the wrapper) the CLI command, the HTTP
/info//healthhandlers, and the version wiring all live inpraisonai-bot. - Why not tools: this is operator/CLI/HTTP introspection, not an agent-callable integration (the agent-facing
gateway_statustool already exists and should reuse the same snapshot). - Why not plugins: it is not a lifecycle hook, guardrail, or policy — it is first-party operator observability.
- Secondary touch (optional): core — source a single version constant from
praisonaiagents/_version.py/praisonai_bot/_version.pyand (optionally) let the unified payload be assembled from the existingGatewayStatusdataclass so CLI/HTTP/tool agree. - 3-way surface (CLI + YAML + Python): no — this is operator introspection (CLI + HTTP), with the Python path already provided by
GatewayStatusProtocol.snapshot().
Proposed approach
- Extension point: CLI (
--jsonongateway status) + config/version source (real package version) + reuse of the existing coreGatewayStatussnapshot for the HTTP payload. - Minimal API sketch:
# gateway status --json -> prints json.dumps(snapshot) @gateway_app.command() def status(json_output: bool = typer.Option(False, "--json"), deep=..., probe=...): snap = handler.status(deep=deep, probe=probe) # already builds the data if json_output: typer.echo(json.dumps(snap.to_dict(), default=str)) return _render_status_text(snap) # server.py /info from praisonai_bot._version import __version__ return {"name": ..., "version": __version__, "protocol_version": GATEWAY_PROTOCOL_VERSION, ...}
Resolution sketch
# Before (today)
$ praisonai gateway status
Gateway: running (pid 4123) # human-only text, not parseable
$ curl localhost:8000/info
{"name": "...", "version": "1.0.0", ...} # hardcoded version, no config revision / degraded
# After (proposed)
$ praisonai gateway status --json
{"version": "2.x.y", "protocol_version": 1, "uptime_s": 3600,
"active_sessions": 3, "clients": 2,
"channels": {"telegram": {"state": "healthy"}},
"degraded": [], "delivery": {"outbox_depth": 0, "dlq": 0, "dead_targets": 0},
"applied_config_revision": "a1b2c3d4e5f6", "config_drift": false}
$ curl localhost:8000/info # reports the installed package version
{"name": "...", "version": "2.x.y", "protocol_version": 1, ...}Severity
Medium — the gateway is production-capable, but the absence of --json blocks monitoring, alerting, and CI health gates from consuming its state, and the hardcoded 1.0.0 version actively misleads upgrade/debug workflows. It is an ease-of-use and operability gap rather than a correctness bug.
Validation
src/praisonai-bot/praisonai_bot/cli/commands/gateway.py:553—gateway statusdeclares--deep/--probe/--daemon-onlybut no--json; confirmedgateway doctorandgateway test(same file) do accept--json.src/praisonai-bot/praisonai_bot/gateway/server.py:1621(/infohandler) and:1628— version returned as the literal"1.0.0".src/praisonai-bot/praisonai_bot/gateway/api_endpoints.py:873— MCPserverInfoversion also hardcoded"1.0.0".src/praisonai-bot/praisonai_bot/gateway/server.py:6374(health()) — confirmedapplied_config_revision,on_disk_config_revision,config_drift, degraded owners and back-pressure telemetry are present on/healthbut absent from/info.src/praisonai-agents/praisonaiagents/gateway/protocols.py—GatewayStatusProtocol.snapshot()/GatewayStatusdataclass already exists in core and can back a unified payload;compute_config_revision(~line 1417) andGATEWAY_PROTOCOL_VERSIONare available to include.- Searched open/closed issues for gateway status
--json/machine-readable/version — none found; this is not a duplicate.
Source: MervinPraison/PraisonAI