Gemini API Introduces Mid-Conversation Instruction Updates
On December 3, 2026, the Gemini API introduced a feature allowing developers to update system instructions or tools during a conversation while maintaining the prompt cache.
This capability, available in preview through the Interactions API, enables agents to adapt to new rules and tools without the need to reprocess the entire conversation, thus avoiding increased costs.
Traditionally, developers faced challenges when trying to implement changes mid-session. They often relied on two workarounds: sending new system instructions as user messages, which lacked the authority of top-level instructions, or rewriting system instructions, which invalidated the prompt cache and increased processing time.
The new Interactions API allows developers to send a `system_input` step at any point in the conversation. This step holds the same authority as the top-level system instruction and takes precedence over user messages, while earlier turns remain cached.
Functionality of Mid-Conversation Updates
To implement an instruction change, developers must provide the previous turn’s ID in `previous_interaction_id` and include a `system_input` step before `user_input` in the input array. The top-level `system_instruction` should remain unchanged to keep the prompt prefix valid in the cache.
Each `system_input` step is appended to the conversation history and remains active throughout the session. If a new `system_input` conflicts with an earlier instruction, the model prioritizes the most recent one.
When retrieving an interaction, each `system_input` step will appear in order with `user_input` and `model_output`, simplifying the auditing and debugging of multi-turn agent interactions.
Tool Updates Mid-Conversation
Tool declarations are typically at the start of the prompt, so altering the top-level tools list between turns disrupts the prompt cache. Developers are encouraged to keep the top-level tools list consistent across turns and utilize `added_tools` and `removed_tools` to modify the functions available to the model as the session progresses.
For example, a support agent may start with `get_store_hours` and `issue_refund`. In the next turn, the agent can remove `issue_refund` and add `create_escalation_ticket`, while keeping the top-level tools list unchanged.
Tool updates remain effective until a subsequent `system_input` modifies them. If both `added_tools` and `removed_tools` are included in a single step, the API processes `removed_tools` before `added_tools`, allowing for in-place tool definition changes.
Practical Applications
This feature supports various applications, such as:
- Implementing session-dependent constraints like workspace settings or spending limits.
- Reinforcing key formatting or policy rules during lengthy conversations.
- Enabling or disabling tools based on authentication or approval processes.
- Making live operational changes when external dependencies fail.
- Expanding tool capabilities dynamically without upfront declarations.
Pricing and Model Support
There is no additional fee for mid-conversation system instructions. Tokens in `system_input` steps are billed at standard input token rates for the model used. Previous turns remain eligible for cached-token rates when rules or tools are modified.
This feature is currently available in public preview across all Gemini 4 models through the Interactions API. Support for the Gemini Enterprise Agent Platform is expected to follow soon.
Developers can begin using this feature by consulting the documentation, comparing Gemini models for their specific workloads, and participating in discussions on the AI Developer Forum.
Source: Google AI Blog