Skip to content
PromptifyLab

Google Gemini API Adds Mid-Chat Instructions

By Aamir6 min read

Google has launched a preview feature in the Gemini API allowing developers to update system instructions and function tools mid-conversation. By using the Interactions API, developers can inject authoritative rules without resetting the prompt cache, keeping token costs down while letting long-running multi-turn agents adapt to new workflows.

Impact for everyday users
Modest · 2/5
Low direct consumer impact, but significantly lowers costs and bugs for apps running AI agents.
Availability
Preview
Cost
Free + paid tiers
Most useful for
Software engineers, agent builders, AI product leads

Building automated AI assistants that handle multi-step tasks across dozens of replies has always involved an expensive technical headache. Every time you wanted to change the agent's internal rules or swap out its tools, the AI model had to re-read the entire conversation from scratch, driving up your API bill.

Google has rolled out a fix: Gemini API mid-conversation instructions are now live in public preview through its Interactions API. Developers can now steer agent behaviour and swap function tools on the fly without breaking the cached conversation history.

Here is how the update works, what it fixes behind the scenes, and what it means if you build or rely on customer-facing AI agents.

Key takeaways

  1. Developers can inject authoritative system instructions mid-conversation using system_input steps.
  2. Prompt caches remain valid across turns, preventing expensive full-context reprocessing.
  3. You can swap individual function tools via added_tools and removed_tools mid-session.
  4. The preview applies across all Gemini 4 models via the Interactions API v1beta endpoint.

How Gemini API mid-conversation instructions keep caches intact

Google's Interactions API now accepts a `system_input` step placed directly before `user_input` at any turn in a session, as reported on blog.google. Before this release, developers faced an awkward trade-off when directing multi-turn agents. Changing the top-level system prompt reset the conversation cache, forcing the model to calculate every previous message again at full input cost and higher latency. Alternatively, developers disguised administrative rules as user messages, which lacked system-level priority and left room for prompt injection.

The new `system_input` step carries the same structural authority as the top-level system prompt and takes precedence over standard user input. Preceding conversational turns stay untouched in the prompt cache, keeping API expenses low while you adapt rules dynamically. You can estimate potential savings across different project sizes with our Token & Cost Calculator.

This lets agents adapt to new rules and tools mid-session without re-reading the entire conversation or driving up costs.

Google, Developer Blog, blog.google

At a glance

Key facts: Google Gemini API Adds Mid-Chat Instructions
Detail What we know
Who Google
What Mid-conversation system instructions and dynamic tool updates in the Gemini API
When December 2026 (public preview)
Where Gemini API Interactions API (v1beta endpoint) and Google Cloud Vertex AI
Price No extra feature fee; regular Gemini token pricing applies with prompt cache discounts
Who can use it Developers using Gemini API and Google Cloud Vertex AI
Limits Supports function tools only (not MCP server tools); GA timing not announced

How dynamic tool updates work in practice

Google lets developers update an agent's available functions without altering the initial tool declarations that sit at the top of the prompt. Because modifying the top-level tool list invalidates cached prompts, the API introduces `added_tools` and `removed_tools` parameters inside the mid-turn input, as detailed by Unite.AI.

When both fields appear in one turn, the API processes `removed_tools` before `added_tools`, allowing developers to replace existing capabilities directly in place. For instance, a customer support agent can start with basic inquiry tools, discard refund capabilities once a user's verification expires, and activate ticket escalation. This feature currently applies only to native function tools and does not support Model Context Protocol (MCP) server tools. Backends must still authenticate every function call to ensure security.

Updating system rules mid-chat wiped the prompt cache, reprocessing full histories at higher cost or forcing messy user-message workarounds.

You can insert authoritative mid-session rules and swap function tools on any turn while retaining cached prompt discounts.

Your multi-turn AI agents become cheaper to operate, safer from prompt injections, and faster to respond.

  • General availability (GA) date has not been announced.
  • Launch timeline for Gemini Enterprise Agent Platform support remains unspecified.

How instructions accumulate across conversation turns

Mid-conversation instructions append sequentially to session history instead of overwriting earlier commands. Rules addressing separate topics remain active together alongside your original top-level system instruction, according to blog.google.

When a new instruction contradicts an older one, Gemini models favor the freshest instruction. However, because earlier turns cannot be erased from the conversation ledger, developers reversing earlier guidelines should explicitly tell the model to disregard specific past rules. When you retrieve interaction logs using `client.interactions.get()`, each `system_input` appears chronologically alongside user inputs and model outputs, making agent workflows simpler to trace and audit. If you are comparing backends for custom assistants, check our AI models guide to see where Gemini fits.

Hype vs reality

You can completely wipe or edit past conversation context on the fly.

Updates strictly append forward; earlier instructions stay in the context history and require explicit overrides if contradicted.

This works across all tools, including external MCP servers.

The preview explicitly supports native function tools only and does not extend to MCP server tools.

How it compares

Mid-conversation prompt changes across API architectures
Feature Gemini API (Interactions API) Standard Chat APIs (OpenAI / Anthropic)
Mid-chat system rules Authoritative system_input step appended mid-turn Static prefix; edits break prefix caching
Tool swapping added_tools and removed_tools without cache loss Modifying tool schema invalidates prompt cache
Cache preservation Retains preceding conversation tokens in cache Cache invalidates from the modified token onward

What it means for you

If you build custom AI apps or agents

You can enforce strict state transitions and gate sensitive actions without paying to re-read conversation histories.

Do this: Refactor your agent turn loops to use previous_interaction_id and system_input instead of bloating user prompts.

If you manage customer support software

Bots can safely restrict refund tools after verification steps expire without crashing response speeds.

Do this: Map out your support escalation pathways to swap function tools dynamically.

Who should care (and who can skip it)

Worth your time if you…

  • You develop multi-turn agents that need evolving permissions
  • Your API bills suffer from cache invalidation during state changes
  • You run workloads on Gemini 4 models via the Interactions API

You can skip it if you…

  • You only use consumer chat interfaces like ChatGPT or Gemini web
  • Your multi-agent setups rely entirely on MCP server tools
  • Your workflows consist of single-turn question-and-answer prompts

How to get ready to use mid-conversation instructions

  1. Switch to the Interactions API Access the Gemini API v1beta endpoint or Google Cloud Vertex AI to enable Interactions API features.
  2. Keep the top-level prompt frozen Ensure your top-level system_instruction and base tools list remain unchanged across turns to protect your prompt cache prefix.
  3. Link turns with previous_interaction_id Pass the preceding turn ID to maintain the conversation thread and preserve previous cached context.
  4. Inject system_input before user_input Place your new instructions, added_tools, or removed_tools into the system_input step directly ahead of the incoming user query.

A structured prompt pattern to manage mode-specific AI behavior while keeping boundaries clean.

Prompt to try
You are a customer service assistant for [COMPANY NAME]. Current mode: [MODE, E.G., GENERAL INQUIRY / VERIFIED REFUND]. Rules for this mode: [LIST 2-3 MODE-SPECIFIC POLICIES]. If the user asks for actions outside this mode, politely explain that they must first [REQUIRED ACTION, E.G., VERIFY IDENTITY] before you can proceed.

Open in

When removing a function tool, pair it with a brief explanatory text note inside system_input so the model can explain to users why that specific action is currently unavailable.

Assuming new instructions wipe out old ones automatically; you must explicitly instruct the model to disregard previous rules when reversing prior instructions.

What to watch next

  • Gemini Enterprise Agent Platform rollout Google announced support is coming soon, expanding these dynamic capabilities to enterprise workspaces.
  • General Availability (GA) announcement Transitioning out of public preview will confirm final production stability and service level agreements.

Our take

This update fixes a genuine pain point for developers building complex AI agents by separating dynamic session rules from static prompt prefixes. If you run simple one-shot prompts or consumer chatbots, it will not change your daily routine, but it makes multi-turn agents far cheaper and more reliable to maintain.

Audit your multi-turn agent workflows to identify where you alter system prompts or tools, and test swapping them to mid-turn system_input.

Your next step

  • Free toolToken & Cost Calculator

    Calculate how preserving prompt cache discounts impacts your overall API expenses.

  • GuideAI models guide

    Compare Gemini 4 model capabilities against competing options for agent builds.

  • Prompt hubAI Engineering prompts

    Find tailored prompts and workflows for orchestrating multi-turn system inputs.

Questions people ask

What are Gemini API mid-conversation instructions?

Mid-conversation instructions are authoritative system prompts added during an active session in the Gemini API. Delivered via the Interactions API, they update rules and function tools without invalidating the cached conversation prefix.

Does updating system instructions mid-turn break prompt caching?

No, updating instructions using the mid-turn system_input step preserves prompt caching. Because the update appends to the conversation boundary, all preceding turns remain cached at lower input token rates.

Do mid-conversation updates work with MCP server tools?

No, mid-conversation tool updates do not currently support MCP server tools. Google supports dynamic swapping exclusively for native function tools using the added_tools and removed_tools parameters.

How much do mid-conversation instructions cost?

There is no separate feature fee for using mid-conversation instructions. Tokens in system_input steps bill at standard Gemini input rates, while previous conversation turns remain eligible for cached token discounts.

Sources

  1. blog.google – Mid-conversation system instructions in the Gemini APIUsed for: Interactions API launch, system_input usage, and caching preservation mechanicsOfficial
  2. unite.aiUsed for: Public preview availability and tool replacement mechanicsReport
  3. blog.googleUsed for: Instruction conflict resolution, Gemini 4 model support, and auditing featuresOfficial

Sources checked . We update this story when details change.

Written with AI assistance from the sources above and checked against them before publishing. Spotted an error? Tell us and we will fix it.