message_to_events(
msg: BaseMessage,
*,
message_id: str | None = None
) -> Iterator| Name | Type | Description |
|---|---|---|
msg* | BaseMessage | |
message_id | str | None | Default: None |
Replay a finalized message as a synthetic event lifecycle.
For a message returned whole (from a graph node, checkpoint, or
cache), produce the same message-start / per-block /
message-finish event stream a live call would produce. Consumers
downstream see a uniform event shape regardless of source.
Text and reasoning blocks emit a single content-block-delta with
the full accumulated content. Already-finalized blocks (tool_call,
server_tool_call, image, etc.) skip the delta and rely on the
content-block-finish event alone.
The finalized message ā typically an AIMessage.
Optional stable message ID; falls back to msg.id.