Response streaming
Event framing, rendering, terminal states, and interruption handling.
On this page
Wire format
The chat messages endpoint returns application/x-ndjson for a new streaming turn. Each line is one JSON object. Transport chunks may split a line or contain several lines. The browser decodes bytes incrementally, retains incomplete lines, and validates each complete event before dispatch.
{"type":"start","id":"9da52e9c-b62e-4a1f-8a45-de83f030aff3"}
{"type":"delta","text":"A commitment identifies a note without exposing its secret."}
{"type":"loading","section":"market","active":false}
{"type":"done","actionId":null}Event meanings
| Type | Meaning |
|---|---|
| start | Identifies the assistant reply being streamed |
| delta / text | Appends incremental text or sets the current assembled text |
| research / sources | Updates tool activity or available numbered source evidence |
| loading / block | Updates local loading state or appends a validated rich response |
| action | Supplies local action-card metadata |
| done / error | Terminates with an optional action ID or a safe error and interruption flag |
These are application events; they differ from the Anthropic SDK event shape. An unsupported or invalid block can be discarded independently. The reader rejects oversized events or a stream that closes without a terminal event. A browser cancellation propagates an abort signal. The saved reply is the recovery path after interruption.
See Claude Messages streaming, Rich Responses, and the API reference.

CogniTech