@@ -22,6 +22,9 @@ class EventType(str, Enum):
2222 TEXT_MESSAGE_START = " TEXT_MESSAGE_START"
2323 TEXT_MESSAGE_CONTENT = " TEXT_MESSAGE_CONTENT"
2424 TEXT_MESSAGE_END = " TEXT_MESSAGE_END"
25+ THINKING_TEXT_MESSAGE_START = " THINKING_TEXT_MESSAGE_START"
26+ THINKING_TEXT_MESSAGE_CONTENT = " THINKING_TEXT_MESSAGE_CONTENT"
27+ THINKING_TEXT_MESSAGE_END = " THINKING_TEXT_MESSAGE_END"
2528 TOOL_CALL_START = " TOOL_CALL_START"
2629 TOOL_CALL_ARGS = " TOOL_CALL_ARGS"
2730 TOOL_CALL_END = " TOOL_CALL_END"
@@ -210,6 +213,64 @@ class TextMessageEndEvent(BaseEvent):
210213| ------------ | ----- | ----------------------------------------- |
211214| ` message_id ` | ` str ` | Matches the ID from TextMessageStartEvent |
212215
216+ ## Thinking Message Events
217+
218+ These events represent the lifecycle of thinking messages that show an agent's internal reasoning process.
219+
220+ ### ThinkingTextMessageStartEvent
221+
222+ ` from ag_ui.core import ThinkingTextMessageStartEvent `
223+
224+ Signals the start of a thinking message.
225+
226+ ``` python
227+ class ThinkingTextMessageStartEvent (BaseEvent ):
228+ type : Literal[EventType.THINKING_TEXT_MESSAGE_START ]
229+ thinking_id: str
230+ ```
231+
232+ | Property | Type | Description |
233+ | ------------- | ----- | ------------------------------------- |
234+ | ` thinking_id ` | ` str ` | Unique identifier for the thinking sequence |
235+
236+ ### ThinkingTextMessageContentEvent
237+
238+ ` from ag_ui.core import ThinkingTextMessageContentEvent `
239+
240+ Represents a chunk of content in a streaming thinking message.
241+
242+ ``` python
243+ class ThinkingTextMessageContentEvent (BaseEvent ):
244+ type : Literal[EventType.THINKING_TEXT_MESSAGE_CONTENT ]
245+ thinking_id: str
246+ delta: str # Non-empty string
247+
248+ def model_post_init (self , __context ):
249+ if len (self .delta) == 0 :
250+ raise ValueError (" Delta must not be an empty string" )
251+ ```
252+
253+ | Property | Type | Description |
254+ | ------------- | ----- | -------------------------------------------------- |
255+ | ` thinking_id ` | ` str ` | Matches the ID from ThinkingTextMessageStartEvent |
256+ | ` delta ` | ` str ` | Thinking content chunk (non-empty) |
257+
258+ ### ThinkingTextMessageEndEvent
259+
260+ ` from ag_ui.core import ThinkingTextMessageEndEvent `
261+
262+ Signals the end of a thinking message.
263+
264+ ``` python
265+ class ThinkingTextMessageEndEvent (BaseEvent ):
266+ type : Literal[EventType.THINKING_TEXT_MESSAGE_END ]
267+ thinking_id: str
268+ ```
269+
270+ | Property | Type | Description |
271+ | ------------- | ----- | -------------------------------------------------- |
272+ | ` thinking_id ` | ` str ` | Matches the ID from ThinkingTextMessageStartEvent |
273+
213274## Tool Call Events
214275
215276These events represent the lifecycle of tool calls made by agents.
@@ -392,6 +453,9 @@ Event = Annotated[
392453 TextMessageStartEvent,
393454 TextMessageContentEvent,
394455 TextMessageEndEvent,
456+ ThinkingTextMessageStartEvent,
457+ ThinkingTextMessageContentEvent,
458+ ThinkingTextMessageEndEvent,
395459 ToolCallStartEvent,
396460 ToolCallArgsEvent,
397461 ToolCallEndEvent,
0 commit comments