Skip to content

Blob.display_name not preserved when loading binary artifacts from FileArtifactService / GcsArtifactService #5833

Closed

Description

@eliasecchig

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_name is also not written to metadata.json on save, so it's
    genuinely lost on disk.
  • GcsArtifactService._load_artifact
    (line 271)
    uses Part.from_bytes(...), which sets display_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

Activity

  1. added
    services[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc
    on May 24, 2026
  2. added theissue type on May 24, 2026
  3. llalitkumarrr commented on May 25, 2026

    @llalitkumarrr
    Collaborator

    Hello @eliasecchig ,

    We reproduced this issue and observed the same behavior.

    To resolve this, could you please modify line 494 in FileArtifactService._load_artifact to return 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.

  4. added
    request clarification[Status] The maintainer need clarification or more information from the author
    on May 25, 2026
  5. adk-bot commented on Jun 2, 2026

    @adk-bot
    Collaborator

    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.

  6. added
    stale[Status] Issues which have been marked inactive since there is no user response
    on Jun 2, 2026
  7. adk-bot commented on Jun 10, 2026

    @adk-bot
    Collaborator

    This has been automatically closed because it has been marked as stale for over 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

request clarification[Status] The maintainer need clarification or more information from the authorservices[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

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions