
Why it mattersA long agent session with changing rules used to force the cache out and restart billing from zero. Preserving the cache is the whole saving.
An agent that has to swap a tool mid-run used to pay the full price twice. Google added mid-conversation system instructions and tool updates to the Gemini API today. The feature lets a developer update the system prompt or the available tools inside one conversation. The earlier turns stay in the cache.
The Gemini team released the feature in public preview. It runs on every Gemini 4 model through the Interactions API on the v1beta endpoint. Support for the Gemini Enterprise Agent Platform is listed as coming soon.
What was wrong before
A developer who wanted to change an agent's rules mid-session had two choices. The first was to put the new rule in a user message. A user message does not carry the authority of a system instruction, so the model may ignore it. The second was to rewrite the whole system prompt. That invalidated the prompt cache. Every earlier turn had to be reprocessed and billed at full input rates.
That mattered most for long sessions. A customer support chat hands off to a new agent persona. A coding agent enters a sandbox step with a tighter rule set. A browser agent adds a shopping tool half way through a task. Each of these has to change the system state after the session has started. The cache reset was the cost.
What the new feature does
A request now carries a system_input step. The step can contain text, tool updates, or both. Google writes that the step keeps "the prompt cache intact". Tool changes use added_tools and removed_tools. A developer can turn a function off for a step and on again later.
Google says the earlier turns remain eligible for cached-token rates when the rules or tools change. The feature itself costs nothing extra. Tokens inside a system_input step are billed at the standard input rate for the model being called.
Where this changes a working app
Three places. First, a session-long agent that runs with a lower permission set at the start and a higher one later. The handover now costs the new tokens only. Second, an evaluation harness that swaps the system prompt between test cases on a shared conversation. The cache stays. Third, a product with a long user session where the available tools change with the user's plan.
A team that has already given up on prompt caching for long agent sessions should read the change. The reason for giving up was the cache resetting at every rule change. That reason is gone for Gemini 4.
A limit worth checking before counting the saving
Google's post is the announcement. It states the feature works and names the pricing. It does not publish a worked example of cache retention under a mid-session change. A team that cares about the number should run a short before and after test on its own agent. Time one session that rewrites the full system prompt. Time the same session that uses system_input instead. The difference is what Google is offering.
Source
Introducing mid-conversation instructions in the Gemini API, by the Google Gemini team.
This item was written by an AI system from the linked source. Reveneau is responsible for what it publishes.
Get AI News in your inbox
New developer tools, model and agent releases, and how teams are actually using them to release software. Short, and only when there is something worth reading.
