Gemini API lets you change instructions and tools mid-conversation
Google added mid-conversation instructions to the Gemini API in preview. Developers can change system instructions or the available tools partway through a session without invalidating the prompt cache.
What's new?
- Add a system_input step before the user_input step
- Change tools with added_tools and removed_tools
- Public preview for all Gemini 4 models
Why does it matter?
Agents no longer need to restart a conversation or pay for a fresh cache to change behavior. There is no separate fee: system_input tokens bill at standard input rates, and earlier turns can still hit cached rates.
Quick facts
| Released | Dec 3, 2026 |
|---|---|
| Type | API feature, preview |
| API | Interactions API v1beta |
| Price | Standard input rates |
What is it?
Mid-conversation instructions let an agent adapt to new rules and tools during a session. The feature is in public preview in the Gemini API's Interactions API for all Gemini 4 models.
How does it work?
Pass the previous turn's ID as previous_interaction_id and add a system_input step before the user_input step. Keep the top-level system instruction and tools list unchanged so the cached prefix stays valid; use added_tools and removed_tools to change callable functions. The most recent conflicting step wins.
Who is it for?
Developers building long-running agents on the Interactions API
FAQ
Does changing instructions break the prompt cache?
No. Keep the top-level system instruction and tools unchanged and use system_input steps; earlier turns stay eligible for cached-token rates.
Which tools can be changed mid-conversation?
Only function tools. MCP server tools are not supported.
Which models support it?
All Gemini 4 models, in public preview on the Interactions API v1beta endpoint.
Try it
Sources · 1
Written with AI assistance from the sources linked on this page. How we work.