Repository navigation
Closed
Closed
Copy link
Labels
ag-uiUsage: [Issues, PRs], Target: AG-UI protocol integrationUsage: [Issues, PRs], Target: AG-UI protocol integrationpythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: PythonquestionUsage: [Issues, PRs], Target: all issues or PRs where additional context is needed from the authorUsage: [Issues, PRs], Target: all issues or PRs where additional context is needed from the author
Description
Summary
Add native support for TextReasoningContent to AG-UI event conversion in the agent_framework_ag_ui package by emitting THINKING_TEXT_MESSAGE_* events.
Problem Statement
Currently, the AgentFrameworkEventBridge in the agent_framework_ag_ui package does not handle TextReasoningContent objects. This causes reasoning/thinking content from models like o1, o3, and gpt-5 (when configured with reasoning.summary = "detailed") to be silently dropped during AG-UI event conversion.
Current Behavior
# agent_framework_ag_ui/_events.py (current implementation)
def from_agent_run_update(update: AgentRunResponseUpdate):
for content in update.contents:
if isinstance(content, TextContent):
yield TEXT_MESSAGE_CONTENT event
elif isinstance(content, FunctionCallContent):
yield TOOL_CALL_* events
elif isinstance(content, FunctionResultContent):
yield TOOL_RESULT_* events
# ❌ TextReasoningContent is not handled - content is lostImpact
- Lost Content: Reasoning summaries from Azure OpenAI Responses API are completely lost in AG-UI streaming
- Poor UX: Frontend applications cannot display the model's thinking process to users
Proposed Solution
Add handling for TextReasoningContent in the AgentFrameworkEventBridge.from_agent_run_update() method to emit AG-UI's existing THINKING_TEXT_MESSAGE_* events.
Implementation
# Proposed change to agent_framework_ag_ui/_events.py
from ag_ui.core.events import (
ThinkingStartEvent,
ThinkingTextMessageStartEvent,
ThinkingTextMessageContentEvent,
ThinkingTextMessageEndEvent,
ThinkingEndEvent,
)
from agent_framework import TextReasoningContent
def from_agent_run_update(update: AgentRunResponseUpdate):
# Track thinking state
thinking_active = False
for content in update.contents:
if isinstance(content, TextContent):
# Existing text handling
yield TEXT_MESSAGE_CONTENT event
elif isinstance(content, TextReasoningContent):
# NEW: Handle reasoning content
if not thinking_active:
yield ThinkingStartEvent()
yield ThinkingTextMessageStartEvent()
thinking_active = True
# Check if this is a delta or done event
raw = content.raw_representation
event_type = getattr(raw, 'type', '') if raw else ''
if 'delta' in event_type:
# Stream incremental content
yield ThinkingTextMessageContentEvent(
delta=content.text
)
elif 'done' in event_type:
# End of reasoning section
yield ThinkingTextMessageEndEvent()
yield ThinkingEndEvent()
thinking_active = False
elif isinstance(content, FunctionCallContent):
# Existing tool call handling
yield TOOL_CALL_* eventsBenefits
- Native Support: No custom wrappers needed - works out of the box
- Standards Compliance: Uses AG-UI's standard
THINKING_TEXT_MESSAGE_*events - Better UX: Frontends can display thinking process using AG-UI's standard patterns
Use Cases
1. Chain-of-Thought Visibility
Allow users to see the model's reasoning process in real-time:
# Backend: Azure OpenAI with reasoning enabled
agent = responses_client.create_agent(
additional_chat_options={
"reasoning": {"summary": "detailed"}
}
)
# Frontend: AG-UI automatically receives thinking events
subscriber.on('THINKING_TEXT_MESSAGE_CONTENT', (event) => {
displayThinkingProcess(event.delta);
});Compatibility
- AG-UI Protocol:
THINKING_TEXT_MESSAGE_*events are already part of AG-UI specification - Existing SDKs: All AG-UI SDKs (TypeScript, Python, Java, Kotlin, Go, Rust, Dart) already support these events
Reacted by dimo-coremont, Jeffin SIby, dbewick and Pramodnm
Metadata
Metadata
Assignees
Labels
ag-uiUsage: [Issues, PRs], Target: AG-UI protocol integrationUsage: [Issues, PRs], Target: AG-UI protocol integrationpythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: PythonquestionUsage: [Issues, PRs], Target: all issues or PRs where additional context is needed from the authorUsage: [Issues, PRs], Target: all issues or PRs where additional context is needed from the author
Type
Projects
- StatusShow more project fieldsDone
Activity
[-][Python&DOTNET] Support THINKING_TEXT_MESSAGE Events in AgentFrameworkEventBridge[/-][+][Python&DOTNET] Request Support THINKING_TEXT_MESSAGE Events in AgentFrameworkEventBridge[/+][-][Python&DOTNET] Request Support THINKING_TEXT_MESSAGE Events in AgentFrameworkEventBridge[/-][+]Python: [Python&DOTNET] Support THINKING_TEXT_MESSAGE Events in AgentFrameworkEventBridge[/+][-]Python: [Python&DOTNET] Support THINKING_TEXT_MESSAGE Events in AgentFrameworkEventBridge[/-][+].NET: [Python&DOTNET] Support THINKING_TEXT_MESSAGE Events in AgentFrameworkEventBridge[/+][-].NET: [Python&DOTNET] Support THINKING_TEXT_MESSAGE Events in AgentFrameworkEventBridge[/-][+].NET & Python: Support THINKING_TEXT_MESSAGE Events in AgentFrameworkEventBridge[/+]moonbox3 commentedon Dec 4, 2025
Would you like to raise a PR, Shine (@hanhsia)?
moonbox3 commentedon Dec 4, 2025
And this pertains to .NET, too, or only Python?
markwallace-microsoft commentedon Mar 20, 2026
Shine (@hanhsia), friendly reminder — this issue is waiting on your response. Please share any updates when you get a chance. (This is an automated message.)
eavanvalkenburg commentedon Jun 2, 2026
Evan Mattson (@moonbox3) still relevant?
moonbox3 commentedon Jul 9, 2026
Supported in latest main.