Python: Add samples syntax checking with pyright#3710
Merged
moonbox3 merged 6 commits intomicrosoft:mainfrom Feb 7, 2026
Merged
Python: Add samples syntax checking with pyright#3710moonbox3 merged 6 commits intomicrosoft:mainfrom
moonbox3 merged 6 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds syntax checking for Python samples using pyright with a relaxed configuration that validates imports and attribute access without strict type checking. The PR includes the pyright configuration, build task integration, and fixes to 78 sample errors related to import reorganization and API changes.
Changes:
- Added
pyrightconfig.samples.jsonwith relaxed type checking configuration - Added
samples-syntaxpoe task and integrated it intocheckandpre-commit-checkworkflows - Updated samples to import workflow builders from
agent_framework_orchestrationspackage - Changed content type checking from
isinstance()to.typeproperty comparisons - Updated API usage for
normalize_messages,ChatMessage.text,Role,Annotationaccess patterns, andContentfactory methods
Reviewed changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| python/pyrightconfig.samples.json | New pyright configuration for sample validation with import/attribute checking |
| python/pyproject.toml | Added samples-syntax task and integrated into check/pre-commit workflows |
| python/AGENTS.md | Documentation for samples syntax checking process and exclusions |
| python/samples/getting_started/workflows/*/*.py | Updated imports from agent_framework to agent_framework_orchestrations for builders |
| python/samples/getting_started/tools/*.py | Changed isinstance checks to content.type comparisons |
| python/samples/getting_started/orchestrations/*.py | Updated imports and role access patterns |
| python/samples/getting_started/agents/*/*.py | Updated Content factory method usage and annotation access patterns |
| python/samples/getting_started/context_providers/*.py | Changed msg.content to msg.text |
| python/samples/demos/*/*.py | Updated to use ExecutorEvent instead of AgentRunUpdateEvent |
| python/samples/autogen-migration/*/*.py | Updated imports and content type checking patterns |
python/samples/getting_started/agents/anthropic/anthropic_advanced.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/agents/anthropic/anthropic_foundry.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/tools/function_tool_recover_from_failures.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/tools/function_tool_with_max_exceptions.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/tools/function_tool_with_max_invocations.py
Outdated
Show resolved
Hide resolved
moonbox3
requested changes
Feb 6, 2026
python/samples/getting_started/workflows/agents/concurrent_workflow_as_agent.py
Show resolved
Hide resolved
5cb028c to
e8abeed
Compare
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
TaoChenOSU
approved these changes
Feb 6, 2026
python/samples/autogen-migration/orchestrations/01_round_robin_group_chat.py
Outdated
Show resolved
Hide resolved
moonbox3
reviewed
Feb 7, 2026
python/samples/autogen-migration/orchestrations/01_round_robin_group_chat.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/workflows/agents/handoff_workflow_as_agent.py
Show resolved
Hide resolved
ca9468a to
96d92ec
Compare
- Add pyrightconfig.samples.json with relaxed type checking but import validation - Add samples-syntax poe task to check samples for syntax and import errors - Add samples-syntax to check and pre-commit-check tasks - Fix 78 sample errors: - Update workflow builder imports to use agent_framework_orchestrations - Change content type isinstance checks to content.type comparisons - Use Content factory methods instead of removed content type classes - Fix TypedDict access patterns for Annotation - Fix various API mismatches (normalize_messages, ChatMessage.text, role)
e2bc95e to
50220cd
Compare
moonbox3
approved these changes
Feb 7, 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
Description
Contribution Checklist