Skip to content

Python: Deprecate Azure AI v1 (Persistent Agents API) helper methods#4804

Merged
eavanvalkenburg merged 2 commits intomicrosoft:mainfrom
giles17:deprecate-azure-ai-v1-helpers
Mar 20, 2026
Merged

Python: Deprecate Azure AI v1 (Persistent Agents API) helper methods#4804
eavanvalkenburg merged 2 commits intomicrosoft:mainfrom
giles17:deprecate-azure-ai-v1-helpers

Conversation

@giles17
Copy link
Contributor

@giles17 giles17 commented Mar 20, 2026

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 DeprecationWarning via warnings.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 -> use AzureAIProjectAgentProvider
  • AzureAIAgentClient -> use AzureAIClient
  • AzureAIAgentOptions -> use AzureAIProjectAgentOptions (docstring only; TypedDict has no runtime constructor)

Provider methods (AzureAIAgentsProvider):

  • create_agent() -> use AzureAIProjectAgentProvider.create_agent()
  • get_agent() -> use AzureAIProjectAgentProvider.get_agent()
  • as_agent() -> use AzureAIProjectAgentProvider.as_agent()

Functions (_shared.py):

  • to_azure_ai_agent_tools() -> use to_azure_ai_tools()
  • from_azure_ai_agent_tools() -> use from_azure_ai_tools()

Static tool factory methods on AzureAIAgentClient:

  • get_code_interpreter_tool() -> use AzureAIClient.get_code_interpreter_tool()
  • get_file_search_tool() -> use AzureAIClient.get_file_search_tool()
  • get_web_search_tool() -> use AzureAIClient.get_web_search_tool()
  • get_mcp_tool() -> use AzureAIClient.get_mcp_tool()

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.

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>
Copilot AI review requested due to automatic review settings March 20, 2026 00:06
@github-actions github-actions bot changed the title Deprecate Azure AI v1 (Persistent Agents API) helper methods Python: Deprecate Azure AI v1 (Persistent Agents API) helper methods Mar 20, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Mar 20, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/azure-ai/agent_framework_azure_ai
   _agent_provider.py114199%270
   _chat_client.py4957884%465–466, 468, 658, 663–664, 666–667, 670, 673, 675, 680, 941–942, 944, 947, 950, 953–958, 961, 963, 971, 983–985, 989, 992–993, 1001–1004, 1014, 1022–1025, 1027–1028, 1030–1031, 1038, 1046–1047, 1055–1068, 1073, 1076, 1084, 1090, 1098–1100, 1103, 1123–1124, 1257, 1284, 1299, 1415, 1465, 1471
   _shared.py2562391%112, 193, 251, 253–255, 287, 330, 342–344, 373, 375, 377, 381, 446, 451, 456, 493, 530, 537, 549, 568
TOTAL27144322288% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
5277 20 💤 0 ❌ 0 🔥 1m 24s ⏱️

Copy link
Contributor

Copilot AI left a comment

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 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 AzureAIAgentClient and 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>
@giles17 giles17 enabled auto-merge March 20, 2026 00:51
@giles17 giles17 disabled auto-merge March 20, 2026 01:01
@chetantoshniwal
Copy link

The new name looks a bit odd. Let's evaluate if we want to rename them before surfacing the warnings.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants