Daemon — Warm Runtime
Keep agents warm in memory so repeated runs skip cold-start
praisonai daemon keeps provider clients, MCP connections, and agents hot in memory — repeated praisonai run calls reuse the already-warm agent instead of paying cold-start costs every time.
Quick Start
- Install PraisonAI
bash pip install praisonai - Start the warm runtime in the background
bash praisonai daemon start --background - Run prompts — they attach automatically
bash praisonai run "Hello" praisonai run "What is the capital of France?"No flag, no env var. When the daemon is running,
praisonai runforwards to it automatically. Bare prompts (praisonai "Hello") route torun, so they reuse the same warm path. - Check status and stop when done
bash praisonai daemon status praisonai daemon stop
Project rules and local tools
As of PR #4943, the warm runtime honors AGENTS.md / CLAUDE.md subtree instructions and loads project-local .praisonai/tools/*.py on every run — so the daemon now behaves identically to the cold path for these two implicit, project-scoped sources.
Previously the warm runtime built a bare agent with no subtree instruction hook and no local tools, so a daemon-forwarded praisonai run returned fluent text and exited 0 while touching nothing — indistinguishable from success until you checked the filesystem.
# Cold path (already worked)
praisonai run "list the todos" # honored ./AGENTS.md and ./.praisonai/tools/
# Warm path (now equally honored, from PR #4943)
praisonai daemon start
praisonai run "list the todos" # same rules, same tools, same resultHow It Works
| What is warm | What is rebuilt per call |
|---|---|
| Provider client (LiteLLM) | Prompt text |
| MCP connections | Output format (structured, stream, etc.) |
| Loaded agent config | Session/memory overrides |
| Tool registrations | Per-invocation flags (see below) |
When run Falls Back to In-Process
praisonai run does not forward to the daemon when you use these flags. They are handled in-process instead:
| Flag | Reason |
|---|---|
--session, --continue, --fork | Session continuity requires stateful context |
--memory | Memory backend must be initialized per-session |
--approval | Approval backends need a live terminal or channel |
--tools, --toolset | Per-invocation tool overrides change agent config |
--attach | Live session tagging for multi-terminal observation |
--output json, --stream | Structured output modes attach directly to the process |
--trace, --profile | Tracing and profiling require direct process access |
When any of these flags is set, run behaves exactly as if no daemon were running — fully backward compatible.
CLI Reference
praisonai daemon start
Start the warm runtime server.
praisonai daemon start
praisonai daemon start --background
praisonai daemon start --host 127.0.0.1 --port 8899 --model gpt-4o-mini --idle-timeout 3600| Option | Type | Default | Description |
|---|---|---|---|
--host, -h | str | 127.0.0.1 | Loopback address to bind. Non-loopback addresses are rejected. |
--port, -p | int | 0 (auto) | Port to bind. 0 picks a free port automatically. |
--model, -m | str | None | Default model for warm agents. Inherits your configured default when unset. |
--idle-timeout | float | 1800.0 | Seconds of inactivity before the daemon auto-shuts-down. 0 disables. |
--background, -b | bool | False | Detach from the terminal and run in the background. |
praisonai daemon status
praisonai daemon status
praisonai daemon status --json| Option | Type | Default | Description |
|---|---|---|---|
--json | bool | False | Machine-readable JSON output. |
praisonai daemon stop
praisonai daemon stopSends SIGTERM to the daemon process. If the lockfile is stale (PID reuse), cleans up the lockfile instead of killing a random process.
Version compatibility
The warm runtime records its package version in the lockfile. Thin clients (praisonai run, praisonai attach) require a matching major version before reusing the runtime — a stale daemon after upgrade is ignored and the CLI falls back to in-process execution (or attach exits with code 1).
After upgrading PraisonAI:
praisonai daemon stop
praisonai daemon start --backgroundSee Attach for streaming live session events from a second terminal.
Security
| Protection | How |
|---|---|
| Loopback-only | ipaddress.is_loopback check at startup — non-loopback --host exits 1 |
| Token auth | Bearer token generated at startup, stored in lockfile with 0600 permissions |
| PID-reuse safety | daemon stop pings before sending SIGTERM; stale lockfile is cleaned, not used to kill a random process |
| Concurrent prompt safety | Per-model lock serializes /run calls — concurrent prompts cannot corrupt agent state |
| Error isolation | Agent evicted from cache on failed start() — transient LLM errors don’t leave a half-consumed turn cached |
Troubleshooting
Runtime descriptor is stale
The lockfile exists but the PID it points to is dead. This usually happens after a crash or force-kill.
Fix: Run praisonai daemon stop — it detects the stale lockfile and cleans it up automatically. Then praisonai daemon start again.
Runtime did not report ready in time (–background)
The daemon started but did not write its lockfile within the timeout.
Fix: Try starting in foreground mode first (praisonai daemon start) to see error output. Common causes: port already in use, missing credentials, MCP server refusing connection.
praisonai run still feels slow
Verify the daemon is actually running and being detected:
praisonai daemon status --jsonIf the daemon is running but run is still in-process, you may be using a flag that forces in-process execution (see the fallback table above).
daemon start –background exits immediately
On some systems, background detach requires a clean environment. Try:
nohup praisonai daemon start > ~/.praisonai/daemon.log 2>&1 &Related
Default model resolution — which model the daemon uses when none is specified
MCPMCP handshake is the biggest cold-start cost that the daemon eliminates
Session ResumeFor stateful multi-turn continuity (not forwarded to daemon)
CLI ReferenceFull CLI flag reference
AttachStream live session events from another terminal