Skip to content

Python: Fix type hint for Case and Default#3985

Merged
eavanvalkenburg merged 3 commits into
microsoft:mainfrom
cecheta:case-typing
Mar 13, 2026
Merged

Python: Fix type hint for Case and Default#3985
eavanvalkenburg merged 3 commits into
microsoft:mainfrom
cecheta:case-typing

Conversation

@cecheta

@cecheta cecheta commented Feb 17, 2026

Copy link
Copy Markdown
Member

Motivation and Context

Closes #3974

Description

Case and Default should accept SupportsAgentRun as target, and should not accept str as it throws an error here.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings February 17, 2026 11:12
@markwallace-microsoft markwallace-microsoft added the python Usage: [Issues, PRs], Target: Python label Feb 17, 2026
@cecheta cecheta changed the title Fix type hint for Case and Default Python: Fix type hint for Case and Default Feb 17, 2026
@markwallace-microsoft

markwallace-microsoft commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework/_workflows
   _edge.py2292887%47, 69–70, 72, 167, 197, 446–447, 452, 456–461, 463–465, 581, 695, 702–704, 751, 779, 805, 859, 873
TOTAL23684262788% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
5176 20 💤 0 ❌ 0 🔥 1m 25s ⏱️

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the type hints for Case and Default classes in the workflow package to correctly accept SupportsAgentRun instances as targets, resolving issue #3974.

Changes:

  • Updated Case.target and Default.target type hints from Executor | str to Executor | SupportsAgentRun
  • Added import for SupportsAgentRun from ._agents module
  • Reformatted tools type annotation in _types.py from multi-line to single-line

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
python/packages/core/agent_framework/_workflows/_edge.py Fixed type hints for Case and Default target parameter to accept SupportsAgentRun instead of str, and added required import
python/packages/core/agent_framework/_types.py Reformatted tools type annotation from multi-line to single-line

Comment thread python/packages/core/agent_framework/_workflows/_edge.py
@TaoChenOSU

Copy link
Copy Markdown
Contributor

@cecheta thank you for your contribution!

Could you please also add unit tests for the changes?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Mar 13, 2026
Merged via the queue into microsoft:main with commit 84bae0f Mar 13, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: Case and Default should support SupportsAgentRun as the target

6 participants