A single event from the Claude CLI's NDJSON streaming output.
When using --output-format stream-json, the CLI emits one JSON object
per line. Each event has a type and associated data.
Event types
Common event types include:
"system"-- system initialization"assistant"-- assistant message content"tool_use"-- tool invocation"tool_result"-- tool execution result"result"-- final result with cost/session info"error"-- error during execution
Summary
Functions
Extract cost in USD, if present.
Parse a single NDJSON line into a stream event.
Whether this is the final result event.
Extract the result text, if this is a result event.
Extract the session ID, if present.
Types
Functions
Extract cost in USD, if present.
Parse a single NDJSON line into a stream event.
Whether this is the final result event.
Extract the result text, if this is a result event.
Extract the session ID, if present.