Skip to main content
Run your agents under a Type=notify systemd unit and the gateway tells systemd when it is really serving, proves its event loop is alive, and announces clean drains — with no new config.
There is no new config key, CLI flag, env var, or Python export. systemd sets $NOTIFY_SOCKET for Type=notify units, and that alone switches the notifier on. Without it, the notifier task is never created.

Quick Start

1

Define your agent as usual

Nothing systemd-specific goes in the agent config.
2

Install the generated unit

The generated unit now contains Type=notify, NotifyAccess=main, and WatchdogSec=30, so systemctl start returns only once the gateway is accepting connections.
3

Or hand-write the unit

Running the gateway anywhere else — plain CLI, Docker without the socket, launchd, Windows — behaves exactly as before.

How It Works

The notifier runs as a task on the gateway’s own event loop, so a wedged loop stops the pings.

What the gateway sends

All of this is a no-op when $NOTIFY_SOCKET is unset. Delivery is non-blocking and fail-open: a socket error never stalls or crashes the gateway. If the unit has no WatchdogSec, WATCHDOG=1 is never sent; READY=1, the pre-ready EXTEND_TIMEOUT_USEC, and STOPPING=1 still are.

Generated vs hand-written unit

Both units use the same three notify settings.
~/.config/systemd/user/praisonai-bot.service (written by praisonai-bot gateway install):
Units installed before this change stay Type=simple and keep working. Re-run praisonai-bot gateway install to regenerate the unit with Type=notify.

Interaction with existing features

The systemd watchdog is externally enforced and complements the in-process safety nets.

Troubleshooting

systemd has not received READY=1. Check that ExecStart runs Python directly (required by NotifyAccess=main) and that the gateway actually reaches serving — a port bind failure or crash before uvicorn starts means readiness is never sent. After editing the unit, run systemctl --user daemon-reload.
The gateway event loop is wedged and stopped sending WATCHDOG=1. The journal shows a Watchdog timeout entry; enable the in-process Event-Loop Watchdog to get stack dumps that show where the loop is blocked.
The container must receive $NOTIFY_SOCKET and the socket itself — for example podman run --sdnotify=container, or an sd-notify-aware init in place of tini/dumb-init. Abstract-namespace sockets (NOTIFY_SOCKET=@name) are supported.

Best Practices

Outside systemd the notifier never starts, so there is nothing to disable. Use Type=simple in a hand-written unit only if you do not want readiness gating.
Shorter deadlines can trip on long first-boot pauses and cause flaky restarts.
The watchdog pulls you out of wedges; the exit-code contract keeps you out of config-error crash loops.
An existing unit is not changed by upgrading the package. Run praisonai-bot gateway install again to rewrite it with Type=notify.

Gateway Exit Codes

Exit 0 / 75 / 78 contract for supervisors

Event-Loop Watchdog

In-process wedge detection with stack dumps

Startup Watchdog

Guard the pre-loop startup window

24/7 Production Minimal

Minimal always-on deployment guide