Guide · AiTopMix

Gemini API mid-conversation instructions explained: change the rules without losing the cache

6 min read · Facts checked 5 December 2026
Gemini API mid-conversation instructions explained: change the rules without losing the cache
Gemini API mid-conversation instructions explained: change the rules without losing the cache
AI-generated illustration

Long-running AI agents have had an awkward choice. Mid-conversation, when the rules change — a deployment freeze, a revoked permission, a new instruction from a human — the application either stuffed the new rule into a user message, where it carried less weight and could be imitated, or rewrote the system instruction and tools, which invalidated the prompt cache and made the model reprocess the whole conversation. On 3 December 2026, Google gave Gemini API developers a third option: a system_input step, in public preview through the Interactions API, that updates instructions and tools at a turn boundary while earlier turns stay cached.

What changed on 3 December

Google’s announcement, by Gemini API product managers Trey Nguyen and Daniel Kyme, describes the new step plainly: send a system_input step at any turn with system instruction or tool changes. According to Google, that step carries the same authority as the top-level system instruction and takes precedence over user messages, while earlier turns stay cached. The Gemini API release notes carry a matching entry the same day, headed “Mid-conversation system instructions (Public Preview)”.

The feature arrives through the Interactions API on the v1beta endpoint. It is a preview, which means the API surface may change before general availability. Production code should treat it as provisional: keep it behind a reversible setting, and do not build an irreversible workflow on preview behaviour.

How it works

The mechanics are append-only, and that is the whole trick. The application chains the new turn with previous_interaction_id, so the server retrieves the stored conversation history instead of requiring the application to resend it. One system_input step goes directly before the user_input step in the input array, and the top-level system_instruction stays unchanged across turns, so the cached prefix stays valid.

Each update becomes a separate history step rather than a replacement. The original system instruction and every earlier system_input step remain in context. Rules on different topics remain in effect together; when a newer instruction conflicts with an earlier one, Google says the model favours the most recent. Reversing a rule therefore takes explicit work: the earlier step cannot be removed, so the application must state what changed and tell the model to ignore the earlier instruction.

Changing tools mid-session

Tool declarations sit at the start of the prompt, so changing the top-level tools list between turns breaks the cache in the same way rewriting the instruction does. The preview’s answer is to keep sending the same top-level list every turn and to change the active set through added_tools and removed_tools on the system_input step. That includes a rule that will catch people out: after disabling a function, you must keep sending its original definition in the top-level tool list. Removing it there causes later turns to fail with an HTTP 400, because the API validates against the stored history. Conversely, functions introduced through added_tools should stay out of the original array.

Only custom function tools are supported. MCP servers and built-in tools such as Google Search and code execution are excluded, and the feature does not apply to generateContent calls or managed agent interactions. Check the request route before treating this as an automatic upgrade: if the application does not use the Interactions API, nothing changes.

Which models, and the rules that return 400

The release notes name three models: Gemini 4 Carbon, Gemini 4 Neon and Gemini 4 Hydrogen, on v1beta. Other models return an HTTP 400 for the new step. The placement rules are strict and also return 400 when broken: at most one system_input per turn, directly before a user_input step; never on its own, and never during a function-calling loop. Its content is text only, and text is required unless the step adds or removes tools.

There is no separate feature fee. New update tokens cost the model’s standard input rate, while earlier turns remain eligible for cached-token rates. That eligibility is a property of the request pattern — unchanged top-level instruction and tools list, update appended at the turn boundary — not a guarantee of a cache hit or a saving on any particular turn.

A worked example: the deployment freeze

Google’s worked example makes the intended sequence concrete. An assistant is troubleshooting a latency spike when a new production deployment freeze arrives. Mid-session, the application sends a system_input step instructing read-only diagnostics and preventing further rollouts, and removes the rollout function through removed_tools — while keeping its definition in the top-level list. The agent keeps its full history, cached, and continues under the new rule. Without the preview, the same change meant either a weak user-message instruction or a full cache invalidation and reprocessing.

The security boundary does not move with this feature. Backend authorisation remains the application’s responsibility: a system_input step changes what the model is told, not what the application is allowed to do. Removing a tool from the model’s active set is not a substitute for enforcing the permission server-side.

The verdict

Mid-conversation instructions solve a real, narrow problem well: rules and permissions that change during long agent sessions, without paying to reprocess the session or weakening the instruction to a user message. Its limits are equally clear: three models, preview status, custom functions only, append-only history, and placement rules that punish sloppy requests with a 400. For agents that run for dozens or hundreds of turns under shifting rules, that trade is worth taking behind a reversible flag. For short conversations, the old patterns were never the problem.

Facts checked 5 December 2026. Details from Google’s announcement of mid-conversation system instructions and the Gemini API release notes (3 December 2026), as read and quoted in independent coverage on 3–4 December 2026; the vendor pages themselves were not opened in full in this run, so this article is page-evidence, not a live-verified read of Google’s docs. Google’s documentation is the final word if it changes.

The AiTopMix monthly roundup

One email a month, no spam

The tools and news that actually changed this month, plus the month’s new comparisons — in one short email. No subscriber count is claimed: the list is new, and it grows one reader at a time.

Advertise with AiTopMix