Python: Replaced obsolete create_response method in samples#3542
Merged
dmytrostruk merged 3 commits intomicrosoft:mainfrom Jan 30, 2026
Merged
Python: Replaced obsolete create_response method in samples#3542dmytrostruk merged 3 commits intomicrosoft:mainfrom
dmytrostruk merged 3 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates Python sample code to replace the obsolete create_response method with the new to_function_approval_response method on the Content type. This is part of API modernization where FunctionApprovalRequestContent and FunctionApprovalResponseContent types have been replaced with a generic Content type using type discriminators.
Changes:
- Replaced imports of
FunctionApprovalRequestContentandFunctionApprovalResponseContentwith the genericContenttype - Updated type checking from
isinstance(data, FunctionApprovalRequestContent)toisinstance(data, Content) and data.type == "function_approval_request" - Replaced all calls to
create_response()withto_function_approval_response()on Content objects - Updated comments and documentation to reflect the new API
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sequential_builder_tool_approval.py | Updated imports, type checks, and method calls for tool approval in sequential workflows |
| group_chat_builder_tool_approval.py | Updated imports, type checks, and method calls for tool approval in group chat workflows |
| concurrent_builder_tool_approval.py | Updated imports, type checks, and method calls for tool approval in concurrent workflows |
| agents_with_approval_requests.py | Updated imports, type checks, and method calls for approval requests; contains a critical bug |
| handoff_with_tool_approval_checkpoint_resume.py | Updated imports, type checks, method calls, and helper function signatures for checkpoint workflows |
| function_tool_with_approval_and_threads.py | Updated method calls from create_response to to_function_approval_response |
| function_tool_with_approval.py | Updated method calls from create_response to to_function_approval_response |
| openai_responses_client_with_hosted_mcp.py | Updated method calls in OpenAI client examples |
| azure_responses_client_with_hosted_mcp.py | Updated method calls in Azure OpenAI client examples |
| azure_ai_with_multiple_tools.py | Updated method calls in Azure AI agent examples |
| azure_ai_with_hosted_mcp.py (azure_ai_agent) | Updated method calls in Azure AI agent with MCP example |
| azure_ai_with_hosted_mcp.py (azure_ai) | Updated method calls in Azure AI with MCP example |
python/samples/getting_started/workflows/human-in-the-loop/agents_with_approval_requests.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/workflows/human-in-the-loop/agents_with_approval_requests.py
Outdated
Show resolved
Hide resolved
moonbox3
approved these changes
Jan 30, 2026
giles17
approved these changes
Jan 30, 2026
eavanvalkenburg
pushed a commit
to eavanvalkenburg/agent-framework
that referenced
this pull request
Feb 1, 2026
…t#3542) * Replaced obsolete create_response method in samples * Addressed PR comments
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
Replaced obsolete
create_responsemethod withto_function_approval_responseonContenttype in samples.Contribution Checklist