Back to News
December 3, 20260 views via Google AI

Google adds mid-conversation instructions to Gemini API in preview

Google has introduced mid-conversation system instruction and tool changes in preview for the Gemini API via the Interactions API, allowing agents to adapt rules and tools mid-session without invalidating the prompt cache.

AI-generated illustration for: Google adds mid-conversation instructions to Gemini API in preview

What happened

Google announced that mid-conversation system instruction and tool changes are now available in preview in the Gemini API through the Interactions API. The capability addresses a long-standing limitation for long-running agents that operate across dozens or hundreds of turns. Previously, developers had to either embed new instructions in user messages β€” which carry less authority β€” or rewrite the system instruction or tools list, which invalidates the prompt cache and forces the model to reprocess the entire conversation history, adding cost and latency.

With the Interactions API, developers can now send a system_input step at any turn by passing the previous turn's ID in previous_interaction_id and placing the system_input directly before user_input in the input array. The top-level system_instruction should remain unchanged across turns so the prompt prefix stays valid in the cache. Each system_input appends to the conversation history as its own step, remains active for the rest of the session alongside the top-level instruction, and takes precedence over user messages. When a newer system_input conflicts with an earlier one, the model favors the most recent instruction.

Tool updates work similarly: the API recommends keeping the same top-level tools list on every turn and using added_tools and removed_tools within a system_input to modify which functions the model can call. Only function tools are supported, not MCP server tools. Tool changes persist until a later system_input alters them, and the API processes removals before additions in a single step, enabling in-place replacement. The interaction history, including all system_input steps, is retrievable for audit and debugging.

Why it matters

The feature enables session-dependent constraints such as workspace settings, account entitlements, or spending limits to be applied partway through a conversation. It also supports long-horizon instruction reinforcement, dynamic permission switches after authentication, live operational changes when dependencies go offline, and incremental tool catalog expansion without declaring every tool up front. Because system_input appends at the current turn boundary, preceding tokens remain identical and reuse the prompt cache, so earlier turns stay eligible for cached-token rates. Tokens in system_input steps are billed at standard input token rates with no separate fee. The preview is available across all Gemini 4 models via the v1beta endpoint, with support for Gemini Enterprise Agent Platform coming soon.