Python: Add support for Foundry Toolboxes#5346
Merged
Merged
Conversation
Contributor
Author
Python Test Coverage Report •
Python Unit Test Overview
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an experimental Azure AI Foundry Toolboxes integration to the Python Agent Framework, enabling FoundryChatClient to fetch toolboxes and allowing Agent(tools=...) to accept toolbox wrappers by flattening them into tool lists.
Changes:
- Add
FoundryChatClient.get_toolbox()plus toolbox selection/sanitization helpers in the Foundry package. - Extend core
normalize_tools()to flatten toolbox-like wrappers (iterables and objects with a.toolscollection). - Add unit/integration tests, a new Foundry sample, and an ADR documenting the design.
Reviewed changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Updates Python dependency resolution (includes azure-ai-projects constraint and resolved version). |
| python/samples/02-agents/providers/foundry/foundry_chat_client_with_toolbox.py | New sample demonstrating fetching and using toolboxes, combining toolboxes, and selecting tools. |
| python/samples/02-agents/providers/foundry/README.md | Registers the new toolbox sample in the Foundry samples index. |
| python/packages/foundry/tests/test_toolbox.py | New tests for toolbox fetch + selection behavior (includes an opt-in integration test). |
| python/packages/foundry/tests/foundry/test_foundry_chat_client.py | Adds tests ensuring toolbox-returned hosted tool payloads are sanitized for Foundry Responses API. |
| python/packages/foundry/agent_framework_foundry/_tools.py | Implements toolbox fetch helpers, tool selection helpers, and hosted-tool payload sanitization. |
| python/packages/foundry/agent_framework_foundry/_chat_client.py | Adds get_toolbox() and sanitizes prepared tools before Foundry Responses calls. |
| python/packages/foundry/agent_framework_foundry/_agent.py | Mirrors tool sanitization in the Foundry agent path. |
| python/packages/foundry/agent_framework_foundry/init.py | Re-exports toolbox helper types/functions from the Foundry package. |
| python/packages/core/tests/core/test_tools.py | Adds tests covering new normalize_tools() flattening behavior for tool-collection wrappers. |
| python/packages/core/agent_framework/foundry/init.pyi | Re-exports toolbox helper types/functions via the core agent_framework.foundry namespace (stubs). |
| python/packages/core/agent_framework/foundry/init.py | Re-exports toolbox helper types/functions via lazy-import mapping. |
| python/packages/core/agent_framework/_tools.py | Extends normalize_tools() to flatten .tools collections and generic iterables (excluding BaseModel). |
| python/packages/core/agent_framework/_feature_stage.py | Adds ExperimentalFeature.TOOLBOXES. |
| docs/decisions/0024-foundry-toolbox-support.md | New ADR describing the toolbox feature design, API, and testing approach. |
| .gitignore | Ignores additional AI-related local folders (.omc/, .omx/). |
1eb0a5b to
5b24285
Compare
Introduces a Foundry Toolbox integration: FoundryChatClient gains a get_toolbox() helper plus select_toolbox_tools(), normalize_tools in the core package flattens tool-collection wrappers (ToolboxVersionObject and generic iterables, while leaving Pydantic BaseModel instances alone), and the new agent_framework.foundry namespace re-exports the toolbox helpers. Ships with unit tests, a sample, and a design doc. azure-ai-projects is pinned to the public >=2.0.0,<3.0 range and the lockfile resolves from public PyPI. The toolbox test module skips when Toolbox* types are unavailable so CI stays green until the public 2.1.0 SDK lands. OMC tooling directories (.omc/, .omx/) are gitignored.
5b24285 to
6716549
Compare
giles17
approved these changes
Apr 20, 2026
TaoChenOSU
reviewed
Apr 20, 2026
alliscode
reviewed
Apr 20, 2026
Co-authored-by: Ben Thomas <[email protected]>
alliscode
approved these changes
Apr 20, 2026
…ork into py-foundry-toolbox
alliscode
approved these changes
Apr 20, 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
Introduces a Foundry Toolbox integration: FoundryChatClient gains a get_toolbox() helper plus select_toolbox_tools(), normalize_tools in the core package flattens tool-collection wrappers (ToolboxVersionObject and generic iterables, while leaving Pydantic BaseModel instances alone), and the new agent_framework.foundry namespace re-exports the toolbox helpers. Ships with unit tests, a sample, and a design doc.
azure-ai-projects is pinned to the public >=2.0.0,<3.0 range and the lockfile resolves from public PyPI. The toolbox test module skips when Toolbox* types are unavailable so CI stays green until the public 2.1.0 SDK lands.
Description
Contribution Checklist