Skip to content

SaveFilesAsArtifactsPlugin: Unexpected Behavior #3663

Closed

Description

@tdakanalis

I have created an agent that is configured with the SaveFilesAsArtifactsPlugin. I intentionally did not configure the load_artifact tool to ensure that the agent cannot use it to load any artifacts. I also configured the GcsArtifactService.

When I upload a file, I can see in the conversation history that everything appears as expected. For example:

 file_data:                                                                                                                                                                                                                          
  display_name: "The_One_Ring_Core_Rules_2401.pdf"                                                                                                                                                                                    
  file_uri: "gs://gma-bucket/game_master_agent/user/668335cc-e984-42ad-8d2f-81df5ad24778/The_One_Ring_Core_Rules_2401.pdf/0"                                                                                                          
  mime_type: "application/pdf" 

However, after the artifact was processed, I noticed a significant delay in each subsequent response from the LLM. From the logs, I found that the input token usage looked like this:

Token Usage - Input: 97424, Output: 29

I’m not sure how to interpret that, but it seems that the file’s payload ended up in the context.

To Reproduce
Please share a minimal code and data to reproduce your problem.
Steps to reproduce the behavior:

  1. Install 'google-adk and create a basic agent with the SaveFilesAsArtifactsPlugin and the GcsArtifactService configured'
  2. Run 'uv run adk web . --port 8000 --reload_agents --artifact_service_uri "gs://bucket"'
  3. Upload a file and then ask anything else

Expected behavior
The input token usage should be close to the size of your question.

Screenshots

Image Image

Desktop (please complete the following information):

  • OS: Linux
  • Python version: 3.12.7
  • ADK version: 1.19.0

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: gemini-2.5-flash

Activity

  1. added
    tools[Component] This issue is related to tools
    on Nov 22, 2025
  2. added theissue type on Nov 22, 2025
  3. llalitkumarrr commented on Jan 19, 2026

    @llalitkumarrr
    Collaborator

    Hello @tdakanalis ,

    Apologies for the delayed response.

    The token count indicates that your agent might be reading the file saved as an artifact. Please check the metadata to verify where the tokens are being consumed. Also, if possible could you share your code snippet? This would help us understand the implementation better.

  4. adk-bot commented on Jan 27, 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.

  5. added
    stale[Status] Issues which have been marked inactive since there is no user response
    request clarification[Status] The maintainer need clarification or more information from the author
    on Jan 27, 2026
  6. adk-bot commented on Feb 3, 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 authorstale[Status] Issues which have been marked inactive since there is no user responsetools[Component] This issue is related to tools

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions