Gemini API Introduces Mid-Conversation Instructions via Interactions API

Overview of the Update

Google AI has announced that the Gemini API now supports mid-conversation system instruction and tool changes through the Interactions API, currently available in preview. This feature allows developers to implement a system_input step at any point in a conversation while maintaining eligibility for prompt caching from earlier turns.

How It Works

To introduce a new instruction during a session, developers must pass the previous turn’s ID using previous_interaction_id and insert a system_input step directly before the user_input. This system_input holds the same authority as the top-level system_instruction and takes precedence over user messages, effectively appending as a distinct step in the conversation history. Each system_input remains active throughout the session alongside the original system_instruction. In cases where multiple system_input steps conflict, the model prioritizes the most recent instruction.

Tool Updates and Management

According to the announcement, tool declarations should remain unchanged at the top level to preserve the prompt cache. Instead of modifying the top-level tools list, applications should utilize removed_tools and added_tools within a system_input step to adjust which function tools the model can access. It is important to note that removed_tools are processed before added_tools, and only function tools (excluding MCP server tools) are supported for these mid-session updates.

Operational Guidance

Google AI emphasizes that developers should send one system_input step per turn, which can include text content, tool updates, or both. Additionally, it is crucial to keep untrusted content out of system_input. Applications must authorize each function call on the backend before execution.

Pricing Information

Tokens used in system_input steps are billed at the standard input token rates for the model in use. Earlier turns remain eligible for cached-token rates when rules or tools change. Mid-conversation system instructions are currently available in public preview across all Gemini 4 models via the Interactions API (v1beta endpoint) as of December 3, 2026.


Original source: Google AI

Leave a Comment