Description
I’m seeing a crash in AGUI streaming when a workflow handoff emits a TOOL_CALL_RESULT with plain text content.
Environment
- Microsoft Agent Framework (latest main as of 2026-04-30)
- AGUI client via AGUIChatClient
- Workflow built with handoff builder and exposed via AGUI endpoint
Repro
- Build workflow with handoff orchestration.
- Consume endpoint with AGUIChatClient.
- Call RunStreamingAsync.
- Observe AGUI SSE events:
- RUN_STARTED
- TOOL_CALL_START (handoff_to_1)
- TOOL_CALL_ARGS
- TOOL_CALL_END
- TOOL_CALL_RESULT with content: Transferred.
Actual
Client throws:
System.Text.Json.JsonException: 'T' is an invalid start of a value
at ChatResponseUpdateAGUIExtensions.DeserializeResultIfAvailable(ToolCallResultEvent ...)
Expected
Non-JSON tool result content should not crash deserialization.
Either:
treat content as raw string result, or
deserialize as JsonElement only when content is valid JSON.
Root cause candidate
In ChatResponseUpdateAGUIExtensions:
SerializeResultContent returns raw string for FunctionResultContent strings.
DeserializeResultIfAvailable always attempts JsonSerializer.Deserialize(... JsonElement ...) for non-empty content.
This fails for plain text like Transferred.
Suggested fix
Fallback to raw string when JsonElement deserialization fails.
Code Sample
Error Messages / Stack Traces
Package Versions
Microsoft.Agents.AI.AGUI: 1.3.0-preview.260423.1
.NET Version
NET 10.0
Additional Context
No response
Description
I’m seeing a crash in AGUI streaming when a workflow handoff emits a TOOL_CALL_RESULT with plain text content.
Environment
Repro
Actual
Client throws:
System.Text.Json.JsonException: 'T' is an invalid start of a value
at ChatResponseUpdateAGUIExtensions.DeserializeResultIfAvailable(ToolCallResultEvent ...)
Expected
Non-JSON tool result content should not crash deserialization.
Either:
treat content as raw string result, or
deserialize as JsonElement only when content is valid JSON.
Root cause candidate
In ChatResponseUpdateAGUIExtensions:
SerializeResultContent returns raw string for FunctionResultContent strings.
DeserializeResultIfAvailable always attempts JsonSerializer.Deserialize(... JsonElement ...) for non-empty content.
This fails for plain text like Transferred.
Suggested fix
Fallback to raw string when JsonElement deserialization fails.
Code Sample
Error Messages / Stack Traces
Package Versions
Microsoft.Agents.AI.AGUI: 1.3.0-preview.260423.1
.NET Version
NET 10.0
Additional Context
No response