Gemini API: Change Rules Mid-Chat Fast
Unlock flexible Gemini agent updates without breaking the prompt cache
Dec 4, 2026 (Updated Dec 4, 2026) - Written by Christian Tico
Source: Google.
Lose the Friction: Generate Branded QR Codes for Your Bio Page
Struggling to direct live event audiences to your complex digital product URLs? Generate a fully customizable QR code linked straight to your profile.
Gemini API Mid-Conversation Updates Let Developers Change Instructions and Tools Without Breaking the Prompt Cache
Google has introduced a preview update for the Gemini API that lets developers modify system instructions and function tools in the middle of a conversation while keeping the prompt cache intact. This makes long-running agents more flexible, reduces repeated processing, and helps control costs for applications that need to adapt on the fly.
What changed in the Gemini API
The new capability is available in preview through the Interactions API and supports a system_input step that can be sent before user input during a turn. That step can include new instructions, tool changes, or both, without forcing the model to reprocess the entire prompt prefix.
- Developers can update system instructions mid-conversation.
- Developers can add or remove tools during an active session.
- Earlier cached context remains usable, which helps preserve efficiency.
Why this matters for agent builders
For agentic workflows, the ability to change behavior mid-session is a major practical improvement. It allows applications to respond to new business rules, user states, or workflow stages without restarting the conversation or invalidating cached context.
- More flexibility: Agents can adjust rules as the conversation evolves.
- Lower cost: Preserving the cache reduces repeated token processing.
- Better scalability: Long conversations become easier to manage efficiently.
- Cleaner orchestration: Tool access can be tailored to the current step in the workflow.
How tool updates work without breaking cache
Google explains that tool declarations sit at the start of the prompt, so changing the top-level tools list between turns can break the prompt cache. To avoid that, the recommended pattern is to keep the same top-level tools list on every turn and use added_tools and removed_tools inside system_input to adjust what the model can call.
- Keep the top-level tools list consistent across turns.
- Use
added_toolsto expose new capabilities. - Use
removed_toolsto revoke capabilities when needed. - Let the changes persist until a later
system_inputupdates them again.
What this means for prompt caching
Prompt caching is most effective when the prompt prefix stays stable. Google’s guidance makes clear that if the first token that differs appears early in the request, the cache is broken for the rest of the prefix. Mid-conversation updates are designed to preserve that stable prefix while still allowing dynamic changes in behavior.
Practical use cases
This update is especially useful for assistants and agents that need to shift roles or permissions during a session.
- Customer support agents that unlock or disable tools as a case progresses.
- Workflow assistants that change rules after verification steps.
- Enterprise agents that adapt instructions based on policy or approval stage.
- Multi-step task systems that need selective access to integrations.
Conclusion
Gemini API’s mid-conversation instruction and tool updates give developers a more dynamic way to manage agent behavior without sacrificing prompt cache efficiency. The result is a more adaptable system that can stay responsive to changing context while keeping compute costs lower.
The Gemini API's mid-conversation updates solve a practical problem for agent builders: changing instructions and tools during a session without invalidating the prompt cache. This makes it possible to adapt permissions and rules to the different stages of a workflow while reducing processing costs. As this is a preview, it is worth testing on concrete use cases and verifying its behavior before adopting it in production.
Why does changing the top-level tools list between turns break Gemini API prompt caching?
