Gemini API lets agents swap instructions and tools mid-conversation

Google says a new preview feature in the Gemini API's Interactions API updates rules and tools partway through a session without reprocessing earlier turns or breaking the prompt cache.

AIVIO News Desk 2 min read
AIVIO News cover illustration for: Gemini API lets agents swap instructions and tools mid-conversation

Google has started rolling out a preview feature for the Gemini API that lets developers change an AI agent’s instructions or available tools in the middle of a conversation, according to a post on the Google AI Blog. The update arrives through the Interactions API and is designed for agents that run across many turns, where rules and permissions often shift partway through.

Previously, developers had two options when a session’s rules changed: slip new guidance into a user message, which carries less authority and can be overridden by users, or rewrite the system instruction entirely, which forces the model to reprocess the whole conversation and raises cost and delay, Google says. The new approach avoids both problems with a step called system_input, which can be inserted before a user’s message at any turn.

According to the company, a system_input step holds the same weight as the original top-level system instruction and overrides anything a user says, while every earlier turn stays cached. Developers trigger it by referencing the previous turn’s ID and keeping the original system instruction unchanged, so the cached prefix of the conversation remains valid. Multiple instructions on different topics can stay active together, and if two conflict, Google says the model follows the most recent one.

The same mechanism extends to tools. Because tool definitions normally sit at the start of a prompt, changing the full tools list would break the cache. Instead, Google recommends keeping the top-level list fixed and using added_tools and removed_tools fields to adjust what the model can call as a session evolves. The company gives an example of a support agent that starts with store-hours and refund tools, then swaps the refund tool for an escalation-ticket tool once an account enters billing review. Only function tools support this method today; MCP server tools do not.

Google lists use cases including session-dependent constraints such as spending limits, reinforcing formatting or policy rules in long sessions, toggling write permissions after authentication, and disabling tools when a dependency goes offline. The company also cautions that these controls steer behavior rather than enforce it, so applications should still authorize every function call on the backend and keep untrusted external or user content out of system_input steps.

What this means

The change targets a specific cost and reliability problem in agentic applications: keeping an agent responsive to new rules without paying to reprocess an entire conversation history. By letting instructions and tool lists update at a turn boundary while preserving the cached prefix, Google is addressing a workaround developers had already been patching together with user-message injections or full rewrites.

What remains unclear from Google’s announcement is pricing detail beyond standard input-token rates for system_input content, and how quickly the feature will extend from preview into the Gemini Enterprise Agent Platform, which the company says is coming “soon” without a date. The restriction to function tools, excluding MCP server tools, also leaves a gap for agents built on that protocol.

The feature is in public preview across Gemini 4 models through the v1beta endpoint of the Gemini API, with documentation and a developer forum discussion now live, Google says.

Sources

Google AI Blog