Python: (ag-ui): fix Workflow.as_agent() streaming regression#3875
Merged
moonbox3 merged 4 commits intomicrosoft:mainfrom Feb 12, 2026
Merged
Python: (ag-ui): fix Workflow.as_agent() streaming regression#3875moonbox3 merged 4 commits intomicrosoft:mainfrom
moonbox3 merged 4 commits intomicrosoft:mainfrom
Conversation
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a streaming regression in the Python AG-UI integration so workflow-backed agents (e.g., Workflow.as_agent()) that return an async generator for run(stream=True) can be streamed correctly through add_agent_framework_fastapi_endpoint.
Changes:
- Added
_normalize_response_streaminagent_framework_ag_ui/_run.pyto acceptResponseStream,AsyncIterable, or anAwaitableresolving to either. - Updated
run_agent_streamto normalize streaming outputs before iterating. - Added regression tests covering both the normalization helper and a FastAPI endpoint path using an async-generator streaming agent.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| python/packages/ag-ui/agent_framework_ag_ui/_run.py | Normalizes agent streaming return types and updates streaming execution path; includes some additional typing-safety adjustments. |
| python/packages/ag-ui/tests/ag_ui/test_run.py | Adds unit tests for _normalize_response_stream (accept async iterables, reject invalid values). |
| python/packages/ag-ui/tests/ag_ui/test_endpoint.py | Adds endpoint regression test ensuring FastAPI streaming works when run(stream=True) returns an async generator. |
eavanvalkenburg
approved these changes
Feb 12, 2026
giles17
approved these changes
Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
add_agent_framework_fastapi_endpointfailed for workflow-backed agents because AG-UI tried to await an async generator returned byWorkflowAgent.run(stream=True).In #3379, AG-UI switched to
agent.run(stream=True)and assumed streaming results were either:But
WorkflowAgent.run(stream=True)returns anAsyncIterable(async generator), which is not awaitable.What changed
Tests
Added regression coverage for both unit and endpoint paths:
Description
Contribution Checklist