Repository navigation
Python: fix(core): keep the JSON schema of dict-schema tools in FunctionTool.to_dict() - #9299
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit intoOct 13, 2026
Conversation
Md. Shalah Uddin (shanto462)
temporarily deployed
to
github-app-auth
October 12, 2026 10:37 — with
GitHub Actions
Inactive
Md. Shalah Uddin (shanto462)
temporarily deployed
to
github-app-auth
October 12, 2026 10:37 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused change correctly resolves the reported serialization regression with appropriate coverage.
0 open findings
What changed in this PR
Fixes schema loss when serializing and restoring dict-schema FunctionTool instances.
Changes:
- Always serializes tool parameters unless explicitly excluded.
- Adds regression coverage for executable and declaration-only tools.
| File | Description |
|---|---|
python/packages/core/agent_framework/_tools.py |
Preserves dict-based input schemas during serialization. |
python/packages/core/tests/core/test_tools.py |
Verifies schema-preserving round trips. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Md. Shalah Uddin (shanto462)
marked this pull request as ready for review
October 12, 2026 10:49
Md. Shalah Uddin (shanto462)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 12, 2026 10:49
Md. Shalah Uddin (shanto462)
temporarily deployed
to
github-app-auth
October 12, 2026 11:00 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Oct 13, 2026
Md. Shalah Uddin (shanto462)
temporarily deployed
to
github-app-auth
October 13, 2026 11:08 — with
GitHub Actions
Inactive
Closed
7 tasks
Md. Shalah Uddin (shanto462)
deleted the
fix-function-tool-to-dict-schema
branch
October 19, 2026 09:42
This branch was previously 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.
Motivation & Context
FunctionTool.to_dict()left out the parameter schema of tools declared with a JSON schema dict (MCP server tools, AG-UI client tools, vector store tools and others). Since #3907 these tools keepself.input_model = None, andto_dict()skippedinput_modelwhenever it was empty. Afterfrom_dict()the tool declared different or empty parameters.Description & Review Guide
to_dict()now writesinput_modelfromparameters()for every tool, unless the caller excludesinput_model. A regression test, with and without a function, checks thatto_dict()contains the schema and thatfrom_dict()restores the sameparameters().exclude={"input_model"}still omits the key.not self.input_modelcondition instead of adding a_schema_suppliedcheck.input_modelisNoneonly for dict-schema tools; every other tool gets a Pydantic model (passed in, inferred from the function, or an empty generated model). So the condition had no other effect.Related Issue
Fixes #9296
No other open PR covers this issue.
AI Assistance
AI assistance details: issue analysis, implementation, tests, and this PR description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.