Skip to content

Gemini API lets agents change rules and tools mid-session

Short answer

Google has put mid-conversation system instructions into public preview in the Gemini API. Through the Interactions API, developers can add a system_input step on any turn to change rules or function tools while earlier turns stay cached. The new tokens bill at standard input rates, with no separate fee.

What this means for operators

If you run a support, sales or operations agent, the rules about what it may do rarely stay fixed for a whole conversation. An account goes under billing review, a customer finishes authentication, a downstream system goes down. Until now, reflecting that meant paying to reprocess the whole conversation or pasting a weaker instruction into a user message. With system_input, the orchestration layer can pull the refund tool, add an escalation tool and tell the model why, all on the next turn. The practical checks for a 10-200 person team: list which of your agent rules are session-dependent, confirm your tools are plain function tools (MCP server tools are not covered yet), and keep authorization on your own backend, because Google itself says these controls steer the model and do not replace server-side checks.

Google has released mid-conversation system instructions in preview for the Gemini API, according to the Google AI Blog post of 3 December 2026. The feature lives in the Interactions API and targets agents that run for many turns while permissions, rules and available tools shift underneath them.

The problem it addresses

Two workarounds existed before. One was to slip new instructions into a user message, which keeps the cache but carries less weight than the top-level system instruction and lets users try to imitate it. The other was to rewrite the system instruction or the tools list, which invalidates the prompt cache, so the model reprocesses the full history at added cost and latency.

How it works

A developer sends a system_input step on any turn, placed directly before the user_input step, and passes the previous turn's ID. The top-level system_instruction stays unchanged between turns so the cached prefix remains valid. According to Google, a system_input step has the same authority as the top-level instruction and takes precedence over user messages. Each step is added to the history and stays active for the rest of the session. Rules on different topics apply together, and when two conflict, the model favors the newer one.

Steps also show up in order when an interaction is retrieved, next to user input and model output, which makes multi-turn agent traces easier to audit.

Changing tools mid-session

Because tool declarations sit at the start of the prompt, editing the top-level tools list would break the cache. Google recommends keeping that list identical on every turn and using added_tools and removed_tools inside system_input. In Google's example, a support agent loses its refund function and gains an escalation-ticket function when an account goes under billing review. If a step has both fields, removals are processed before additions, so a tool definition can be replaced in place. A short text note alongside a removal gives the model context to explain why an action is unavailable.

Only function tools are supported for this today. MCP server tools are not.

Suggested uses

Google lists session-dependent limits such as entitlements or spending caps, reinforcing policy or tone late in a long session, enabling write tools after authentication and removing them afterwards, disabling a tool while a dependency is offline, and starting with a small tool set that grows as the task needs it.

Cost and availability

There is no separate fee. Tokens inside system_input steps are billed at the standard input rate of the model being called, and earlier turns remain eligible for cached-token rates. The preview covers all Gemini 4 models in the Interactions API on the v1beta endpoint. Support for Gemini Enterprise Agent Platform is described as coming soon, without a date.

A caution from the vendor

Google stresses that system_input, added_tools and removed_tools steer model behavior but are orchestration controls, not security boundaries. Applications should still authorize every function call on the backend and keep untrusted external or end-user content out of system_input.

Source: Google AI Blog

The tools in this story

  • Gemini - price, who uses it, alternatives
Next step

Visibility Analyzer

An AI news item will not tell you how assistants see your own site. The Visibility Analyzer checks that on your live site: which answers cite you, which pages an engine cannot retrieve, and what to fix first. Free to run.

Run a free visibility audit

Free to run. No card.

Fee
Free
Length
One run, minutes

Free tier: two analyses a day, no card required.