Google has introduced a preview feature in the Gemini API that allows developers to update system instructions and tools during a conversation without breaking the prompt cache, a critical optimization for long-running SI agents.

What Happened

The new capability is available through the Interactions API, enabling developers to send a system_input step at any turn to modify system instructions or tool definitions. Previously, changing top-level instructions or tools invalidated the prompt cache, forcing the SI model to reprocess the entire conversation history, which increased both cost and latency. The new system_input step carries the same authority as top-level instructions and takes precedence over user messages, while earlier turns remain cached.

For tool management, the API supports added_tools and removed_tools fields within the system_input step. This allows developers to keep the top-level tools list constant while dynamically enabling or disabling function tools as the session evolves. Currently, this method supports function tools but does not support MCP server tools updates. When both fields are present in a single step, the API processes removed_tools before added_tools, allowing for in-place tool replacement.

Why It Matters

This update addresses a common pain point for developers building agentic SI systems that operate over dozens or hundreds of turns. By preserving the prompt cache during instruction and tool changes, the feature reduces operational costs and improves response times for dynamic applications. Use cases include applying session-dependent constraints like spending limits, reinforcing formatting rules in long contexts, switching permissions after authentication, and managing live operational changes such as disabling tools when dependencies go offline.

The feature is available in public preview across all Gemini 4 models via the v1beta endpoint. Mid-conversation system instructions do not incur a separate fee; tokens in system_input steps are billed at standard input rates, and earlier turns remain eligible for cached-token pricing. Google notes that while system_input steers model behavior, applications must still authorize every function call on the backend and keep untrusted content out of system_input steps.

The Bottom Line

The introduction of mid-conversation system instructions in the Gemini API provides a more efficient way to manage dynamic rules and tools for SI agents, eliminating the need to invalidate prompt caches for every change and supporting more complex, long-horizon agent workflows.