Prompt Buddy logoPrompt Buddy

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.

Import to Prompt Buddy

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

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/ai-sdk-ui-stream-protocols-workflow-guide.mdDocumentation 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textAn 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.textA 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.textA 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.textA 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.textA 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.textAn 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. 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