Streaming

The Client SDK provides real-time access to streaming content through the message parts array. Each part has its own status, enabling responsive UIs that update as the agent generates responses.

Streaming State

tsx

Building a Streaming UI

tsx

Rendering Streaming Parts

Parts update in real-time during streaming. Use the part's status to show appropriate UI:

tsx

Tool Call States

Tool calls progress through multiple states:

tsx

Status Indicator

tsx

Handling Completion

tsx

See Error Handling for comprehensive error handling patterns.

text

When stop() is called:

  1. The HTTP request is aborted (requires signal in transport)
  2. Any partial text/reasoning is finalized with done status
  3. In-progress tool calls are marked as cancelled
  4. The onStop callback is invoked
  5. Status changes to idle

Partial content is preserved in the message, so users don't lose what was already generated.

Named Thread Content

Content from named threads (like "summary") streams separately and is identified by the thread property:

tsx