Python: Fix WorkflowAgent non-streaming return type - #8287
Open
WhaleTech (ryo-whaletech) wants to merge 1 commit into
Open
Python: Fix WorkflowAgent non-streaming return type#8287WhaleTech (ryo-whaletech) wants to merge 1 commit into
WhaleTech (ryo-whaletech) wants to merge 1 commit into
Conversation
WhaleTech (ryo-whaletech)
deployed
to
github-app-auth
September 11, 2026 09:39 — with
GitHub Actions
Active
WhaleTech (ryo-whaletech)
deployed
to
github-app-auth
September 11, 2026 09:39 — with
GitHub Actions
Active
WhaleTech (ryo-whaletech)
deployed
to
github-app-auth
September 11, 2026 09:39 — with
GitHub Actions
Active
WhaleTech (ryo-whaletech)
deployed
to
github-app-auth
September 11, 2026 09:39 — with
GitHub Actions
Active
Copilot started reviewing on behalf of
WhaleTech (ryo-whaletech)
September 11, 2026 09:40
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The typing fix matches runtime behavior and includes focused regression coverage.
Pull request overview
This pull request aligns WorkflowAgent.run() typing with runtime behavior and SupportsAgentRun.
Changes:
- Corrects non-streaming overload return types.
- Adds assertions for default, non-streaming, and streaming calls.
File summaries
| File | Summary |
|---|---|
python/packages/core/tests/workflow/test_workflow_agent.py |
Adds overload regression assertions. |
python/packages/core/agent_framework/_workflows/_agent.py |
Fixes the non-streaming return annotation. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Sep 11, 2026
Eduard van Valkenburg (eavanvalkenburg)
enabled auto-merge
September 11, 2026 09:42
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Sep 11, 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 & Context
WorkflowAgent.run(stream=False)currently exposes aResponseStream[AgentResponseUpdate, AgentResponse]return type even though the runtime false branch returns the non-streaming_run_impl()awaitable. This disagrees withSupportsAgentRun, the method documentation, and nearby agent implementations, so type checkers and IDEs see the wrong public pre-await return type.Runtime execution is already correct. This change aligns the overload with existing behavior and the common agent contract.
Description & Review Guide
Literal[False]overload ofWorkflowAgent.run()to returnAwaitable[AgentResponse].assert_typecoverage for omitted/defaultstream, explicitstream=False, andstream=True.stream=Truetyping and runtime execution are unchanged.git diff --check.SupportsAgentRuncontract.assert_typecoverage is the preferred regression mechanism..pyicurrently re-exports the concrete class directly.Related Issue
Fixes #8286
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.