Google adds mid-conversation instruction changes to Gemini API in preview

Google says developers using the Interactions API can now change system instructions and tools partway through a session without invalidating the prompt cache.

Numbers in brackets link to the sources listed below.

Google announced that developers can now change a model's system instruction or its tools partway through a conversation in the Gemini API without invalidating the prompt cache. The company says the capability is available in preview through the Interactions API[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]].

Google says long-running agents often work across dozens or hundreds of turns, and that rules, permissions and available tools change along the way. Until now, the company says, giving the model a new system instruction or updating tools invalidated the cache[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]].

The workarounds it replaces

Google describes two earlier options. Sending new instructions as a user message keeps the cache, but the company says such messages carry less weight than top-level system instructions and let users try to imitate them. Rewriting the system instruction or tools makes the model reprocess the whole conversation history, which Google says adds cost and latency[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]].

How the new step works

According to Google, the Interactions API now accepts a step called system_input at any turn, carrying instruction or tool changes. Google says the step ranks equal to the top-level system instruction and outranks user messages, and the turns that came before it remain cached[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]].

Google says every system_input gets recorded in the history as a distinct step and remains in force until the session ends, working together with the top-level instruction[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]]. Rules covering separate topics stay in force at once, and if a later system_input contradicts an earlier one, the model gives preference to the latest[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]].

Google also recommends leaving the top-level system_instruction as it is on every turn, so the prefix of the prompt remains valid in the cache[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]]. The company lists two uses:

  • Live operational changes: disabling a tool and updating guidance when a downstream dependency goes offline, then restoring it after service recovers[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]].
  • Large tool catalogs: starting with a few tools and adding others only when the task calls for them, with no need to list every tool at the outset or break the cache[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]].

Pricing and availability

Google says there is no separate charge for mid-conversation system instructions[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]]. According to the company, system_input tokens are charged the model's regular input-token price, and turns that came earlier still qualify for cached-token pricing after rules or tools are modified[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]].

According to Google, the public preview applies to each Gemini 4 model when used via the v1beta endpoint of the Interactions API[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]]. The company says support for Gemini Enterprise Agent Platform is to come soon[1GoogleIntroducing mid-conversation instructions in the Gemini APIOpen sourceSources [1]].

Sources

  1. 1

ITANU’s newsroom system produced this article with AI and checked it against the sources listed above. How we work

ITANU Magazine

Technology, science, sports and gaming