Introducing mid-conversation instructions in the Gemini API
Update system instructions and tools mid-conversation while preserving your prompt cache.
First seen by Oriel on .
AI summary
The Gemini API Interactions API adds preview support for changing system instructions and function tools mid-conversation while preserving cached earlier turns.
- Add a `system_input` step directly before `user_input`, keeping the top-level `system_instruction` unchanged so the prompt prefix remains cacheable.
- New instructions persist for the session alongside the original instruction; when instructions conflict, the most recent takes precedence.
- Use `added_tools` and `removed_tools` within `system_input` to update function tools while keeping the top-level tools list identical; MCP server tools are not supported.
- The feature is in public preview for all Gemini 4 models through the `v1beta` endpoint, with no separate fee for mid-conversation instructions.
- System instructions and tool updates guide model behavior but do not replace backend authorization; untrusted user or external content should not be placed in `system_input`.
#gemini api #llm agents #prompt caching #function calling
Generated by gpt-5.6-sol. Check the original for details.
Aliases
| Source | External ID | URL |
|---|---|---|
| Google AI Blog | https://blog.google/innovation-and-ai/technology/developers-tools/gemini-api-mid-conversation-updates/ | https://blog.google/innovation-and-ai/technology/developers-tools/gemini-api-mid-conversation-updates/ Read discussion |