Media in a tool result (FunctionResponse.parts) is dropped when another agent's turn is relayed as context
Les mainteneurs répondent en général sous 3 jours
Évaluation
Cette issue n'a pas encore été évaluée.
Description
🔴 Required Information
Describe the Bug:
When a tool returns media (an image, audio or a document as a types.Part), ADK moves it into FunctionResponse.parts and leaves the JSON response without it (_extract_multimodal_parts in flows/llm_flows/tools/_caller.py). ComputerUseTool screenshots go through the same path.
When another agent later reads that event as context, _present_other_agent_message (flows/llm_flows/context/_fencing.py) renders the tool result as text with str(part.function_response.response) and never looks at function_response.parts. The media is lost. If the tool returned only media, the next agent sees an empty result:
[analyst_agent] `render_chart` tool returned result:
<<<BEGIN_QUOTED_AGENT_CONTENT>>>
{}
<<<END_QUOTED_AGENT_CONTENT>>>
So the receiving agent is told the tool returned nothing. The agent that called the tool still has the media in its own history. The same function already passes media through on its own part type for ordinary inline_data and file_data parts. Tool-result media is the case it misses.
Steps to Reproduce:
pip install google-adk- Run this script. It needs no API key and uses the same functions ADK uses to build the tool result and relay it:
from google.genai import types
from google.adk.events.event import Event
from google.adk.flows.llm_flows.context._fencing import _present_other_agent_message
from google.adk.flows.llm_flows.tools._caller import _build_function_response_content
from google.adk.tools.function_tool import FunctionTool
def render_chart(metric: str):
"""Renders a chart for a metric."""
return types.Part.from_bytes(data=b"\x89PNG fake chart", mime_type="image/png")
tool = FunctionTool(render_chart)
content = _build_function_response_content(tool, render_chart("sales"), "call-1")
fr = content.parts[0].function_response
print("caller's history:", fr.response, "| media parts:", len(fr.parts or []))
relayed = _present_other_agent_message(Event(author="analyst_agent", content=content))
print("next agent sees:", relayed.content.parts[-1].text)
print("media reaches next agent:", any(p.inline_data or p.file_data for p in relayed.content.parts))
In a real app this happens in any multi-agent setup where one agent calls a media-returning tool and another agent runs later in the same session, for example after transfer_to_agent or in a sequential pipeline.
Expected Behavior:
The relayed context includes the tool's media as its own parts, next to the fenced text of the JSON result, the same way media in ordinary message parts is relayed.
Observed Behavior:
caller's history: {} | media parts: 1
next agent sees: [analyst_agent] `render_chart` tool returned result:
<<<BEGIN_QUOTED_AGENT_CONTENT>>>
{}
<<<END_QUOTED_AGENT_CONTENT>>>
media reaches next agent: False
Environment Details:
- ADK Library Version: 2.14.1 (main @ c74df83c0)
- Desktop OS: Windows 11 (the bug isn't OS-specific)
- Python Version: 3.11
Model Information:
- Are you using LiteLLM: No
- Which model is being used: N/A (the context is built before any model call). This affects any model that receives the relayed history.
🟡 Optional Information
Regression:
Not that I know of. Related to #729, which reported image parts being lost at the AgentTool boundary.
Proposed fix:
In the function_response branch of _present_other_agent_message, after the fenced text part, add each entry of function_response.parts as its own part: inline_data becomes a types.Part(inline_data=...) and file_data becomes a types.Part(file_data=...). Run them through _elide_relayed_part_markers, as the existing media branch does, so text/* blobs can't forge quote markers. Add regression tests for a media-only result, a mixed JSON-and-media result, and a text/* blob containing a marker. I'm happy to send a PR.
- Langage dominant
- Python
- Étoiles
- 22.3k
- Forks
- 4.4k
- Merge moyen
- 1 j 2 h
- PR mergées (30 j)
- 6
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de google/adk-python
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
google/adk-python#8360 ·
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
google/adk-python#8359 ·
Les mainteneurs répondent en général sous 3 jours
-
Can pin to litellm version be changed?Peut-être pris @llalitkumarrr l’a pris il y a 10 jours. Ouvertemodels
Difficulté 1/5 Moins d'une heure Accessibilité débutants 65/100
google/adk-python#8129 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
-
OpenAPI tools ignore operation- and path-level server overridesPeut-être pris @sanketpatil06 l’a pris il y a 14 jours. Ouvertetools
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
google/adk-python#8064 · 4 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
-
Two docstrings in openapi_tool document parameters the signatures do not acceptPeut-être pris @surajksharma07 l’a pris il y a 17 jours. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
google/adk-python#8024 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de google/adk-python
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
vllm-project/vllm#70030 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
TigreGotico/tugaphone#408 ·
Les mainteneurs répondent en général sous 1 jour
-
needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
gke-labs/kube-agents#7308 ·
Les mainteneurs répondent en général sous 1 jour
-
t: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 3 jours
-
chore
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
lugassawan/swe-workbench#841 ·