Repository navigation
[fix] Nest Gemini tool-result media in function responses - #9647
Merged
sannya-singal merged 7 commits intoAug 26, 2026
Merged
Conversation
green3sf
marked this pull request as ready for review
August 20, 2026 18:49
Contributor
|
| Filename | Overview |
|---|---|
| libs/agno/agno/models/google/gemini.py | Adds capability-gated conversion of supported tool-result media into nested function-response parts while retaining sibling fallbacks. |
| libs/agno/tests/unit/models/google/test_gemini.py | Adds focused coverage for nested inline media, legacy and unsupported-media fallbacks, and filtered Vertex URI media. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Tool-result message] --> B[Format attached media]
B --> C{Gemini 3 or later?}
C -- No --> F[Emit media as sibling parts]
C -- Yes --> D{Supported MIME type?}
D -- No --> F
D -- Yes --> E{Inline data or Vertex URI?}
E -- Supported --> G[Nest media in FunctionResponse.parts]
E -- Unsupported --> F
G --> H[Emit tool message]
F --> H
Reviews (1): Last reviewed commit: "fix: guard Gemini multimodal response co..." | Re-trigger Greptile
This was referenced Aug 26, 2026
sannya-singal
approved these changes
Aug 26, 2026
Merged
ysolanky
added a commit
that referenced
this pull request
Aug 26, 2026
# Changelog ## **Improvements** - **Faster agent runs with many tools**: Tool schemas are now derived once and cached across runs, cutting per-run overhead for agents that carry large toolkits. (#9771) - **Faster long conversations**: Session history is loaded incrementally per turn, so response time stays flat as a conversation grows instead of scaling with its length. (#9775) - **PubMed request timeout**: `PubmedTools` now accepts a `timeout` and passes it to both NCBI E-utilities requests, so a stalled PubMed response cannot hold a tool call indefinitely. (#9463) ## **Bug Fixes** - **Strict-mode tool schemas without `properties`**: `Function.process_schema_for_strict` no longer raises `KeyError` on schemas that omit `properties` (for example MCP server schemas registered verbatim). (#9578, fixes #9409) - **Gemini tool-result media**: Images and document blobs returned from tools are now nested inside `FunctionResponse.parts` for Gemini 3 and later models instead of being emitted as sibling `inline_data` parts; legacy models keep the previous representation. URI-backed response media on Vertex AI is only sent when the MIME type is supported. (#9647) - **Location lookup on core-only installs**: `agno.utils.location` used the undeclared `requests` package, so `add_location_to_context=True` raised `ModuleNotFoundError` without extras installed. It now uses `httpx`. (#9793, fixes #9772) - **`ScheduleManager` cleanup**: `close()` tolerates a partially constructed manager (for example after a failed `deepcopy`), so garbage collection no longer raises `AttributeError` on a missing `_pool`. (#9792) ## **Cookbooks** - Added a deterministic side-effect approval flow example. (#9790) - Added DeepKeep AI Firewall guardrails example. (#9784) - Documented AgentOS team run states. (#9768) - Added a Peer Cash MCP agent example. (#9562) - Fixed stale cookbook paths left over from the directory renumber and in the MCP examples. (#9789, #9783)
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.
Summary
FunctionResponse.partsinstead of mixingfunction_responseandinline_dataas sibling parts.(If applicable, issue number: #9630)
Fixes #9630
Type of change
Checklist
./scripts/format.shand./scripts/validate.sh)Duplicate and AI-Generated PR Check
Additional Notes
Codex assisted with implementation and test preparation. I reviewed the final diff against the latest
main, verified the generated payload shape against the official multimodal function-response contract, and ran the following checks:pytest -q libs/agno/tests/unit/models/google: 185 passed withgoogle-genai2.19.0google-genai1.52.0 and 2.19.0: passedruff format --checkandruff checkon the changed files: passed./scripts/format.sh: passed./scripts/validate.sh: Ruff and cookbook checks passed. Mypy still reports existing diagnostics in the Google SDK compatibility/Interactions code and pre-existing Gemini lines, plus missingtyperin the minimal test environment; it reported no diagnostics in the new compatibility guard or tests.git diff --check: passed