Skip to content

autogen-ext: Support Image generation message on ai agent#7156

Open
linznin wants to merge 2 commits into
microsoft:mainfrom
linznin:image_generation_ai_agent
Open

autogen-ext: Support Image generation message on ai agent#7156
linznin wants to merge 2 commits into
microsoft:mainfrom
linznin:image_generation_ai_agent

Conversation

@linznin

@linznin linznin commented Dec 30, 2025

Copy link
Copy Markdown
Contributor

Why are these changes needed?

This PR adds support for handling image generation results returned via the OpenAI Responses API in the OpenAI agent message stream.

Previously, the agent primarily relied on response_obj.output_text (or a fallback placeholder) and would therefore miss non-text outputs contained in response_obj.output, such as image generation tool calls. As a result, image-generation-capable models/tools could successfully generate images, but the agent would not surface them to downstream consumers (and message history would not reflect them).

With this change, the agent:

  • Parses response_obj.output when present.
  • Converts ImageGenerationCall results (base64) into AddImage items so downstream UIs/clients can render images.
  • Collects text from ResponseOutputMessage parts and returns TextMessage when output is purely textual.
  • Returns a MultiModalMessage when the output includes non-string content (e.g., images), while preserving message history semantics.

This enables image generation responses to be delivered through the same streaming interface and message abstractions used by other modalities.

Related issue number

N/A

Checks

@codecov

codecov Bot commented Dec 30, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.05882% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.18%. Comparing base (13e144e) to head (0bffcf4).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ext/src/autogen_ext/agents/openai/_openai_agent.py 47.05% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7156      +/-   ##
==========================================
- Coverage   81.22%   81.18%   -0.04%     
==========================================
  Files         244      244              
  Lines       18512    18525      +13     
==========================================
+ Hits        15036    15040       +4     
- Misses       3476     3485       +9     
Flag Coverage Δ
unittests 81.18% <47.05%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@linznin linznin changed the title Image generation ai agent feat(autogen-ext): Support Image generation message on ai agent Jan 5, 2026
@linznin

linznin commented Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@linznin linznin changed the title feat(autogen-ext): Support Image generation message on ai agent autogen-ext: Support Image generation message on ai agent Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants