Research review / tooling

Gemini API Lets Agents Change Rules and Tools Mid-Conversation Without Breaking the Prompt Cache

A December 3 preview in the Gemini Interactions API adds a system_input step that carries system-instruction authority, can add or remove function tools, and appends at the turn boundary so earlier turns stay cached. Google says these are orchestration controls, not security controls, and apps must still authorize every function call.

By Sandeep Belgavi · Published 2026-12-04

On December 3, 2026 Google published Mid-conversation system instructions in the Gemini API. The feature is in public preview "across all Gemini 4 models in the Interactions API (through v1beta endpoint)."

The problem it solves

Google names the two workarounds developers used before. Sending new rules as a user message keeps the cache, but such messages "don't carry the same weight as your top-level system instructions and allow users to try and imitate them." Rewriting the system instruction or the tool list "invalidates the prompt cache," so "the model reprocesses the entire conversation history, adding cost and latency." For an agent running hundreds of turns, both options are bad.

How system_input works

  • Placement: pass the previous turn's ID in previous_interaction_id and put a system_input step "directly before user_input." One such step is allowed per turn.
  • Authority: it "carries the same authority as your top-level system instruction and takes precedence over user messages." Each step "stays active for the rest of the session," and when instructions conflict "the model favors the most recent instruction."
  • Tools: keep the top-level tools list identical every turn and use added_tools and removed_tools. Removals are processed before additions, so a definition can be replaced in place. Only function tools are supported, "not MCP server tools."
  • Cache and cost: because the step appends at the current turn boundary, "all preceding tokens remain identical from turn to turn and reuse the prompt cache." There is no separate fee; system_input tokens bill at standard input rates.
  • Audit: retrieving an interaction shows each system_input step in order alongside user and model turns.

The limit Google states

The post is explicit: "system_input, added_tools, and removed_tools steer model behavior and serve as orchestration controls. Your application should still authorize every function call on the backend before executing it and keep untrusted external or end-user content out of system_input." Removing a tool from the model's view does not stop a stale or injected call from reaching your executor; only a server-side check does that.

Why it matters for harness design

Analysis: this moves a common harness pattern into the API. Permission changes after login, read-only modes during an incident and progressive tool disclosure for large catalogs were all possible before, but each change cost a full re-read of the conversation. Making the change cheap will make it common, which raises two engineering questions. First, rules now accumulate: a session's effective policy is the top-level instruction plus every system_input so far, so logs must record the full stack to explain a decision. Second, "most recent wins" is model behavior, not a guarantee, so conflicting rules should be avoided rather than relied on to resolve. Prefix-cache economics are shaping API design here as much as model quality is.

What to watch

Whether MCP tools gain the same add and remove support, whether the Gemini Enterprise Agent Platform version (promised "soon") behaves the same way, and whether other providers expose a comparable mid-session instruction role with documented precedence.

Original exercise, not executed: Jenya prototypes a mode switch for the Belgavi's Book Store returns assistant, logged as CASE-9170. The assistant starts read-only with an order lookup tool; after a staff member signs in, a system_input step adds a create_return tool, and a backend check still rejects any return the signed-in role may not approve. The test log records cache hits per turn and every rejected call.

Sources accessed December 4, 2026. Views are my own and do not represent any employer, past or present.

Sources and evidence

The Gemini Interactions API preview (December 3) adds a per-turn system_input step with system-instruction authority and added_tools and removed_tools, keeping earlier turns cached at no extra fee. Google warns it is an orchestration control: backends must still authorize every function call.