The message text.
Plain text, which for agent answers may contain markdown. It is replaced by the latest text
on every partial callback while the answer streams in — and the final answer may be
shorter than the partials before it, which is exactly how the SDK spots an interruption — so
render it as it is rather than appending to what you rendered before.
OptionalcontextThe retrieved context the answer was generated from, as the chat response supplied it.
Only ever set on an agent answer, and only when the answer came back from the Agents API. Expressive (V4) agents chat over the data channel instead, so their answers carry no context — except in ChatMode.Playground, which always takes the Agents API path.
OptionalcreatedWhen the message was added, as an ISO 8601 timestamp.
Optional for the same reason as parts — a restored transcript need not carry one — but set on every message the SDK builds itself, which is every message that reaches onNewMessage other than a seeded initialMessage that arrived without one.
Id of this message.
Pass it to rate() to rate the answer. The SDK generates a random id for the messages it creates locally, and uses the id sent with the message for those that arrive from the agent.
Optionalinterruptedtrue when the answer was cut short instead of being spoken to the end.
Set on the last message by interrupt(), and by the SDK when the final answer turns out to be shorter than the partial text already received — which is how it detects that the agent was interrupted mid-utterance.
OptionalmatchesThe knowledge citations the answer was drawn from, as RetrievalMetadata entries.
Present on an agent answer when the chat response carried them, so a UI can show its sources; rate() also sends them with a rating. The SDK strips this field from the transcript it sends back to the Agents API with the next chat().
Optionalpartscontent split into renderable pieces by parseMessageParts.
Kept in step with content on every message the SDK creates, including while an answer
streams in. Render these instead of the raw string when the agent may answer with images,
videos or links; a message with no markup is a single text part, and an empty message is
an empty array.
Optional because initialMessages take the same
shape, and a transcript restored from your own storage carries only the text: leave parts
out and the SDK runs the parser over content before the message reaches the transcript. A
non-empty array you built yourself is kept exactly as given. Every message the SDK delivers
through onNewMessage has it set, seeded
initialMessages included, so a handler can read it without a guard.
OptionalroleWho the message is from.
The SDK itself only creates user (the end user) and assistant (the agent) messages; the
value on a transcribed or streamed message is whatever the server payload carried. system,
function and tool exist because the underlying chat protocol allows them.
OptionalsentimentThe sentiment the agent delivered this answer with, when the stream reported one.
Taken from the metadata the server sends with the video it created, and attached to the most recent agent answer. The SDK only ever fills it in from an Expressive (V4) session, and only while debug is enabled.
Optionaltranscribedtrue when this user message came from speech-to-text rather than from
chat().
It is what distinguishes an utterance the user spoke from one they typed.
One message of a chat: what the user asked, or what the agent answered.
The SDK keeps the whole transcript and hands a fresh copy of it to onNewMessage every time a message is added or changed, oldest first. While an answer streams in, the last message's content and parts are replaced with the latest text on each
partialcallback — not appended to — and are final onanswer. The same shape is accepted by initialMessages to seed a transcript.