support for context caching
root_agent = LlmAgent(
name="question_answer_agent",
model="gemini-2.0-flash-001",
description=(
"QA Agent Answers Questions about cached content. Its system instructions have already been cached."
),
generate_content_config=types.GenerateContentConfig(
cached_content=cache.name
)
)
google.genai.errors.ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Tool config, tools and system instruction should not be set in therequest when using cached content.', 'status': 'INVALID_ARGUMENT
:(
@jheym could you share a full example to reproduce the issue?
@hangfei This is a feature request. I'm hoping to be able to use context caching out of the box, in a similar manner as the sample code above.
The method shown in the OP isn't supposed to work (I assume), it's just something I wanted to try out. If this is possible another way, please do let me know!
content caching can not be used in agents currently due to how we format the request. This is in our backlog to tackle.
Any ETA for this feature?
I have been looking for this too. Hope it will be available soon.
Also would love this feature for very long system instructions. Glad to see it on the feature roadmap. Is there a plan to add any expected dates to the feature tickets?
I have been looking for this feature as well.
+1
+1
+1
+1
Hi @hangfei @boyangsvl I realize we’re requesting quite a bit, but would it be possible to add a flag to explicitly cache long system prompts? It could help reduce costs on agents, and might be quite beneficial.
+1
+1
+1
+1
+1
+1
+1
+1