praisonai run --output stream-json emits a per-step NDJSON event stream you can pipe into CI pipelines, scripts, or observability tools.
Quick Start
Run with stream-json output
How It Works
Each run wires aStreamEventBridge between the agent’s internal StreamEventEmitter and the OutputController. Every agent action — tool calls, text deltas, errors — becomes an NDJSON line on stdout.
Run-level lifecycle events (run.start, agent.message, run.result, run.error) are driven directly by the CLI. Per-step events (tool.*, text.delta, reasoning.delta) come through the StreamEventBridge callback.
Event Schema (schema_version = 1)
Every NDJSON line is a JSON object withevent and data keys. Every data object contains schema_version: 1.
| Event | When | Key fields in data |
|---|---|---|
run.start | Once, at run start | schema_version, target, model, framework |
agent.message | Once per agent invocation | schema_version, agent (name or null) |
tool.start | Each tool call | schema_version, tool, args |
tool.result | Each tool return | schema_version, tool, result, ok |
tool.error | Tool-scoped failure | schema_version, tool, error |
text.delta | Streaming text chunk | schema_version, text |
reasoning.delta | Streaming reasoning chunk | schema_version, text |
run.result | Successful run end | schema_version, ok: true, result |
run.error | Run or transport failure | schema_version, ok: false, error |
Example NDJSON output
Examples per Event Type
run.start
run.start
Emitted once at the start of every run. Contains the target prompt, model, and framework.
agent.message
agent.message
Emitted once per agent invocation, immediately before the agent starts processing.
tool.start
tool.start
Emitted each time the agent calls a tool.
args contains the tool’s input arguments.tool.result
tool.result
Emitted when a tool returns.
ok is true unless the tool reported an error.text.delta and reasoning.delta
text.delta and reasoning.delta
Streaming text chunks from the model.
reasoning.delta is used when is_reasoning=True.run.result
run.result
Emitted once when the run completes successfully.
result is the agent’s final output.run.error
run.error
Emitted when a run-level, streaming, or transport failure occurs. Also emitted for core
error events.Stability and Versioning
Every event’sdata object includes schema_version: 1. This version is bumped only on backward-incompatible schema changes.
Pin your consumer against
schema_version: 1. Future backward-incompatible changes will increment this value so you can detect and handle them gracefully.When to Use Which Output Mode
Common Patterns
Filter for specific events with jq
Watch only tool calls and the final result:Detect run.error in CI
Exit with a non-zero code if the run fails:Build a progress UI fed by text.delta
Concatenatetext.delta chunks to show a live streamed response:
Best Practices
Always check schema_version
Always check schema_version
Before processing events, verify
data.schema_version == 1. This guards your consumer against future breaking changes.Handle run.error explicitly
Handle run.error explicitly
A
run.error event means the run failed. Check ok == false and surface the error field to your observability system.Use stream-json only when you need per-step trace
Use stream-json only when you need per-step trace
In
text, json, silent, and verbose modes the bridge is a no-op — zero per-step callback overhead. Only enable stream-json when a downstream consumer actually reads the events.Use run.result as the authoritative final output
Use run.result as the authoritative final output
Related
CLI Run Reference
CLI Backend Protocol

