Pre-flight Checklist
Describe the Bug
Both aws-strands adapters translate a Strands toolResult into an AG-UI TOOL_CALL_RESULT event by walking the result's content blocks. Only some block types are read, so any result whose payload is non-text is silently lost: no error, no warning, and the client sees no data.
The two SDKs drop it differently:
- Python (
ag_ui_strands): the content loop only handles a text block. A result made of a json, image, document, or video block (with no text block) leaves result_data = None, and the guard if not result_tool_id or result_data is None: continue skips the block entirely, so no TOOL_CALL_RESULT is emitted at all.
- TypeScript (
@ag-ui/aws-strands): the loop reads TextBlock and .json, so json results forward correctly, but ImageBlock / DocumentBlock / VideoBlock fall through, leaving resultData = null. The event still fires but collapses to content: "", so the media payload is dropped.
Net effect: a tool that returns an image, document, or video (and, on Python, json) produces either a missing or empty tool result on the wire.
Steps to Reproduce
-
Register a Strands tool that returns a non-text result, e.g. an image: { "toolResult": { "toolUseId": "...", "content": [ { "image": { "format": "png", "source": { "bytes": <bytes> } } } ] } } (Python) or a tool yielding an ImageBlock (TypeScript).
-
Run the agent through the aws-strands adapter and capture the emitted AG-UI events.
-
Observe the TOOL_CALL_RESULT: on Python no event is emitted for that tool call; on TypeScript the event is emitted with content: "". The image/document/video payload never reaches the client.
Expected Behavior
A tool result carrying a json/image/document/video block (but no text block) should still produce a non-empty TOOL_CALL_RESULT whose content carries the block's serialized payload (e.g. { "image": { "format": "png", "source": {...} } }).
A genuinely void tool (empty content array) should continue to emit content: ""; that behaviour is intended and should be preserved.
Both adapters should behave identically here.
Environment
AG-UI package(s) & version(s): @ag-ui/aws-strands@0.2.3 (TypeScript, depends on @strands-agents/sdk ^1.1.0, @ag-ui/core >=0.0.37); ag_ui_strands 0.2.3 (Python, depends on strands-agents >=1.15.0,
ag-ui-protocol >=0.1.18)
Runtime: Node 22 / Python 3.12
Model provider: any (the bug is in the adapter's event translation, not the model)
Screenshots
No response
Logs & Errors
Additional Context
#1978 is the same "no text block" failure mode on the input side (convert_agui_content_to_strands produces a document-only Strands message that Bedrock rejects); this report is the output side counterpart.
#1593 notes that TOOL_CALL_RESULT has no structured field for non-text payloads, so a fix serialises the media block into the existing string content field rather than a new structured field; #1593 remains the proper long-term home for structured tool output.
Pre-flight Checklist
Describe the Bug
Both aws-strands adapters translate a Strands
toolResultinto an AG-UITOOL_CALL_RESULTevent by walking the result's content blocks. Only some block types are read, so any result whose payload is non-text is silently lost: no error, no warning, and the client sees no data.The two SDKs drop it differently:
ag_ui_strands): the content loop only handles atextblock. A result made of ajson,image,document, orvideoblock (with no text block) leavesresult_data = None, and the guardif not result_tool_id or result_data is None: continueskips the block entirely, so noTOOL_CALL_RESULTis emitted at all.@ag-ui/aws-strands): the loop readsTextBlockand.json, so json results forward correctly, butImageBlock/DocumentBlock/VideoBlockfall through, leavingresultData = null. The event still fires but collapses tocontent: "", so the media payload is dropped.Net effect: a tool that returns an image, document, or video (and, on Python, json) produces either a missing or empty tool result on the wire.
Steps to Reproduce
Register a Strands tool that returns a non-text result, e.g. an image:
{ "toolResult": { "toolUseId": "...", "content": [ { "image": { "format": "png", "source": { "bytes": <bytes> } } } ] } }(Python) or a tool yielding anImageBlock(TypeScript).Run the agent through the aws-strands adapter and capture the emitted AG-UI events.
Observe the
TOOL_CALL_RESULT: on Python no event is emitted for that tool call; on TypeScript the event is emitted withcontent: "". The image/document/video payload never reaches the client.Expected Behavior
A tool result carrying a json/image/document/video block (but no text block) should still produce a non-empty TOOL_CALL_RESULT whose
contentcarries the block's serialized payload (e.g.{ "image": { "format": "png", "source": {...} } }).A genuinely void tool (empty content array) should continue to emit
content: ""; that behaviour is intended and should be preserved.Both adapters should behave identically here.
Environment
Screenshots
No response
Logs & Errors
Additional Context
#1978 is the same "no text block" failure mode on the input side (convert_agui_content_to_strands produces a document-only Strands message that Bedrock rejects); this report is the output side counterpart.
#1593 notes that TOOL_CALL_RESULT has no structured field for non-text payloads, so a fix serialises the media block into the existing string
contentfield rather than a new structured field; #1593 remains the proper long-term home for structured tool output.