Repository navigation
Python: Handle tuples in function tool results - #9679
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits intoNov 2, 2026
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
Conversation
ssccinng
temporarily deployed
to
github-app-auth
October 25, 2026 07:12 — with
GitHub Actions
Inactive
ssccinng
temporarily deployed
to
github-app-auth
October 25, 2026 07:12 — with
GitHub Actions
Inactive
ssccinng
temporarily deployed
to
github-app-auth
October 25, 2026 07:26 — with
GitHub Actions
Inactive
ssccinng
marked this pull request as ready for review
October 25, 2026 07:40
ssccinng
temporarily deployed
to
github-app-auth
October 25, 2026 07:40 — with
GitHub Actions
Inactive
3 tasks done
ssccinng
temporarily deployed
to
github-app-auth
November 1, 2026 10:43 — with
GitHub Actions
Inactive
ssccinng
temporarily deployed
to
github-app-auth
November 1, 2026 15:56 — with
GitHub Actions
Inactive
ssccinng
temporarily deployed
to
github-app-auth
November 1, 2026 15:56 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The tuple-handling changes have no active review issues.
No open issues 🎉
What changed in this PR
This PR addresses #9488 by making Python function tool results handle tuples consistently with lists, preserving rich Content objects and structured Pydantic model values.
Changes:
- Extend result parsing and recursive JSON normalization to support tuples.
- Add regression tests for rich content, mixed values, nested model tuples, and empty tuples, with text type checks before JSON parsing.
| File | Description |
|---|---|
python/packages/core/tests/core/test_types.py |
Add regression coverage for tuple serialization and content preservation. |
python/packages/core/agent_framework/_tools.py |
Handle tuples alongside lists in result parsing and normalization. |
Review effort: Balanced
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Nov 2, 2026
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
Tuple-valued function tool results should retain their structured values, including Content objects and Pydantic models, instead of being converted into string representations.
Description & Review Guide
Validation coverage: the configured test and sample type checks, core source checks, focused tool tests, formatting, lint, and package builds passed on Python 3.11, 3.12, and 3.13 with the pinned dependencies and tools.
Validation: The affected checks fail on the previously published commit and pass after the update. The listed validation commands passed. The same configured checks also passed with Python 3.11.
Related Issue
Fixes #9488.
AI Assistance
AI assistance details: Implementation, regression coverage, and review were AI-assisted.
Contribution Checklist