Google is previewing a way to update system instructions and available tools partway through a conversation in the Gemini API’s Interactions API. The change targets long-running agents, where permissions, operating rules, or available actions can shift after a session has begun. Previously, adapting to those changes could mean losing the prompt cache and having the model process the conversation history again.
Adding instructions without restarting the context
Developers can place a system_input step immediately before user_input in the request’s input array and link the call to the prior turn with previous_interaction_id. To keep the prompt prefix stable for caching, the top-level system_instruction should remain unchanged across turns.
A system_input step is recorded as part of the conversation and has the authority of a system instruction, rather than being treated as ordinary user text. It stays active alongside the top-level instruction. Rules on different topics can therefore coexist; when newer and older instructions conflict, the latest system_input takes precedence. The recorded steps can also be retrieved in sequence, which may make agent traces easier to inspect and debug.
This offers an alternative to two earlier workarounds. Putting operational rules in a user message does not give them the same authority as a system instruction. Rewriting the top-level instruction, meanwhile, invalidates the cache. The new approach is intended to let an application respond to changes without either compromise.
Updating function tools, with limits
Tool declarations sit at the beginning of the prompt, so changing the top-level tools list between turns can break cache reuse. Google recommends keeping that list the same and using added_tools and removed_tools inside system_input to change which function tools the model may call. Updates remain active until a later system_input changes them. When a step removes and adds tools together, removals are processed first, allowing a tool definition to be replaced.
The current mechanism supports function tools only, not MCP server tools. Nor does tool availability replace application-side security checks. Developers must authorize every function call on their backend before execution and should keep untrusted user or external content out of system_input.
Why it matters for agent design
The feature could help applications respond to account entitlements, spending limits, authentication, operational outages, or a switch to read-only mode. It also gives developers a way to reinforce policies or formatting rules deep into a long session. Instead of exposing every tool from the start, an agent can add or remove function tools as a task evolves while retaining the original top-level declarations.
Cache preservation does not make new instructions free: tokens in system_input are billed at the model’s standard input rates, with no separate fee for the capability itself. The update improves orchestration flexibility and cache continuity, but it does not transfer authorization responsibility from the application to the model.
Source: Google AI Blog
Comments
Checking sign-in status...
Loading comments...