Python: Deprecate Azure AI v1 (Persistent Agents API) helper methods#4804
Merged
eavanvalkenburg merged 2 commits intomicrosoft:mainfrom Mar 20, 2026
Merged
Conversation
Add DeprecationWarning to v1 classes and functions that have been superseded by the v2 (Projects/Responses) API: - AzureAIAgentsProvider -> use AzureAIProjectAgentProvider - AzureAIAgentClient -> use AzureAIClient - AzureAIAgentOptions -> use AzureAIProjectAgentOptions - to_azure_ai_agent_tools() -> use to_azure_ai_tools() - from_azure_ai_agent_tools() -> use from_azure_ai_tools() - AzureAIAgentClient static tool factory methods -> use AzureAIClient equivalents All v1 components still function but emit warnings to guide migration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This PR deprecates the Azure AI v1 (Persistent Agents API) helper surface in the Python agent_framework_azure_ai package by adding runtime DeprecationWarnings and deprecation notes, guiding users toward the v2 (Projects/Responses) equivalents.
Changes:
- Added
warnings.warn(..., DeprecationWarning, stacklevel=2)to v1 tool-conversion helpers in_shared.py. - Added deprecation warnings (and docstring deprecation notes) to
AzureAIAgentClientand its static hosted-tool factory methods. - Added a deprecation warning (and docstring deprecation note) to
AzureAIAgentsProvider.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/packages/azure-ai/agent_framework_azure_ai/_shared.py | Deprecates v1 tool conversion helpers (to_azure_ai_agent_tools, from_azure_ai_agent_tools) via DeprecationWarning + docstring notice. |
| python/packages/azure-ai/agent_framework_azure_ai/_chat_client.py | Deprecates AzureAIAgentClient (constructor + docstring) and its static hosted-tool factory methods via DeprecationWarning. |
| python/packages/azure-ai/agent_framework_azure_ai/_agent_provider.py | Deprecates AzureAIAgentsProvider initialization via DeprecationWarning + docstring notice. |
Mark create_agent(), get_agent(), and as_agent() as deprecated individually, pointing to AzureAIProjectAgentProvider equivalents. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
moonbox3
approved these changes
Mar 20, 2026
|
The new name looks a bit odd. Let's evaluate if we want to rename them before surfacing the warnings. |
eavanvalkenburg
approved these changes
Mar 20, 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
The Azure AI package has v1 (Persistent Agents API) classes and helper functions that have been superseded by the v2 (Projects/Responses) API. These v1 components should be marked as deprecated to guide users toward migration before eventual removal.
Description
Adds
DeprecationWarningviawarnings.warn()to all v1 Azure AI components, following the existing deprecation pattern used elsewhere in the codebase. All v1 components still function but now emit warnings pointing users to their v2 replacements:Classes:
AzureAIAgentsProvider-> useAzureAIProjectAgentProviderAzureAIAgentClient-> useAzureAIClientAzureAIAgentOptions-> useAzureAIProjectAgentOptions(docstring only; TypedDict has no runtime constructor)Provider methods (
AzureAIAgentsProvider):create_agent()-> useAzureAIProjectAgentProvider.create_agent()get_agent()-> useAzureAIProjectAgentProvider.get_agent()as_agent()-> useAzureAIProjectAgentProvider.as_agent()Functions (
_shared.py):to_azure_ai_agent_tools()-> useto_azure_ai_tools()from_azure_ai_agent_tools()-> usefrom_azure_ai_tools()Static tool factory methods on
AzureAIAgentClient:get_code_interpreter_tool()-> useAzureAIClient.get_code_interpreter_tool()get_file_search_tool()-> useAzureAIClient.get_file_search_tool()get_web_search_tool()-> useAzureAIClient.get_web_search_tool()get_mcp_tool()-> useAzureAIClient.get_mcp_tool()Contribution Checklist