Skip to content
audiotale.net
Sign in
NewsNews

Gemini API mid-conversation instructions: change rules and tools without losing the 95% cache discount

Google's new system_input step, in public preview for Gemini 4, lets developers change instructions and function tools mid-session without breaking the prompt cache.

audiotale.net team

· 6 min read

Written by AI from the sources linked below. How we use AI

On this page
  1. Key points
  2. What happened
  3. Background
  4. The numbers
  5. What it means
  6. What we don't know yet
  7. What to watch next
  8. Sources

Google has put "mid-conversation instructions" into public preview in the Gemini API. A new system_input step lets a developer change the rules or the available function tools partway through a session without breaking the cached prompt prefix, which on Gemini 4 models is billed at a 95% discount. The preview was announced on 3 December 2026 and runs through the Interactions API on the v1beta endpoint. For anyone building long-running agents on Gemini, it removes a choice between weak instructions and an expensive cache miss.

Key points

  • Mid-conversation instructions entered public preview on 3 December 2026 for Gemini 4 models, through the Interactions API on v1beta (Google's announcement).
  • A system_input step goes before user_input; it can change instructions, add or remove function tools, or both. Only one is allowed per turn, and the newest instruction wins if two conflict.
  • There is no extra fee: system_input tokens are billed at standard input rates, and earlier turns still qualify for cached-token rates.
  • Cache hits on Gemini 4 models are billed at 95% off input, with a 4,096-token minimum, according to Google's caching documentation.
  • Google warns these controls steer the model but do not enforce permissions: authorize every function call on your backend.

What happened

On 3 December 2026 Google's developer blog introduced the feature as a way to change system instructions and tools during a session without invalidating the prompt cache. Before it, the post says, developers had two imperfect options. They could put new rules into a user message, which kept the cache but carried less authority than a system instruction and could be imitated by end users. Or they could rewrite the top-level system instruction or the tools list, which forced the model to reprocess the whole conversation at full price.

The new route works inside the Interactions API, Google's stateful interface where each turn points at the previous one. According to the announcement:

  1. Keep the top-level system_instruction and tools identical on every turn, so the cached prefix stays valid.
  2. Chain the turn with previous_interaction_id as usual.
  3. In the input array, add a system_input step directly before the user_input step. It can hold text, a tool update, or both.
  4. To change tools, use added_tools and removed_tools inside the system_input. When one step has both, removals are processed first, so a tool can be swapped in place.

Each system_input stays in force for the rest of the session. If two instructions conflict, the most recent one wins. Fetching an interaction later shows every system_input step in order, which Google says helps when you audit traces.

Unite.AI's coverage, which says it is AI-generated and editor reviewed and cites only Google's materials, adds details on the limits: malformed requests return HTTP 400 (a standalone system_input, one sent during a function-result loop, or one that removes a function that was not in the original tools list), and instructions accumulate rather than replace, so reversing a rule means telling the model to ignore the earlier one. Previous steps cannot be removed. We could not confirm those error cases in Google's documentation, so treat them as reported.

Background

Prompt caching is the reason this matters. The Interactions API supports implicit caching only: no cache objects to create and no storage fees. Google's caching documentation says it is on by default for Gemini 2.5 and newer models, matches the request prefix from the first token, and breaks at the first token that differs. Entries are kept on a best-effort basis for up to 24 hours in memory, can be evicted early, and Gemini 4 may keep evicted prefixes in encrypted SSD storage for up to 12 hours.

The documentation also lists what silently invalidates a cache: changing thinking_level mid-session, adding, removing or reordering non-deferred tools, putting timestamps or UUIDs in system_instruction, reordering JSON keys, and omitting tools, system_instruction or generation_config on a follow-up that uses previous_interaction_id. The mid-conversation feature is a sanctioned way around the middle two items: the top-level fields never change, and the change travels as a new step at the end.

We covered the model family earlier this week in our look at Gemini 4 Live and its audio pricing, and agent safety in Google's semantic governance policies for intent hijacking. Both are relevant, because this feature gives agents a more flexible control channel and that channel needs guarding.

The numbers

Google's caching documentation gives the discount on cached input tokens by model:

type: bar
title: Discount on cached input tokens, Gemini API
unit: % off input price
source: Google AI Studio caching documentation (Interactions API)
highlight: Gemini 4 models
Gemini 4 models | 95
Gemini 3.8 Flash and 3.6 Flash | 90
Gemini 3.1 Pro Preview (Standard, Priority) | 90
Gemini 3.1 Pro Preview (Flex, Batch) | 80

The minimum input for caching to apply is 4,096 tokens on Gemini 4, Gemini 3.8 Flash, Gemini 3.6 Flash and Gemini 3.1 Pro Preview, and 2,048 on Gemini 2.5. Usage metadata reports usage.total_cached_tokens and usage.total_input_tokens; dividing the first by the second gives your hit rate, so you can check whether a system_input really kept the cache.

A worked example, with our own arithmetic and a made-up size: if a session has a 50,000-token history and you change the rules, a cache miss means those 50,000 tokens are billed at the full input rate again, while a cache hit bills them at 5% of it on Gemini 4. The rates vary by tier, so look up your own price list; the point is the 20-to-1 ratio on the history, not the dollar figure.

What it means

For agent builders, the main gain is that policy can now change with the session. Typical uses Google lists: rules that depend on the stage of a task, reinforcing instructions in very long conversations, enabling or disabling tools according to the user's permissions, reacting to an outage by removing a failing tool, and managing a large tool catalogue by revealing tools as they are needed.

For cost control, long sessions with heavy tool definitions benefit most, since those are the prefixes that used to be thrown away. Anyone running coding agents or customer-service agents with long histories should measure the hit rate before and after.

For security, the caveat is serious. Google says tool updates steer the model but do not replace enforcement: your backend must still authorize every function call, and untrusted or end-user content must stay out of system_input. A system_input has system-level authority, so letting user text flow into one would hand users the very control the feature was meant to separate from them.

Who is left out: it covers only the Interactions API and v1beta. Unite.AI reports it does not cover generateContent, agent interactions, MCP server tools or built-in tools such as Google Search; Google's post confirms MCP tools are not supported yet. Support for Gemini Enterprise Agent Platform is described as "coming soon."

What we don't know yet

  • Exactly which models. Google's announcement says all Gemini 4 models. Unite.AI lists gemini-4-carbon, gemini-4-neon and gemini-4-hydrogen and says others return HTTP 400, while the caching documentation names Neon, Carbon, Hydrogen and Argon. Test your own model before you build on it.
  • General availability. No date. Preview schemas can change, and Unite.AI notes the API surface may change before GA.
  • Real-world savings. Google gives no benchmark of cost or latency; we have none either.
  • How the model weighs a long stack of instructions. Instructions accumulate; there is no published measurement of how reliably the model follows the latest one after many changes.

What to watch next

Watch the Interactions API documentation for the exact system_input schema and any GA announcement, and for MCP tool support. Watch for security write-ups that test whether system_input can be abused in apps that mix user text into it. And watch whether other providers offer something similar.

Sources

Written by

audiotale.net team

The official account of the people who run audiotale.net: announcements, conversation starters and the newsroom's drafts. Posts written with AI say so. Every other account here is a real person.