Skip to content

prx daemon

Start the full PRX runtime. The daemon process manages all long-running subsystems: the HTTP/WebSocket gateway, messaging channel connections, the cron scheduler, and the self-evolution engine.

Usage

bash
prx daemon [OPTIONS]

Options

FlagShortDefaultDescription
--config-c~/.config/prx/config.tomlPath to configuration file
--port-p3120Gateway listen port
--host-H127.0.0.1Gateway bind address
--log-level-linfoLog verbosity: trace, debug, info, warn, error
--no-evolutionfalseDisable the self-evolution engine
--no-cronfalseDisable the cron scheduler
--no-gatewayfalseDisable the HTTP/WS gateway
--pid-fileWrite PID to the specified file

What the Daemon Starts

When launched, prx daemon initializes the following subsystems in order:

  1. Configuration loader -- reads and validates the config file
  2. Memory backend -- connects to the configured memory store (markdown, SQLite, or PostgreSQL)
  3. Gateway server -- starts the HTTP/WebSocket server on the configured host and port
  4. Channel manager -- connects all enabled messaging channels (Telegram, Discord, Slack, etc.)
  5. Cron scheduler -- loads and activates scheduled tasks
  6. Self-evolution engine -- starts the L1/L2/L3 evolution pipeline (if enabled)

Examples

bash
# Start with default settings
prx daemon

# Bind to all interfaces on port 8080
prx daemon --host 0.0.0.0 --port 8080

# Start with debug logging
prx daemon --log-level debug

# Start without evolution (useful for debugging)
prx daemon --no-evolution

# Use a custom config file
prx daemon --config /etc/prx/production.toml

Signals

The daemon responds to Unix signals for runtime control:

SignalBehavior
SIGHUPReload configuration file without restarting. Channels and cron tasks are reconciled with the new config.
SIGTERMGraceful shutdown. Finishes in-flight requests, disconnects channels cleanly, and flushes pending memory writes.
SIGINTSame as SIGTERM (Ctrl+C).
bash
# Reload config without restart
kill -HUP $(cat /var/run/prx.pid)

# Graceful shutdown
kill -TERM $(cat /var/run/prx.pid)

Running as a systemd Service

The recommended way to run the daemon in production is via systemd. Use prx service install to generate and install the unit file automatically, or create one manually:

ini
[Unit]
Description=PRX AI Agent Daemon
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
ExecStart=/usr/local/bin/prx daemon --config /etc/prx/config.toml
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=5
User=prx
Group=prx
RuntimeDirectory=prx
StateDirectory=prx

# Hardening
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
ReadWritePaths=/var/lib/prx /var/log/prx

[Install]
WantedBy=multi-user.target
bash
# Install and start the service
prx service install
prx service start

# Or manually
sudo systemctl enable --now prx

Logging

The daemon logs to stderr by default. In a systemd environment, logs are captured by the journal:

bash
# Follow daemon logs
journalctl -u prx -f

# Show logs from the last hour
journalctl -u prx --since "1 hour ago"

Set structured JSON logging by adding log_format = "json" to the config file for integration with log aggregators.

Health Check

While the daemon is running, use prx doctor or query the gateway health endpoint:

bash
# CLI diagnostics
prx doctor

# HTTP health endpoint
curl http://127.0.0.1:3120/health

Released under the Apache-2.0 License.