ContentPartPrimitive
Each message can have any number of content parts.
Content parts are usually one of text, reasoning, audio or tool-call.
Content Part Types
Text
Standard text content, used for both user and assistant messages.
Reasoning
Exposes the assistant's reasoning process, showing how it arrived at its responses. This is typically used only in assistant messages.
Audio
Audio content that can be played back.
Tool Call
Interactive elements that represent tool operations.
Anatomy
Primitives
Plain Text
Markdown Text
Renders the message's text as Markdown.
Audio
Coming soon.
InProgress
Renders children only if the content part is in progress.
Tool UI
You can map tool calls to UI components. We provide a few utility functions to make this easier, such as makeAssistantToolUI
.
Context Provider
Content part context is provided by MessagePrimitive.Content
or TextContentPartProvider
MessagePrimitive.Content
TextContentPartProvider
This is a helper context provider to allow you to reuse the content part components outside a message content part.
Runtime API
useContentPartRuntime
ContentPartRuntime
addToolResult:
Add tool result to a tool call content part that has no tool result yet. This is useful when you are collecting a tool result via user input ("human tool calls").