Google adds mid-chat rule changes for Gemini agents while preserving cached history
The public preview supports all Gemini 4 models. New instructions incur standard input charges, while earlier turns remain eligible for cached rates.
Loading page…
The public preview supports all Gemini 4 models. New instructions incur standard input charges, while earlier turns remain eligible for cached rates.
Listen to this story
Google’s preview gives Gemini API developers a way to revise an agent’s instructions and function tools during a session without invalidating the cached prefix of earlier turns. The change can reduce replay-related cost and delay, but it does not make new instructions free: their tokens use standard input rates. Developers must keep the original top-level system instruction unchanged, and any function call still requires backend authorization.
Developers pass the previous interaction ID and place a system_input step immediately before user_input; its instructions remain active until changed.
Updates have system-instruction authority; instructions on separate subjects coexist, and newer instructions take precedence when they conflict.
Developers can add or remove function tools in one step, with removals processed first; MCP-supplied tools are not supported.
Google released a public preview on December 3 that lets developers change Gemini agents’ instructions and available functions mid-conversation. Google says the update preserves earlier turns’ eligibility for cached processing, avoiding the need to reprocess the entire history whenever an agent’s rules or tools change.
The feature supports all Gemini 4 models through the Interactions API’s v1beta endpoint. Its central addition is a system_input step: a place to insert higher-priority instructions or tool changes between conversation turns.
Previously, Google says, developers faced a tradeoff. Putting revised instructions in ordinary user messages preserved the cache but gave them less authority. Rewriting top-level instructions or tools invalidated the prompt cache—the stored processing of earlier input—adding cost and delay.
The new approach leaves the original prompt intact. Developers pass the previous interaction’s ID and put one system_input step immediately before user_input in the next request. The top-level system_instruction must remain unchanged to preserve the cached prefix.
Google says these updates carry the same authority as top-level system instructions and outrank user messages. They stay active for the rest of the session. Rules on different subjects coexist; when instructions conflict, the model favors the newest one.
In Google’s support-agent example, an account enters billing review during a conversation. The application removes the refund function, adds an escalation-ticket function and tells the model to explain that refunds are paused.
Developers use added_tools and removed_tools while keeping the top-level tools list unchanged. Updates persist until another system_input changes them. When both fields appear together, removals happen first, allowing a function definition to be replaced in the same step. Only function tools are supported, not tools supplied through MCP servers.
Mid-conversation instructions carry no separate feature fee. Their tokens are billed at the selected model’s standard input rates, while earlier turns remain eligible for cached-token rates.
For developers using Gemini Enterprise Agent Platform, access is still ahead. Google says support is coming, but has not given a release date.
Loading discussion...
Join the conversation
Explain when an immediate update would be better than a pause.
Be the first to share a perspective or an experience.
Reader comments
Newest comments first. Replies stay oldest first.