ProductsNEWS BRIEFING

Gemini API adds system_input: update system instructions and tools mid-conversation without breaking the prompt cache

4 min read

88Z AI, 4 December — Google introduces system_input in the Gemini Interactions API, enabling developers to dynamically update system instructions or modify function tools mid-conversation without invalidating the prompt cache. Available for all Gemini 4 models, this feature reduces costs for long-running agents and improves adaptability, while emphasizing backend authorization and security isolation.

At a glance

  • system_input allows updating instructions and tools mid-conversation without resetting cache
  • Tool changes support in-place replacement (remove then add), limited to function tools
  • Top-level system_instruction must remain unchanged to maintain cache validity
  • Applications must authorize all function calls on the backend and exclude untrusted content from system_input

Background and Pain Points: The Cache Dilemma in Long Sessions

When building long-running AI agents, conversations often span dozens or hundreds of turns. During this time, business rules, permission states, or available tools may change. Previously, developers faced a dilemma when updating system instructions or tools mid-conversation: either send new instructions as user messages, which lack the authority of system instructions and are susceptible to imitation, or rewrite the top-level system instruction or tool list, which invalidates the prompt cache. The latter forces the model to reprocess the entire conversation history, significantly increasing latency and cost. Google’s new system_input step addresses this by allowing dynamic context adjustments without breaking the cache.

Technical Implementation: How system_input Works

There are three steps. First, send the same top-level system_instruction (and the same top-level tools list) on every turn and do not rewrite them, so the prompt prefix keeps hitting the cache. Second, from the second turn on, set previous_interaction_id to the ID of the previous interaction. Third, put a step of type system_input in the input array, with text content, directly before user_input. You can send one system_input step per turn, containing text, tool updates, or both.

In Google's example, an infrastructure troubleshooting assistant (model gemini-4-neon, using the google-genai SDK with api_version set to v1beta) receives a system_input on turn two saying a production deployment freeze is active, so it should recommend read-only diagnostics and allow no further rollouts. When the user then asks for the command to deploy a new release, the model follows the freeze and offers checks instead.

How the rules apply: system_input carries the same authority as the top-level system instruction and takes precedence over user messages. It is appended to the history as its own step and stays active for the rest of the session. Rules on different topics stay in effect together; when a newer system_input conflicts with an earlier instruction, the model favors the most recent one. When you retrieve an interaction with client.interactions.get, the system_input, user_input and model_output steps appear in order, which makes multi-turn agent traces easier to audit and debug.

Dynamic Tool Management: Addition, Removal, and Replacement

Tool declarations sit at the start of the prompt, so changing the top-level tools list between turns breaks the cache. Google recommends keeping the same top-level tools on every turn and using removed_tools and added_tools inside system_input to change which functions the model can call. When one step contains both, the API processes removed_tools before added_tools, so you can replace a tool definition in place. Tool updates stay in effect until a later system_input changes them. Only function tools are supported for now, not MCP server tools.

Google's example is a support agent that starts with get_store_hours and issue_refund. On the next turn, because the account is under billing review, the system_input adds a short note (refunds are paused; offer to escalate), removes issue_refund and adds create_escalation_ticket. When the user asks to refund order 12345, the model can explain that refunds are unavailable and escalate instead. Google also suggests adding a short text note when removing a tool so the model can explain why an action is unavailable.

Use cases Google lists

Google's examples include: applying constraints discovered partway through a session, such as workspace settings, account entitlements or spending limits; re-emphasizing formatting, tone or policy rules deep into long sessions; enabling write or account-action tools after authentication or plan approval and removing them when returning to read-only review; disabling a tool and updating guidance when a downstream dependency goes offline, then restoring it after recovery; and starting with a small set of tools from a large catalog and adding more as the task needs them, without declaring everything up front or breaking the cache.

Security Considerations and Pricing Model

While system_input offers powerful orchestration controls, Google emphasizes that applications must still authorize every function call on the backend and strictly keep untrusted external or user-generated content out of system_input. Regarding pricing, there is no separate fee for mid-conversation system instructions; tokens in system_input steps are billed at the standard input token rates for the model. Since earlier turns remain cached, they continue to benefit from cached token rates. The feature is currently in public preview for all Gemini 4 models via the v1beta endpoint in the Gemini API, with support for the Gemini Enterprise Agent Platform coming soon.

Sources & editorial note

This article is an AI-assisted synthesis by 88Z AI based on the public sources below. Product claims and availability are attributed to their publishers. It does not represent independent testing or first-hand reporting.

  1. @googledevsSource published

Source dates above refer to the original announcements; the date under the headline is this article’s publication on 88Z AI.

Related reading

All stories
88Z.ai