By Mahan Kenway
Cover: Original conceptual illustration of a conversation and changing agent tools. It does not depict an actual Google interface.
An AI agent’s circumstances can change while a conversation is still going. A user signs in, a deployment freeze begins, or a backend service becomes unavailable. The application may need to change what the assistant can do without throwing away the conversation it already has.
On December 3, Google announced a preview that lets developers append system-level instructions and update custom function tools during a Gemini Interactions API conversation. The design also keeps the earlier prompt prefix eligible for caching, rather than forcing developers to rewrite the initial instruction or tool list.
This is a different feature from the real-time Live API used for voice sessions. It targets developers building multi-turn applications with the Interactions API, and its most interesting implications are about state, cost and security boundaries.
Why the existing workarounds are awkward
In a long session, the model may repeatedly process a shared prefix containing instructions, tool declarations and earlier conversation. Prompt caching can make matching portions cheaper to reuse. But changing text near the beginning of the prompt changes the prefix, so later content may no longer match.
One workaround is to put a new rule into an ordinary user message. Google notes that this lacks the authority of a system instruction. Another is to replace the original system instruction or tool list, which can disrupt cache reuse. Neither is an ideal way to tell an agent that a previously permitted action has become unavailable.
The new mechanism adds a system_input step at a later turn instead. Google says it has the same instruction authority as the top-level system instruction while the existing conversation remains ahead of it in the history. The API guide says earlier rules remain in context; a newer conflicting instruction is favored, while nonconflicting instructions continue to apply.
That is a useful behavior change, but it is not a formal guarantee that a model will always obey. Keep critical enforcement outside the prompt.
A minimal example
Here is a small adaptation of the documented pattern. It starts a support conversation and then supplies a new rule when the application learns that the account needs review. Install Google’s Python SDK and configure its credentials as described in the Gemini API quickstart before running it.
from google import genai
client = genai.Client(http_options={"api_version": "v1beta"})
baseline = "You are a support assistant. Explain the next step clearly."
first = client.interactions.create(
model="gemini-4-neon",
system_instruction=baseline,
input="I need help with an order.",
)
second = client.interactions.create(
model="gemini-4-neon",
previous_interaction_id=first.id,
system_instruction=baseline,
input=[
{
"type": "system_input",
"content": [{
"type": "text",
"text": "The account is under review. Offer escalation; do not promise a refund.",
}],
},
{
"type": "user_input",
"content": [{"type": "text", "text": "Can I get a refund today?"}],
},
],
)
print(second.output_text)
The important pieces are the previous interaction ID, the unchanged baseline instruction and the order of the two input steps. system_input must appear immediately before user_input. Google allows at most one per turn, and it cannot be sent alone or during a function-result loop; wait for the next user-input turn. Invalid requests return HTTP 400, according to the documentation.
This tiny example shows the shape of the request, not a cache benchmark. It may be too short to qualify for a cache hit.
Changing the available functions
The same system_input step can carry added_tools and removed_tools. For example, an application could remove a refund function when an account enters review and add an escalation function instead. The removal entry is a function object containing its type and name; an added function needs its full definition. If both are included in one step, removals are processed before additions.
There is an easy mistake to make: keep passing the original top-level tools list on subsequent chained turns, even when one of those functions has been removed through removed_tools. The API validates history against that original list. Conversely, do not re-declare a function added mid-session in the top-level list; Google says doing so can produce HTTP 400. The tool-update rules and full example are worth reading before implementing a tool registry.
The scope is narrower than the name might suggest. For now these update fields support custom function tools, not MCP servers or built-in tools such as Google Search and code execution. Function-calling modes configured through tool_choice apply to the initial tool list, although the model can still call functions added later.
A practical pattern is to pair the tool change with a short instruction explaining the new state. Removing a tool tells the API what is available; the accompanying text helps the assistant explain the change to the user.
The cache benefit needs measurement
The appeal is preserving an unchanged prefix, not creating a permanent cache. Google’s caching guide says implicit caching is opportunistic: there is no guaranteed retention window or saving. The documented Gemini 4 minimum is 4,096 input tokens, so a short conversation might not qualify at all.
For the supported Gemini 4 models, Google lists a 95% discount on cached input tokens. That is a discount on eligible cached input, not on an entire request: new input, output and any other applicable usage still have their own charges. The new system_input tokens are billed as input, with no separate feature fee according to Google’s announcement.
Measure interaction.usage.total_cached_tokens alongside total input tokens, latency and cost. Compare similar sessions before and after the change, with equivalent prompts and time gaps. Stable top-level instructions, original tool declarations and configuration matter, but they do not guarantee a cache hit.
There is also a privacy detail worth checking. Google says Gemini 4 may keep evicted implicit-cache prefixes in encrypted durable storage for up to 12 hours, subject to its documented exceptions. store=False opts out of server-side conversation storage on the Interactions API but does not disable implicit caching. Read the current caching and retention documentation and your applicable service terms before sending sensitive context.
A policy update is not an authorization system
A changing tool list makes the model’s choices easier to manage, but it must not become the only barrier between a model and an irreversible action. Treat model-generated function calls as requests from an untrusted client: validate the arguments, authenticate the user and check current permissions on the server every time before executing the operation.
This matters even when a tool has been removed. An in-flight call, a stale session, a retry or an application bug can still encounter a changed permission state. The backend should independently reject actions that are no longer allowed. High-impact actions may also need an explicit approval step and an audit record.
Likewise, don’t promote arbitrary user messages, retrieved webpages or tool output into system_input. Only trusted application logic should decide what belongs there. Otherwise a prompt-injection attempt could be laundered into a higher-authority instruction. Log the policy version and relevant tool changes, with appropriate privacy safeguards, so you can reconstruct why the assistant behaved as it did.
What to check before shipping
The feature is a preview on the Interactions API’s v1beta endpoint and its surface may change. The current guide lists gemini-4-carbon, gemini-4-neon and gemini-4-hydrogen; other models return HTTP 400. It does not support generateContent or agent interactions. Each appended system step remains in the conversation and cannot be deleted, so explicitly state when an earlier temporary rule has been reversed.
Before rollout, test a normal update, a reversal, a removed tool, an added tool, an invalid step order and a long conversation that actually qualifies for caching. Then test the failure cases separately: revoked permissions, stale sessions, malformed function arguments and attempted instructions hidden in retrieved content.
The result is a cleaner way to adapt a conversation without rebuilding its beginning. The real engineering win comes when that flexibility is paired with measurable cache behavior and backend controls that do not depend on the model getting every decision right.