praisonai attach subscribes to a live agent session on the warm runtime and streams its events in real time from a second terminal — read-only, with multiple observers supported.
Quick Start
Usage
| Argument / Option | Type | Default | Description |
|---|---|---|---|
session_id | positional | required | Session id to attach to |
--json | flag | false | Emit raw NDJSON events instead of human-readable output |
How It Works
Attaching never starts execution — it only observes. Detaching (Ctrl-C) does not stop the run on terminal A.Event Reference
| Type | Fields | Human render |
|---|---|---|
run.start | session_id, prompt | ▶ run.start: <prompt> |
run.result | session_id, ok, result | ✓ run.result then result text |
run.error | session_id, error | ✗ run.error: <error> |
- Human output
- --json (NDJSON)
Exit Codes
| Code | Meaning |
|---|---|
0 | Clean detach (Ctrl-C) |
1 | No compatible warm runtime, or stream lost mid-attach |
4 | Runtime module not importable |
Common Patterns
Watch a long-running agent from a second terminal — start with--attach, observe progress without blocking terminal A.
Pipe JSON into jq — praisonai attach my-session --json | jq 'select(.type=="run.result")'.
Multiple observers — several terminals can attach to the same session concurrently; all receive the same events.
Best Practices
Start the daemon first
Start the daemon first
Run
praisonai daemon start before run --attach. Without a warm runtime, attach exits with code 1.Use direct prompt runs only
Use direct prompt runs only
--attach on praisonai run works for direct prompts only — not YAML files, --agent, or --command.Detaching is safe
Detaching is safe
Ctrl-C in an attach terminal never cancels the underlying agent run.
Version mismatch after upgrade
Version mismatch after upgrade
If CLI and daemon major versions differ, attach refuses to connect. Run
praisonai daemon stop && praisonai daemon start after upgrading.Related
Run
--attach flag for tagging warm-runtime sessionsDaemon
Warm runtime lifecycle and version handshake

