Gemini API lets agents change rules mid-chat and keep cache
In short
- Google has added a way to change an AI agent's rules or tools in the middle of a conversation through the Gemini API without making the model re-read everything that came before. It is in public preview for all Gemini 4 models in the Interactions API, Google says.
- Until now, changing the system instruction (the standing rules a developer gives the model) or the tools list broke the "prompt cache", so the model reprocessed the whole history, which added cost and delay. The new system_input step avoids that, Google says.
- Rules sent this way carry the same authority as the top-level system instruction and take precedence over user messages. The catch: it is preview only, covers function tools but not MCP server tools, and the post gives no cost or speed numbers.
What problem does mid-conversation system instruction solve?
An AI model does not remember a chat the way a person does. On every turn, the application sends the whole conversation so far. To avoid paying to process the same text again and again, the provider keeps a prompt cache: if the start of the new prompt is identical to the last one, the already-processed part is reused at a lower rate.
That works only while the beginning stays the same. The system instruction and the list of tools sit at the very start of the prompt, so editing either one changes the beginning and throws the cache away.
Google's post says long-running agents often work across "dozens, if not hundreds" of turns, and that rules, permissions and tools change along the way. Developers had two workarounds, it says:
How does the system_input step work?
The Interactions API now accepts a system_input step at any turn. Per the post, it carries the same authority as the top-level system instruction and takes precedence over user messages, while earlier turns stay cached.
To use it, the developer passes the previous turn's ID in previous_interaction_id and puts the system_input step directly before the user_input step. The top-level system_instruction stays unchanged on every turn, so the start of the prompt is the same and the cache stays valid.
Google's example is an infrastructure troubleshooting assistant. After a first question about a latency spike, the app sends a system_input saying a production deployment freeze is active, recommending read-only diagnostics and no further rollouts. When the user then asks for the command to deploy a new release, the sample reply says a freeze is active and offers checks instead.
Other behaviour the post describes:
- Each system_input is added to the history as its own step and stays active for the rest of the session, alongside the top-level instruction. Rules on different topics all stay in force.
- If a newer system_input conflicts with an earlier instruction, the model favours the most recent one.
- One system_input step can be sent per turn. When you fetch an interaction back, each step appears in order next to the user and model steps, which Google says makes agent traces easier to audit and debug.
Can tools change mid-conversation too?
Yes, with a limit. Tool declarations also sit at the start of the prompt, so changing the top-level tools list breaks the cache. Google recommends leaving that list identical on every turn and adding added_tools and removed_tools to a system_input step.
Its example is a support agent that starts with get_store_hours and issue_refund. When an account goes under billing review, the app removes issue_refund and adds create_escalation_ticket, with a note telling the agent to explain that refunds are paused and offer to escalate. If a step has both fields, removals are processed before additions, so a tool definition can be replaced in place. Changes last until a later system_input changes them.
Only function tools can be updated this way for now, not MCP server tools (tools an agent reaches through the Model Context Protocol), the post says.
Google says these steps steer the model; they are not a security lock. Applications should still authorise every function call on their own backend and keep untrusted external or end-user content out of system_input.
What does it cost, and where is it available?
The post says mid-conversation system instructions carry no separate fee. Tokens in system_input steps are billed at the standard input rate of the model called, and earlier turns stay eligible for cached-token rates when rules or tools change. It gives no price figures, and no measured savings.
It is available in public preview across all Gemini 4 models in the Interactions API, through the v1beta endpoint of the Gemini API. Support for Gemini Enterprise Agent Platform is "to come soon".
Google lists these uses:
- Session-dependent constraints such as workspace settings, account entitlements or spending limits found partway through.
- Re-stating formatting, tone or policy rules deep into a long session as context grows.
- Permissions and mode switches, such as enabling write tools after sign-in or plan approval and removing them for read-only review.
- Taking a tool offline when a downstream service fails, then restoring it.
- Large tool catalogues: start with a few tools and add more as the task needs them.
What is not stated
This is a company announcement, and we have not run the API. The post does not say how much cost or delay is saved, how reliably the model follows a mid-conversation rule over a user message, or whether other providers offer the same. Treat the "same authority" and "stays cached" statements as Google's claims until developers test them.
Terms in plain English
- Prompt cache: a stored copy of the already-processed start of a prompt, reused when the next request begins with exactly the same text. (Our plain explanation.)
- System instruction: the standing rules a developer gives a model, which rank above what a user types.
- Tool (function): an action the model may ask the app to run, such as issuing a refund.
- Preview: an early release that may change before general availability.
Sources
- Introducing mid-conversation instructions in the Gemini API, Google, 3 December 2026
Sources
Related stories
- Berkeley AI Research releases FantasticML, a 48-task agent test
- IETF starts four working groups, two for AI-agent protocols
- AWS says attacks on exposed AI software rose about 800% in 2026
- Decoy strings that halt an AI agent when read, Anthropic says
- SpaceXSI's Grok Bot connects to 12 small-business apps
- Top AI agent beats authors' code on 28 of 48 tasks, Berkeley says