praisonai daemon keeps provider clients and MCP connections hot in memory so repeated praisonai run calls skip cold-start entirely.
The user runs repeated praisonai run commands; the warm daemon forwards work to hot provider and MCP connections.
Quick Start
Start the daemon in the background
praisonai run calls in the same project directory automatically detect and attach to it.Run prompts — no extra flags needed
How It Works
| Component | Role |
|---|---|
Lockfile (runtime.json) | Stores {host, port, token, pid} at <project_data_dir>/runtime/runtime.json. Mode 0600 — token is never world-readable. |
| WarmRuntime | Holds one warm Agent per model. Reuses it across calls. Evicts the agent on failure to prevent state bleed. |
| RuntimeClient | Thin stdlib (urllib) HTTP client. Raises RuntimeUnavailable on any error — run then falls back in-process. |
| Idle watcher | Background thread shuts down the server after --idle-timeout seconds of inactivity (default 30 min). |
Configuration Options
praisonai daemon start
| Flag | Type | Default | Description |
|---|---|---|---|
--host, -h | str | 127.0.0.1 | Loopback host to bind. Non-loopback addresses are rejected. |
--port, -p | int | 0 | Port to bind. 0 = auto-select a free port. |
--model, -m | str | None | Default model for the warm agent. |
--idle-timeout | float | 1800.0 | Seconds idle before auto-shutdown. 0 disables auto-shutdown. |
--background, -b | bool | False | Detach and run in the background. |
praisonai daemon status
| Flag | Type | Default | Description |
|---|---|---|---|
--json | bool | False | Output JSON for scripting. Returns {running, host, port, pid, base_url}. |
praisonai daemon stop
No flags. Sends SIGTERM after a health-check ping to guard against PID reuse. Cleans up the lockfile.
When to Use Foreground vs Background
When run Stays In-Process
praisonai run skips the daemon and runs locally whenever you pass any of these flags:
| Flag(s) | Why it stays in-process |
|---|---|
--mcp, --tools, --toolset | Per-invocation tool overrides need in-process state. |
--approval, --approve-all-tools | Approval flow requires interactive in-process handling. |
--memory | Memory store is managed in-process. |
--permissions overrides | Security policy must be enforced locally. |
--continue, --session, --fork | Session continuity and forking run in-process; the daemon carries no session state. |
--output actions, json, stream, stream-json | Structured output modes need richer in-process event bridging. |
praisonai run behaves exactly as it did before the daemon feature. No flags are needed to opt out — it happens automatically.
Common Patterns
Iterating on prompts in a shell loop
Iterating on prompts in a shell loop
Auto-shutdown at night with --idle-timeout
Auto-shutdown at night with --idle-timeout
Scripting status checks
Scripting status checks
--json flag returns {running, host, port, pid, base_url} — safe for jq or any JSON parser.Using a specific model
Using a specific model
Security
Best Practices
Use --background for everyday workflows
Use --background for everyday workflows
Foreground mode is useful for debugging (you can see log output). For all other use cases,
--background is simpler: it returns immediately and the daemon persists across terminal sessions.Tune --idle-timeout carefully
Tune --idle-timeout carefully
The default 30-minute timeout is a good balance between warmth and resource usage. Setting
--idle-timeout 0 means the daemon never shuts down automatically — only use this if you understand it will consume memory indefinitely.One daemon per project
One daemon per project
The lockfile is stored under the project data directory, scoped to the current project. Running two daemons in the same project will print a warning and exit. Each project directory gets its own independent daemon.
Check status before starting
Check status before starting
Related
Run Command
The
praisonai run command — automatically attaches to a warm daemon when one is running.MCP Integration
MCP server connections benefit most from the warm runtime — they stay connected across
run calls.
