You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python: [Bug]: foundry_hosting returns "Content(type=data)" instead of the generated image in image_generation_call.result #9350
When an agent hosted with ResponsesHostServer (agent-framework-foundry-hosting) produces an image with the image generation tool, the image_generation_call output item it sends has result: "Content(type=data)" instead of the image.
The OpenAI chat client stores the generated image as the outputs of an image_generation_tool_result content, as a data URI Content (data:image/png;base64,...). The host passes str(content.outputs) to the SDK's output_item_image_gen_call(result_base64), so the result is the Content repr, and clients that decode result as base64 get garbage.
Expected Behavior
image_generation_call.result is the base64 image, as in the OpenAI Responses API (the SDK parameter is result_base64). The sibling package hosting-responses already extracts it this way in _image_generation_result (agent_framework_hosting_responses/_parsing.py).
Steps to Reproduce
Stream an image_generation_tool_result with a data URI image through the foundry_hosting output tracker (this is what happens for a hosted agent that uses image generation).
Look at the result of the emitted image_generation_call item.
The cause is in agent_framework_foundry_hosting/_responses.py, _OutputItemTracker.handle: self._stream.output_item_image_gen_call(str(content.outputs)).
Error Messages and Stack Traces
No error. The output item carries the text Content(type=data) instead of the image.
Package Versions
agent-framework-foundry-hosting: 1.0.0b261008 (main at b5e5521), agent-framework-core: 1.21.0
Python Version
Python 3.12
Additional Context
I'd like to fix this. The change is a small helper that returns the base64 part of a data URI (the same logic as hosting-responses), used in place of str(content.outputs), plus a regression test.
AI assistance: I used an AI coding assistant for the analysis and to draft this report. I reproduced and verified the behavior myself.
Activity