New controls for long-running AI agents
Google has introduced a preview feature for the Gemini API that allows developers to update an AI agent’s system instructions or available tools in the middle of a conversation without invalidating the prompt cache.
The capability is available through the Interactions API and is aimed at long-running agents, where rules, permissions and tools can change over dozens or hundreds of turns. Google says the update lets developers adapt an agent during a session without requiring the model to reread the entire conversation history.
That matters because prompt caching is intended to avoid repeatedly processing a stable prefix of a conversation. When a conversation’s governing instructions or tool configuration changes, preserving that cached context can reduce the extra latency and cost associated with reprocessing earlier turns.
The previous trade-off
Google describes two common workarounds developers used when an agent needed new guidance partway through a conversation. One was to put the new instruction into a user message. That could preserve the cache, but the instruction did not have the same authority as a top-level system instruction and could be imitated by users.
The other was to rewrite the system instruction or change the tools directly. According to Google, that invalidated the prompt cache and forced the model to process the full conversation history again, increasing cost and latency.
The new approach is designed to address both limitations. It lets an application apply an update with system-level authority while maintaining the cache for the earlier conversation.
How the API change works
Developers can send a system_input step at any turn in an interaction. The step can contain changes to system instructions or tool availability and is placed directly before the user input for that turn. The application also passes the preceding turn’s identifier through previous_interaction_id.
Google says developers should keep the top-level system_instruction unchanged across turns so that the prompt prefix remains valid in the cache. The new system_input has the same authority as the top-level system instruction and takes precedence over user messages, while earlier turns remain cached.
A production example
Google illustrates the feature with an infrastructure troubleshooting assistant. The agent begins with a system instruction directing it to help investigate a latency spike. On a later turn, the application adds a system-level instruction stating that a production deployment freeze is active and that the assistant should recommend read-only diagnostics.
That is a useful example of why mid-session controls matter. The user’s task has not necessarily changed, but the operational rules governing a safe answer have. An agent that continues under stale permissions could recommend actions that are no longer appropriate.
Tool changes present a similar issue. An agent may start with one set of capabilities and later need another as a workflow moves between stages. The preview feature is intended to let the application reflect those changes without discarding the context accumulated earlier in the session.
Why it could affect agent design
Many agent workflows depend on persistent context. A support agent, research assistant or operations tool may need to retain details collected over many turns while remaining responsive to changing policies and permissions. Until now, preserving that context and changing the agent’s control layer involved a compromise between instruction authority and cache efficiency, according to Google.
The new interface separates those concerns more cleanly. A developer can preserve an established conversation prefix while adding a later, higher-priority update that the model should follow for the next response.
Google frames the change as particularly useful for agents whose sessions are long enough for rules, permissions or available tools to change. In such systems, configuration is not always fixed at the opening prompt. It can be an evolving part of the application state.
Preview status
The feature is available in preview through the Gemini API’s Interactions API. As with any preview release, developers will need to test its behavior within their own workflows before relying on it for production use.
Still, the announcement points to a broader direction in agent platforms: conversation history, system instructions and tool access are increasingly being treated as separate controls that can evolve at different times. For builders of long-running AI applications, that distinction may be as consequential as improvements to the model itself.
This article is based on reporting by Google AI Blog. Read the original article.
Originally published on blog.google








