Python: Fixed SK migration samples#4046
Merged
dmytrostruk merged 3 commits intomicrosoft:mainfrom Feb 18, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes incorrect and outdated API calls in Semantic Kernel migration samples to align with recent breaking changes in both Semantic Kernel and Agent Framework APIs. The changes ensure that the migration samples accurately demonstrate the differences between SK and AF patterns.
Changes:
- Updated SK method names (as_agent → create_agent, get_executor_state → get_state, AzureResponsesAgent → OpenAIResponsesAgent)
- Fixed AF API parameter names (HandoffUserInputRequest → HandoffAgentUserRequest, set_coordinator → with_start_agent, ai_model_id → model_id)
- Corrected handoff sample: wrapped single targets in lists, fixed response format to use list[Message], added termination condition
- Fixed import paths from private (_tools) to public APIs
- Added missing self parameter to SK method, fixed session reuse pattern, corrected static method calls
- Updated SK prompt template syntax ({{topic}} → {{$topic}})
- Improved output extraction logic to handle list[Message] responses
- Updated dependency markers in uv.lock for Python 3.14 compatibility
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Updated dependency markers for Python version constraints (< 3.14 for cffi/pythonnet, < 3.11 for exceptiongroup) |
| python/samples/semantic-kernel-migration/processes/nested_process.py | Fixed SK API: get_executor_state → get_state |
| python/samples/semantic-kernel-migration/processes/fan_out_fan_in_process.py | Fixed SK API: get_executor_state → get_state |
| python/samples/semantic-kernel-migration/orchestrations/magentic.py | Removed shadowed Agent import, fixed ai_model_id → model_id, corrected static method call, improved output extraction for list[Message] |
| python/samples/semantic-kernel-migration/orchestrations/handoff.py | Fixed AF handoff API: HandoffUserInputRequest → HandoffAgentUserRequest, set_coordinator → with_start_agent, wrapped single targets in lists, fixed response format to use list[Message], added termination condition |
| python/samples/semantic-kernel-migration/orchestrations/group_chat.py | Removed shadowed Agent import, fixed SK prompt template syntax ({{topic}} → {{$topic}}, {{participants}} → {{$participants}}), added max_rounds parameter |
| python/samples/semantic-kernel-migration/orchestrations/concurrent_basic.py | Fixed return type annotation: list[Agent] → list[ChatCompletionAgent] |
| python/samples/semantic-kernel-migration/openai_responses/03_responses_agent_structured_output.py | Updated to use OpenAIResponsesAgent instead of AzureResponsesAgent, removed credential management |
| python/samples/semantic-kernel-migration/openai_responses/02_responses_agent_with_tool.py | Fixed tool import: _tools → public API, updated to OpenAIResponsesAgent |
| python/samples/semantic-kernel-migration/openai_responses/01_basic_responses_agent.py | Updated to use OpenAIResponsesAgent instead of AzureResponsesAgent |
| python/samples/semantic-kernel-migration/openai_assistant/03_openai_assistant_function_tool.py | Added missing self parameter to method, fixed tool import path, moved plugins parameter to agent instantiation |
| python/samples/semantic-kernel-migration/openai_assistant/02_openai_assistant_with_code_interpreter.py | Fixed SK settings property: chat_deployment_name → chat_model_id |
| python/samples/semantic-kernel-migration/openai_assistant/01_basic_openai_assistant.py | Fixed session reuse pattern to use same session object for follow-up |
| python/samples/semantic-kernel-migration/chat_completion/02_chat_completion_with_tool.py | Fixed tool import: _tools → public API |
| python/samples/semantic-kernel-migration/azure_ai_agent/03_azure_ai_agent_threads_and_followups.py | Fixed SK API: as_agent → create_agent |
| python/samples/semantic-kernel-migration/azure_ai_agent/02_azure_ai_agent_with_code_interpreter.py | Fixed to use static method call for get_code_interpreter_tool |
| python/samples/semantic-kernel-migration/azure_ai_agent/01_basic_azure_ai_agent.py | Fixed SK API: as_agent → create_agent |
af71ab5 to
f3713e7
Compare
giles17
approved these changes
Feb 18, 2026
TaoChenOSU
approved these changes
Feb 18, 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
Contribution Checklist