Skip to content

Python: [Breaking] Upgrade to azure-ai-projects 2.0+#4536

Open
eavanvalkenburg wants to merge 7 commits intomicrosoft:mainfrom
eavanvalkenburg:projects_2.0
Open

Python: [Breaking] Upgrade to azure-ai-projects 2.0+#4536
eavanvalkenburg wants to merge 7 commits intomicrosoft:mainfrom
eavanvalkenburg:projects_2.0

Conversation

@eavanvalkenburg
Copy link
Member

@eavanvalkenburg eavanvalkenburg commented Mar 7, 2026

Motivation and Context

This change completes the Python move to the azure-ai-projects 2.0 GA surface. It replaces the prior beta dependency pin and removes compatibility behavior that no longer matches the supported SDK baseline, while keeping preview opt-in available through the allow_preview flag supported by the 2.0 client.

Description

  • Update the Python core dependency bound for azure-ai-projects to >=2.0.0,<3.0 and refresh uv.lock.
  • Align Azure AI integrations with the GA SDK model surface by using the 2.0 type names for code interpreter containers and text response formats.
  • Remove compatibility/feature-detection paths that were added for mixed SDK behavior and assume the supported 2.0 client surface directly.
  • Remove unsupported foundry_features passthrough from Azure AI agent creation, since the 2.0 create_version API does not expose that parameter.
  • Preserve preview opt-in where it is actually supported by wiring allow_preview through the Azure AI client, responses client, and Foundry memory provider creation paths.
  • Update Azure AI tests and sample/docs to reflect the supported SDK behavior, and add Python contributor guidance in python/AGENTS.md for PR descriptions to follow the repository template.
  • Include small repo-hook-driven cleanup changes in touched Python files.

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.

eavanvalkenburg and others added 2 commits March 7, 2026 10:05
Add allow_preview support for internal AIProjectClient creation, keep backward compatibility for renamed SDK model classes, and align Azure AI/core paths and tests for GA validation workflows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 7, 2026 09:15
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python labels Mar 7, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Mar 7, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/azure-ai/agent_framework_azure_ai
   _client.py4054987%214, 392, 394, 442, 452–456, 458–464, 477, 538, 553–558, 600, 616–617, 643–644, 662, 697, 699, 720–721, 724, 769, 772, 774, 865, 896, 938, 1147, 1150, 1153–1154, 1156–1159
   _foundry_memory_provider.py910100% 
   _project_provider.py122595%157, 213, 312, 352, 385
   _shared.py2532390%111, 182, 230, 232–234, 266, 309, 321–323, 352, 354, 356, 360, 425, 430, 435, 472, 509, 516, 528, 547
packages/core/agent_framework
   _skills.py289897%576, 615–616, 689, 694, 846–847, 1055
packages/core/agent_framework/azure
   _responses_client.py54688%220, 268, 274–277
packages/declarative/agent_framework_declarative/_workflows
   _executors_tools.py196398%227, 570–571
TOTAL22681257688% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
4930 20 💤 0 ❌ 0 🔥 1m 21s ⏱️

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

Updates the Python Azure AI integration to require azure-ai-projects GA (2.0+) and removes/updates code paths that existed only for pre-2.0 SDK compatibility, aligning core + Azure AI package code and samples with the v2 API surface.

Changes:

  • Bump azure-ai-projects dependency constraint to >=2.0.0,<3.0 (and refresh the lockfile to GA).
  • Update Azure AI client/provider code to support allow_preview on internally-created AIProjectClient and gate preview-only agent creation behavior accordingly.
  • Remove/replace pre-2.0 model/tool types (e.g., Code Interpreter and text response format types) and adjust tests/samples.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
python/uv.lock Moves azure-ai-projects to 2.0.0 GA and updates resolved dependency set.
python/samples/02-agents/providers/azure_ai/README.md Documents allow_preview=True requirement for preview-only agent creation on GA SDKs.
python/packages/core/tests/workflow/test_function_executor.py Suppresses pyright deprecation diagnostics for asyncio.iscoroutinefunction in tests.
python/packages/core/pyproject.toml Updates core dependency constraint for azure-ai-projects to >=2.0.0,<3.0.
python/packages/core/agent_framework/azure/_responses_client.py Adds allow_preview plumbing when auto-creating AIProjectClient from a Foundry project endpoint.
python/packages/azure-ai/tests/test_azure_ai_client.py Updates Code Interpreter tool construction to 2.0+ AutoCodeInterpreterToolParam.
python/packages/azure-ai/agent_framework_azure_ai/_shared.py Switches to 2.0+ text response format model types and simplifies return typing.
python/packages/azure-ai/agent_framework_azure_ai/_project_provider.py Adds allow_preview support and preview feature gating for agent version creation.
python/packages/azure-ai/agent_framework_azure_ai/_client.py Adds allow_preview support and preview feature gating for agent creation in the client flow.

@eavanvalkenburg eavanvalkenburg changed the title Python: require azure-ai-projects 2.0+ Python: Upgrade to azure-ai-projects 2.0+ Mar 7, 2026
@eavanvalkenburg eavanvalkenburg changed the title Python: Upgrade to azure-ai-projects 2.0+ Python: [Breaking] Upgrade to azure-ai-projects 2.0+ Mar 7, 2026
eavanvalkenburg and others added 5 commits March 7, 2026 10:38
Assume azure-ai-projects 2.0+ in Azure AI client/provider/responses code paths by removing _supports_keyword_argument gating and related fallback branching.

Also fix pyright typing in FoundryMemoryProvider memory store calls by using ResponseInputItemParam-typed items.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Drop foundry_features from Azure AI client and provider surfaces because azure-ai-projects 2.0.0 does not expose that create_version parameter.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Propagate allow_preview when FoundryMemoryProvider constructs an AIProjectClient and update tests accordingly.

Also finish wiring allow_preview through AzureAIClient-facing surfaces and related docs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants