Python: Allow AzureOpenAIResponsesClient creation with Foundry project endpoint#3814
Merged
eavanvalkenburg merged 7 commits intomainfrom Feb 11, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Extend AzureOpenAIResponseClient for project endpoint support
Python: Allow AzureOpenAIResponsesClient creation with Foundry project endpoint
Feb 10, 2026
eavanvalkenburg
approved these changes
Feb 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for constructing AzureOpenAIResponsesClient via an Azure AI Foundry project (AIProjectClient or project endpoint), aligning it with existing Foundry-enabled client creation patterns elsewhere in the repo.
Changes:
- Added
project_client/project_endpointconstructor parameters toAzureOpenAIResponsesClientand a helper to create an OpenAI client via Foundry projects. - Added unit tests covering initialization via project client/endpoint and basic parameter validation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| python/packages/core/agent_framework/azure/_responses_client.py | Adds Foundry project-based client creation path and wiring into constructor. |
| python/packages/core/tests/azure/test_azure_responses_client.py | Adds tests for new constructor parameters and _create_client_from_project behavior. |
python/packages/core/agent_framework/azure/_responses_client.py
Outdated
Show resolved
Hide resolved
python/packages/core/agent_framework/azure/_responses_client.py
Outdated
Show resolved
Hide resolved
python/packages/core/tests/azure/test_azure_responses_client.py
Outdated
Show resolved
Hide resolved
python/packages/core/agent_framework/azure/_responses_client.py
Outdated
Show resolved
Hide resolved
python/packages/core/agent_framework/azure/_responses_client.py
Outdated
Show resolved
Hide resolved
giles17
approved these changes
Feb 10, 2026
dmytrostruk
approved these changes
Feb 10, 2026
Member
Python Test Coverage Report •
Python Unit Test Overview
|
|||||||||||||||||||||||||||||||||||||||||||||
Contributor
|
@eavanvalkenburg do you want to address any of Copilot's feedback? |
…dpoints Add project_client and project_endpoint parameters to allow creating the client via an Azure AI Foundry project. When provided, the client uses AIProjectClient.get_openai_client() to obtain the OpenAI client. The azure-ai-projects package is imported lazily and only required when using the project endpoint path. Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
Co-authored-by: eavanvalkenburg <13749212+eavanvalkenburg@users.noreply.github.com>
- Add 'type: message' to input items in _prepare_message_for_openai to comply with the Responses API schema requirement - Filter out empty dicts from unsupported content types to prevent sending items with invalid empty type values - Add azure_responses_client_with_foundry.py sample demonstrating AzureOpenAIResponsesClient with project_endpoint - Update README and pyrightconfig.samples.json accordingly
94b8c3c to
3f523ae
Compare
Patch agent_framework.azure._responses_client.AIProjectClient instead of azure.ai.projects.aio.AIProjectClient since the import is at module level.
giles17
approved these changes
Feb 11, 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
AzureOpenAIResponsesClientonly supported direct Azure OpenAI endpoint configuration. Users working with Azure AI Foundry projects had no way to create a responses client from a project endpoint orAIProjectClient, unlikeAzureAIClientwhich already supports this.Description
Adds
project_clientandproject_endpointparameters toAzureOpenAIResponsesClient, enabling client creation via Azure AI Foundry projects.project_client: Pass an existingAIProjectClientdirectlyproject_endpoint+credential: Auto-creates anAIProjectClientfrom the endpointproject_client.get_openai_client()to obtain theAsyncOpenAIclient, which is then passed through the existingasync_clientcode pathazure-ai-projectsis lazily imported — no new hard dependency on the core packageContribution Checklist
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.