Python: (foundry): stop emitting [TOOLBOXES] warning for every FoundryChatClient call#5440
Conversation
…S warning sanitize_foundry_response_tool runs on every tool passed to the Foundry Responses API, so its @experimental(TOOLBOXES) decorator was emitting a [TOOLBOXES] ExperimentalWarning for any FoundryChatClient call, even when no toolbox was involved. The function isn't in __all__ and has no external callers. Rename to _sanitize_foundry_response_tool and drop the decorator; the actual toolbox-facing public helpers remain gated.
There was a problem hiding this comment.
Pull request overview
This PR removes an experimental TOOLBOXES warning that was being emitted on every FoundryChatClient call by making the Foundry tool payload sanitizer explicitly internal and no longer @experimental.
Changes:
- Renamed
sanitize_foundry_response_toolto_sanitize_foundry_response_tool. - Removed the
@experimental(feature_id=ExperimentalFeature.TOOLBOXES)decorator from the sanitizer. - Updated
FoundryChatClientand Foundry agent tool-preparation paths to call the renamed sanitizer.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/packages/foundry/agent_framework_foundry/_tools.py | Makes the tool payload sanitizer private and removes the experimental decorator to avoid per-call TOOLBOXES warnings. |
| python/packages/foundry/agent_framework_foundry/_chat_client.py | Switches tool preparation to use _sanitize_foundry_response_tool. |
| python/packages/foundry/agent_framework_foundry/_agent.py | Switches agent tool preparation to use _sanitize_foundry_response_tool. |
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Automated Code Review
Reviewers: 4 | Confidence: 92%
✓ Correctness
This PR renames
sanitize_foundry_response_toolto_sanitize_foundry_response_tool(adding underscore prefix to mark it as private) and removes the@experimentaldecorator from it. All internal import sites and call sites in_agent.pyand_chat_client.pyare updated consistently. The function was never exported from any__init__.pyand no tests reference it by name. TheExperimentalFeature/experimentalimports in_tools.pyare still needed by other functions. No correctness issues found.
✓ Security Reliability
This PR renames
sanitize_foundry_response_toolto_sanitize_foundry_response_tool(private convention) and removes the@experimentaldecorator. The function is only used internally within two files (_agent.pyand_chat_client.py), is not exported from__init__.py, and has no test references under its old name. The rename is consistent across all call sites and imports. No security or reliability concerns.
✓ Test Coverage
This PR renames
sanitize_foundry_response_toolto_sanitize_foundry_response_tool(making it private) and removes its@experimentaldecorator. The rename is consistent across all three files. The function's behavior is tested indirectly throughFoundryChatClient._prepare_tools_for_openaitests intest_foundry_chat_client.py(10+ test cases covering stripping fields, container injection, validation errors, etc.). However,FoundryAgent._prepare_tools_for_openaihas zero test coverage for the same sanitization logic — it could silently break without any test catching it. The function was never in__all__, so no public API break.
✗ Design Approach
The sanitization behavior itself still looks sound, but the chosen fix changes the toolbox API surface in a way that is broader than the problem being solved. By renaming
sanitize_foundry_response_toolto a private helper and removing its@experimentalmarker, this PR turns a previously staged callable into an internal-only symbol instead of separating internal use from public compatibility. That is a design regression because users who sanitize toolbox-fetched tools directly lose the only supported entry point for that behavior, even though the underlying need remains.
Suggestions
FoundryAgent._prepare_tools_for_openai(line 324 of_agent.py) also calls_sanitize_foundry_response_toolbut has no test coverage, unlikeFoundryChatClientwhich has 10+ tests intest_foundry_chat_client.py(lines 620–770). Consider adding at least one test intest_foundry_agent.pyto verifyFoundryAgentapplies the same sanitization.
Automated review by moonbox3's agents
Previous commit incorrectly renamed the [1.1.1] header to [1.2.0], which wiped the historical 1.1.1 entries and wrongly attributed them to 1.2.0. This restores [1.1.1] to its origin/main content and adds a new [1.2.0] section above containing only the commits in python-1.1.1..HEAD: - microsoft#4238 functional workflow API - microsoft#5142 GitHub Copilot OpenTelemetry - microsoft#2403 A2A bridge support - microsoft#5070 oauth_consent_request events in Foundry clients - microsoft#5447 FoundryAgent hosted agent sessions - microsoft#5459 hosting server dependency upgrade + types - microsoft#5389 AG-UI reasoning/multimodal parsing fix - microsoft#5440 stop [TOOLBOXES] warning spam - microsoft#5455 user agent prefix fix Also corrects the [1.2.0] compare base to python-1.1.1 (not 1.1.0) and adds the missing [1.1.1] reference link.
* Bump Python package versions for 1.2.0 release Released tier bumps 1.1.1 -> 1.2.0 (core, openai, foundry, root) to reflect additive public APIs landed since 1.1.0: functional workflow API (#4238) and FunctionTool SKIP_PARSING sentinel (#5424). All beta packages stamped 1.0.0b260424, alpha packages 1.0.0a260424. All 26 non-core agent-framework-core floors raised to >=1.2.0,<2. CHANGELOG consolidates the never-tagged 1.1.1 entries with the post-merge additions into [1.2.0]. * Update CHANGELOG footer links for 1.2.0 Advance [Unreleased] comparison base from python-1.1.0 to python-1.2.0 and add a [1.2.0] reference link comparing python-1.1.0...python-1.2.0 so the heading links resolve correctly. * Fix CHANGELOG: restore [1.1.1] section and add proper [1.2.0] Previous commit incorrectly renamed the [1.1.1] header to [1.2.0], which wiped the historical 1.1.1 entries and wrongly attributed them to 1.2.0. This restores [1.1.1] to its origin/main content and adds a new [1.2.0] section above containing only the commits in python-1.1.1..HEAD: - #4238 functional workflow API - #5142 GitHub Copilot OpenTelemetry - #2403 A2A bridge support - #5070 oauth_consent_request events in Foundry clients - #5447 FoundryAgent hosted agent sessions - #5459 hosting server dependency upgrade + types - #5389 AG-UI reasoning/multimodal parsing fix - #5440 stop [TOOLBOXES] warning spam - #5455 user agent prefix fix Also corrects the [1.2.0] compare base to python-1.1.1 (not 1.1.0) and adds the missing [1.1.1] reference link.
Motivation and Context
FoundryChatClientemits a[TOOLBOXES] sanitize_foundry_response_tool is experimental ...warning on every call, even when the caller never touches a toolbox.sanitize_foundry_response_toolruns unconditionally inside_prepare_tools_for_openaifor every tool payload, so its@experimental(TOOLBOXES)decorator fires for plain function tools too — misleading users into thinking they're using an experimental feature when they aren't.Description
Rename
sanitize_foundry_response_tool→_sanitize_foundry_response_tooland drop the@experimentaldecorator. It's a pure internal Responses-API payload sanitizer — not in__all__, no external callers — so the toolbox feature gate doesn't belong on it. The genuinely toolbox-facing public helpers (fetch_toolbox,get_toolbox_tool_name,get_toolbox_tool_type,select_toolbox_tools) stay@experimental(TOOLBOXES).Contribution Checklist