Skip to content

SaveFilesAsArtifactsPlugin: Unexpected Behavior #3663

@tdakanalis

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

Metadata

Metadata

Assignees

Labels

tools[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