vercel · Vercel AI SDK Docs
AI SDK UI: Stream Protocols
Explains the data streaming protocols used by the AI SDK UI to facilitate communication between the server and client during generative UI or text streaming.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
AI SDK UI: Stream Protocols
Explains the data streaming protocols used by the AI SDK UI to facilitate communication between the server and client during generative UI or text streaming.
When To Use
Use when implementing custom streaming handlers or debugging the data exchange between a backend AI stream and a frontend UI component.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/ai-sdk-ui-stream-protocols-workflow-guide.md | Documentation explaining the text and data stream protocols used by AI SDK UI functions like useChat and useCompletion. | Questions about documentation explaining the text and data stream protocols used by AI SDK UI functions like useChat and useCompletion. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-text-stream-chat-transport-react.text | A React client component demonstrating the implementation of the TextStreamChatTransport within the useChat hook. | Exact payloads, commands, or snippets shown in A React client component demonstrating the implementation of the TextStreamChatTransport within the useChat hook. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-typescript.text | A TypeScript code example demonstrating how to implement a POST route for streaming text responses using the AI SDK UI stream protocol. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to implement a POST route for streaming text responses using the AI SDK U... |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format.text | A text representation of the data stream protocol format used by the AI SDK UI, showing message type objects. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI, showing message type objects. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-2.text | A text representation of the data stream protocol format used by the AI SDK UI, showing the structure of data chunks. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI, showing the structure of data chunks. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-3.text | A text representation of the data stream protocol format used by the AI SDK UI, showing text-delta message objects. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI, showing text-delta message objects. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-4.text | A text representation of the data stream protocol format used by the AI SDK UI, including message type and ID metadata. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI, including message type and ID metadata. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-example.text | A text file demonstrating the structure of data stream protocol messages including reasoning-start events. | Exact payloads, commands, or snippets shown in A text file demonstrating the structure of data stream protocol messages including reasoning-start events. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-5.text | An example of the text-based data stream format used by the AI SDK UI, including reasoning-delta objects. | Exact payloads, commands, or snippets shown in An example of the text-based data stream format used by the AI SDK UI, including reasoning-delta objects. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-example-2.text | A text file demonstrating the structure of data stream protocol messages including reasoning-end events. | Exact payloads, commands, or snippets shown in A text file demonstrating the structure of data stream protocol messages including reasoning-end events. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-6.text | A text representation of the data stream protocol format used by the AI SDK UI. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-7.text | A text representation of the data stream protocol format used by the AI SDK UI. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-8.text | A text representation of the data stream protocol format used by the AI SDK UI. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-9.text | An example of the text-based stream protocol format used to transmit structured data objects alongside stream content. | Exact payloads, commands, or snippets shown in An example of the text-based stream protocol format used to transmit structured data objects alongside stream content. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-example-3.text | A text representation of the data stream protocol formats used by the AI SDK UI, including error message structures. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol formats used by the AI SDK UI, including error message structures. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-10.text | A text representation of the data stream protocol format used by the AI SDK UI, including tool-input-start events. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI, including tool-input-start events. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-11.text | A text representation of the data stream protocol format used by the AI SDK UI, demonstrating tool-input-delta messages. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI, demonstrating tool-input-delta messages. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-12.text | A text representation of the data stream protocol format used by the AI SDK UI, including tool-input-available events. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI, including tool-input-available events. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-13.text | A text representation of the data stream protocol format used by the AI SDK UI, including tool output availability messages. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI, including tool output availability me... |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-14.text | A text representation of the data stream protocol format used by the AI SDK UI, showing step-based JSON messages. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI, showing step-based JSON messages. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-15.text | A text representation of the data stream protocol format used by the AI SDK UI, including step completion messages. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI, including step completion messages. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-16.text | A text representation of the data stream protocol format used by the AI SDK UI, showing the structure of data chunks and finish signals. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol format used by the AI SDK UI, showing the structure of data chunks... |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-format-example-4.text | A text representation of the data stream protocol messages used by the AI SDK UI, including abort signals and data chunks. | Exact payloads, commands, or snippets shown in A text representation of the data stream protocol messages used by the AI SDK UI, including abort signals and data ch... |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-data-done-marker.text | A text representation of the data: [DONE] marker used to signal the end of a stream in the AI SDK UI protocol. | Exact payloads, commands, or snippets shown in A text representation of the data: [DONE] marker used to signal the end of a stream in the AI SDK UI protocol. |
examples/ai-sdk-ui-stream-protocols-react-usechat.text | A React client component demonstrating the use of the useChat hook to handle streamed AI responses. | Exact payloads, commands, or snippets shown in A React client component demonstrating the use of the useChat hook to handle streamed AI responses. |
examples/ai-sdk-ui-stream-protocols-ai-sdk-ui-stream-protocol-typescript-2.text | A TypeScript code example demonstrating how to implement a POST route for streaming text responses using the AI SDK UI stream protocol. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to implement a POST route for streaming text responses using the AI SDK U... |
What This Skill Covers
- AI SDK UI functions such as useChat and useCompletion support both text streams and data streams. The stream protocol defines how the data is streamed to the...
- Main sections:
Text Stream Protocol,Text Stream Example,Data Stream Protocol,Message Start Part,Text Parts.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://ai-sdk.dev/docs/ai-sdk-ui/stream-protocol