Python: Support stable + preview Azure AI Search (Foundry IQ) API versions#6603
Open
farzad528 wants to merge 1 commit into
Open
Python: Support stable + preview Azure AI Search (Foundry IQ) API versions#6603farzad528 wants to merge 1 commit into
farzad528 wants to merge 1 commit into
Conversation
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Python Azure AI Search integration to work across both the stable (GA) and preview azure-search-documents 12.x channels by adding explicit api_version support, gating preview-only agentic features, and adjusting request/response model compatibility for the 12.x SDK surface.
Changes:
- Bumped
agent-framework-azure-ai-searchto depend onazure-search-documents>=12.0.0,<13and added exportedSTABLE_API_VERSION/PREVIEW_API_VERSIONconstants (also re-exported viaagent_framework.azure). - Threaded an optional
api_versionthrough Search/Index/KB clients and added_preview_features_active()gating to prevent sending preview-only fields on GA wires (with actionable errors). - Updated tests and samples/docs for the new API version behavior and 12.x compatibility changes (e.g., vector query
k_nearest_neighbors, defensive reference parsing).
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Updates the lock to agent-framework-azure-ai-search 1.0.0b260618 and resolves azure-search-documents to 12.0.0 with a widened <13 bound. |
| python/samples/02-agents/context_providers/azure_ai_search/search_context_semantic.py | Documents optional api-version pinning for semantic mode usage. |
| python/samples/02-agents/context_providers/azure_ai_search/search_context_agentic.py | Updates sample args for the provider (uses model=) and adds api-version pinning guidance for agentic mode. |
| python/samples/02-agents/context_providers/azure_ai_search/README.md | Adds stable vs preview API version guidance and documents preview-only agentic options. |
| python/packages/core/agent_framework/azure/init.py | Re-exports STABLE_API_VERSION / PREVIEW_API_VERSION lazily from the optional azure-ai-search connector package. |
| python/packages/azure-ai-search/tests/test_aisearch_context_provider.py | Adds unit coverage for api-version forwarding and stable/preview feature gating; adds stubs to exercise preview paths on stable installs. |
| python/packages/azure-ai-search/README.md | Documents stable vs preview channel behavior and the api-version pinning approach. |
| python/packages/azure-ai-search/pyproject.toml | Bumps package version and updates dependency range to azure-search-documents>=12.0.0,<13. |
| python/packages/azure-ai-search/AGENTS.md | Documents the new constants and explains preview feature gating behavior. |
| python/packages/azure-ai-search/agent_framework_azure_ai_search/_context_provider.py | Implements api-version plumbing, preview-feature gating, 12.x vector query arg updates, and more defensive reference parsing; exports constants. |
| python/packages/azure-ai-search/agent_framework_azure_ai_search/init.py | Re-exports the api-version constants from the package root. |
| python/CHANGELOG.md | Notes the Azure AI Search integration update in Unreleased. |
Comment on lines
+104
to
+107
| # Optional: pin the data-plane api-version. Defaults to the installed SDK's | ||
| # default (stable -> 2026-04-01, preview -> 2026-05-01-preview). Output modes | ||
| # and low/medium reasoning effort below require the preview SDK + api_version. | ||
| # api_version=PREVIEW_API_VERSION, |
moonbox3
approved these changes
Jun 18, 2026
moonbox3
left a comment
Contributor
There was a problem hiding this comment.
LGTM, just need to fix the CI/CD checks that are failing
9c28a3d to
5584e97
Compare
…sions Update agent-framework-azure-ai-search to work across the stable/GA azure-search-documents SDK (12.0.0, api-version 2026-04-01) and the preview SDK (12.1.0b1, api-version 2026-05-01-preview) for both semantic and agentic modes. - Bump the dependency to azure-search-documents>=12.0.0,<13 and the package to 1.0.0b260618. - Add an api_version parameter (threaded into SearchClient, SearchIndexClient, and KnowledgeBaseRetrievalClient) plus STABLE_API_VERSION/PREVIEW_API_VERSION constants, re-exported from agent_framework.azure. - Auto-detect preview-only agentic features (output mode, low/medium reasoning effort) via _preview_features_active(), which requires both the preview SDK and a preview api-version; defaults (extractive + minimal) work on both channels and preview-only options raise an actionable error otherwise. - Make knowledge-base imports SDK-version resilient and fix the 12.x surface (k -> k_nearest_neighbors, defensive additional_properties). - Update tests (pass on both SDKs), docs, samples, CHANGELOG, and uv.lock. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5584e97 to
87ad73a
Compare
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 & Context
The
agent-framework-azure-ai-searchpackage pinnedazure-search-documents>=11.7.0b2,<11.7.0b3and hard-imported Knowledge Base symbols from a single preview SDK layout. Azure AI Search / Foundry IQ has since shipped a stable/GA data-plane API (2026-04-01, served byazure-search-documents 12.0.0) alongside the latest preview API (2026-05-01-preview, served by12.1.0b1), and the two SDK layouts diverge: the preview adds agentic output modes and low/medium reasoning effort on the knowledge base definition and retrieve request, which the stable SDK/wire does not expose. On the current pin the package cannot use the stable channel, and on the 12.x SDKs it would fail to import or send fields the GA wire rejects.This change lets the package work across both channels — stable (released) by default and preview opt-in — for both semantic and agentic modes, following the
azure-search-documentsstable/preview convention and the Agent Framework package guidance. Context: https://devblogs.microsoft.com/foundry/foundry-iq-agent-framework-integration/Description & Review Guide
What are the major changes?
azure-search-documents>=12.0.0,<13so a normal install resolves the stable SDK (12.0.0, api-version2026-04-01) and--preresolves the preview SDK (12.1.0b1, api-version2026-05-01-preview). Bump the package to1.0.0b260618.api_versionparameter toAzureAISearchContextProvider, threaded intoSearchClient,SearchIndexClient, andKnowledgeBaseRetrievalClient, plus exportedSTABLE_API_VERSION/PREVIEW_API_VERSIONconstants (also re-exported fromagent_framework.azure).None(default) defers to the installed SDK's default._preview_features_active(), which requires both the preview SDK and a preview api-version. Defaults (extractive output + minimal effort) work on both channels; a stable api-version never sends preview-only fields, and explicitly requestinganswer_synthesis/low/mediumwithout preview support raises an actionable error.VectorizableTextQuery/VectorizedQueryusek_nearest_neighbors(wask), and reference parsing readsadditional_propertiesdefensively.model_deployment_namesample argument),CHANGELOG.md, anduv.lock.What is the impact of these changes?
--pre. No breakage for existing default usage (extractive + minimal). Preview-only agentic options surface a clear error instead of a server-side400when used on the stable wire. Unit tests pass on both12.0.0and12.1.0b1; the flow was also validated live against a preview knowledge base across default / stable-pinned / preview-pinned api-versions.What do you want reviewers to focus on?
_preview_features_active()(SDK capability AND preview api-version) and the resulting error/branching in__init__validation,_ensure_knowledge_base, and_agentic_search.>=12.0.0,<13and the stable-by-default / preview-opt-in behavior.Related Issue
Fixes #6604
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.