feat(models): adding python support for Azure foundry models (OpenAI + Anthropic types) - #2512
Open
marosset wants to merge 2 commits into
Open
feat(models): adding python support for Azure foundry models (OpenAI + Anthropic types)#2512marosset wants to merge 2 commits into
marosset wants to merge 2 commits into
Conversation
… anthropic types) Signed-off-by: Mark Rossetti <marosset@microsoft.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Azure AI Foundry provider support to the Python ADK runtime, including OpenAI-compatible chat/embeddings and an Anthropic-format client path, while unifying Azure authentication to support API-key-less Azure Workload Identity via azure-identity.
Changes:
- Introduces shared Azure helpers (
_azure.py) for endpoint/deployment resolution, auth header sanitization, and implicit Workload Identity token providers. - Adds Foundry support to OpenAI chat and embeddings flows, plus Foundry Anthropic client support for Claude-on-Foundry.
- Expands unit test coverage for Azure OpenAI + Foundry auth modes (API key, passthrough, Workload Identity) and wiring.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Adds Azure Identity dependency closure (azure-core, azure-identity, msal, msal-extensions). |
| python/packages/kagent-adk/pyproject.toml | Declares azure-identity as a runtime dependency for Workload Identity support. |
| python/packages/kagent-adk/src/kagent/adk/models/_azure.py | New shared Azure auth/config helpers and client builders for OpenAI + Anthropic surfaces. |
| python/packages/kagent-adk/src/kagent/adk/models/_openai.py | Refactors Azure OpenAI client creation to use unified Azure auth; adds Foundry OpenAI model support. |
| python/packages/kagent-adk/src/kagent/adk/models/_embedding.py | Adds Foundry embeddings provider path and unifies Azure embeddings client construction. |
| python/packages/kagent-adk/src/kagent/adk/models/_anthropic.py | Adds Foundry Anthropic implementation and improves passthrough client caching behavior. |
| python/packages/kagent-adk/src/kagent/adk/models/init.py | Exposes Foundry OpenAI model via public kagent.adk.models exports. |
| python/packages/kagent-adk/src/kagent/adk/types.py | Adds Foundry model config and wires provider dispatch (openai vs anthropic format). |
| python/packages/kagent-adk/tests/unittests/test_embedding.py | Adds Foundry embeddings tests for API key + Workload Identity + passthrough semantics. |
| python/packages/kagent-adk/tests/unittests/models/test_openai.py | Updates patch targets for Azure client construction; adds an import. |
| python/packages/kagent-adk/tests/unittests/models/test_azure.py | New tests validating Azure OpenAI/Foundry auth behavior and header sanitization. |
| python/packages/kagent-adk/tests/unittests/models/test_anthropic.py | Adds Foundry Anthropic tests (format dispatch, auth modes, request headers). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Mark Rossetti <marosset@microsoft.com>
mesutoezdil
reviewed
Aug 24, 2026
| response = await client.embeddings.create( | ||
| model=self.config.model, | ||
| input=texts, | ||
| dimensions=self.TARGET_DIMENSION, |
Contributor
There was a problem hiding this comment.
forces 768 dims here too. same bug as _embed_openai above it, a fix for that one is already open in #2542. providers with other dims will fail here as well.
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.
Part of #2072
#2091 added foundry support for the Go runtime. This PR does the same for python.
As part of this change the AzureOpenAI model auth is moved to use unified Azure auth mechanisms (including API_KEY-less / workload identity support)