Gemini API: change agent rules without losing the cache
Google's Gemini API now accepts mid-session system instructions and tool changes in preview, keeping earlier turns in the prompt cache.
Agents on the Gemini API can now pick up a new rule, or gain and lose tools, partway through a session while earlier turns stay in the prompt cache. Google announced the preview on December 3, 2026. It adds a system_input step that sits directly before user_input in the Interactions API. Google says the step carries the same authority as the top-level system instruction and takes precedence over user messages. Until now builders had two workarounds. A user message kept the cache but, Google says, carried less weight and could be imitated. A rewritten system instruction carried full weight but made the model reprocess the whole history.
The mechanics are strict. You pass previous_interaction_id, keep system_instruction and the top-level tools list identical every turn, and change tools with added_tools and removed_tools inside the step. You can send one step per turn. Only function tools can be changed, not MCP server tools. There is no separate fee, and the step's tokens bill at standard input rates. Google says the feature covers all Gemini 4 models through the v1beta endpoint.
Sulat AI & Tech News tested it on Neon, Carbon and Hydrogen, the three models it says the docs list. On a conversation of about 7,700 tokens, rewriting the system instruction left zero cached tokens in all nine runs, while a system_input step kept about 5,500. Removed tools went unused and added ones were callable at once. The tester could not reproduce the weight claim, though. A plain user message held a deployment freeze against a faked "[SYSTEM]" lift just as well. That was one scenario, in sessions of four turns or fewer, with no cost or latency measured.
On cost, I10X News calculates roughly $0.57 saved per rule change on a 200,000-token Neon session. That figure comes from list prices and assumes a full cache hit, and the outlet did not test the feature. It also notes that Neon's implicit caching makes hits likely but not guaranteed.
Our reading: this makes granting and withdrawing tools per step cheap enough for everyday agent design. Google's own post adds the limit: these steps steer the model and are not a security boundary, so your backend must still authorize every function call. Google's announcement gives no latency figures, and the Sulat test counted tokens, not speed.
Try it: in an agent where you rewrite the system instruction mid-session, send the same change as a system_input step instead. Then compare cached tokens in the API's usage field for both versions. Keep the authorization check on the tool endpoint either way.