Google adds mid-conversation instructions to Gemini API
Image: Pexels
Google has released mid-conversation system instruction and tool changes in preview in the Gemini API through the Interactions API. The update allows developers to modify rules and available tools during long-running sessions without invalidating the prompt cache.
Previously, altering top-level system instructions or tool declarations reset the prompt cache, forcing the model to reprocess conversation history from the start. Developers either accepted the resulting latency and token costs or placed instructions directly into user messages, where they lacked system authority and risked imitation by users.
Under the new approach, developers can send a system_input step directly before user_input in the input array. This step appends to the conversation history at the turn boundary and preserves earlier cached turns, provided the top-level system_instruction and tools list remain unchanged. Each system_input step stays active for the remainder of the session alongside the original instructions, with the model favoring the most recent instruction when conflicts arise. Multi-turn traces retrieved from the API display system_input in order alongside user_input and model_output.
Tool updates operate similarly through function declarations. While top-level tools remain identical across calls, developers can pass added_tools and removed_tools inside system_input to adjust what the model can call. When a single step includes both fields, the API evaluates removed_tools before added_tools, which allows replacing an existing tool definition. Currently, the update supports function tools and does not support MCP server tools.
Google stated that mid-conversation instructions carry no separate fee. Tokens in system_input steps are billed at standard input token rates for the chosen model, while preceding turns continue to qualify for cached-token rates.
Related AI News
Enjoyed this? Get more in your inbox.
Up to ten of the week's AI news stories, by email once a week.