fix(tools): persist strict flag in FunctionTool component config - #8292
Open
JingHao-Leon wants to merge 1 commit into
Open
JingHao-Leon wants to merge 1 commit into
JingHao-Leon wants to merge 1 commit into
Conversation
FunctionTool.dump_component omitted the strict flag from FunctionToolConfig, so a tool created with strict=True came back as strict=False after a dump_component/load_component round trip. For tools used with structured output (output_content_type), the docs require strict=True; silently losing it makes the provider stop enforcing the JSON schema with no error anywhere. Add strict to the config model, _to_config, and _from_config, and cover both the round-trip and the default in tests. Fixes microsoft#8283
Author
|
@microsoft-github-policy-service agree |
This was referenced Sep 28, 2026
This branch has not been deployed
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.
Description
FunctionTool.dump_component()omitted thestrictflag fromFunctionToolConfig, so a tool created withstrict=Truecame back asstrict=Falseafter adump_component/load_componentround trip — confirmed onautogen-core0.7.5 from PyPI as well as main.This matters beyond the flag: for tools used with structured output (
output_content_type), the docs requirestrict=True; silently losing it makes the provider stop enforcing the JSON schema, degrading structured-output calls to best-effort parsing with no error anywhere. Anything that persists component configs (serialized teams, worker setups) resets everystrict=Truetool this way.Changes
FunctionToolConfig: addstrict: bool = False_to_config: persistself._strict_from_config: passconfig.strictthrough to the constructorstrict=True; default remainsFalseRelated issue
Fixes #8283
Verification
Note:
test_function_toolin the same file fails on cleanmainwithout this change (pre-existing, unrelated — an async-def collection issue under the current pytest), so CI baseline should show the same single failure.