Repository navigation
Blob.display_name not preserved when loading binary artifacts from FileArtifactService / GcsArtifactService #5833
Copy link
Copy link
Closed
Labels
request clarification[Status] The maintainer need clarification or more information from the author[Status] The maintainer need clarification or more information from the authorservices[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etcstale[Status] Issues which have been marked inactive since there is no user response[Status] Issues which have been marked inactive since there is no user response
Description
Description
When you save an artifact whose Part.inline_data.display_name is set (e.g., a
user-facing filename), the value is lost on load_artifact for
FileArtifactService and GcsArtifactService. InMemoryArtifactService
preserves it. Same shape as #3157 (.text lost on load), fixed by #5155 for
the text path.
Downstream, the genai → A2A converter at
part_converter.py:218
reads name=part.inline_data.display_name, so FilePart.file.name becomes
None and clients fall back to a generic attachment.<ext> label.
To Reproduce
import asyncio
import tempfile
from google.adk.artifacts import FileArtifactService, InMemoryArtifactService
from google.genai import types
async def main() -> None:
for label, svc in [
("in-memory", InMemoryArtifactService()),
("file", FileArtifactService(base_path=tempfile.mkdtemp())),
]:
await svc.save_artifact(
app_name="app", user_id="u", session_id="s", filename="report.png",
artifact=types.Part(
inline_data=types.Blob(
mime_type="image/png",
data=b"\x89PNG\r\n\x1a\n...",
display_name="report.png",
)
),
)
loaded = await svc.load_artifact(
app_name="app", user_id="u", session_id="s", filename="report.png"
)
print(f"{label:10s} display_name={loaded.inline_data.display_name!r}")
asyncio.run(main())Output:
in-memory display_name='report.png'
file display_name=None
Expected
display_name round-trips through save → load for all artifact services.
Observed
FileArtifactService._load_artifact
(line 494)
rebuilds the Part as
types.Part(inline_data=types.Blob(mime_type=mime_type, data=data)).
display_nameis also not written tometadata.jsonon save, so it's
genuinely lost on disk.GcsArtifactService._load_artifact
(line 271)
usesPart.from_bytes(...), which setsdisplay_name=None.
Environment
google-adk==2.1.0- Python 3.12.13, macOS (also reproduces on linux)
Question
Is this expected behavior, or a bug?
Related
- Artifact stored as text is not retrieved as text #3157 —
.textnot preserved on load. Same shape. - fix: restore .text attribute when loading text artifacts from GCS #5155 — fix for Artifact stored as text is not retrieved as text #3157 (open, approved). The
display_namefix would live
in the same place.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
request clarification[Status] The maintainer need clarification or more information from the author[Status] The maintainer need clarification or more information from the authorservices[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etcstale[Status] Issues which have been marked inactive since there is no user response[Status] Issues which have been marked inactive since there is no user response
Activity
llalitkumarrr commentedon May 25, 2026
Hello @eliasecchig ,
We reproduced this issue and observed the same behavior.
To resolve this, could you please modify line 494 in
FileArtifactService._load_artifacttoreturn types.Part(inline_data=types.Blob(mime_type=mime_type, data=data,display_name=filename))and check if this resolves the issue? Kindly let us know if this works for you.adk-bot commentedon Jun 2, 2026
This issue has been automatically marked as stale because it has not had recent activity for 7 days after a maintainer requested clarification. It will be closed if no further activity occurs within 7 days.
adk-bot commentedon Jun 10, 2026
This has been automatically closed because it has been marked as stale for over 7 days.