explainx.ai350K+ learn from us
TrendingAI News TodayExplainx for Business
Pricing
explainx.ai

Upskill in AI — 16 free pathways, live workshops & bootcamps, and 50+ courses from practitioners. Plus the skills, tools, and MCP servers to practice on.

follow us

follow on google

Add explainx.ai as a preferred source

corporate training

support@explainx.ai

get started

Find your pathTake Free Evaluation

community

Join the community

learn

mind: share how you thinkpathways — start freeworkshopsbootcampscoursescompare Explainxcertificationsmock testsexplainx universitycorporate traininglearn skills & mcp

discover

skillsmcp serversexplainx mcpestacktoolsmdx readeragentsllmsdesignsdictionarypeopleagi trackerfelony benchranks

company

aboutvisionmissionteaminstructorsteach on explainxpartnershipscommunityhackathonscareers

content

daily AI newsstate of AI — live resultsblogreleasespromptsgeneratorsresource libraryfor LLMsexplainx.ai kids

solutions

all solutionsdeveloper upskillingmarketing upskillingproduct manager upskillingleadership upskilling

newsletter · weekly

Get AI news, tools, and insights in your inbox.

supportcontactprivacytermsdata rightshow we create contentsubmission guidelines

© 2026 AISOLO Technologies Pvt Ltd

explainx.ai

On this page

  • TL;DR: Mid-conversation Gemini controls
  • Why agents needed a first-class mid-turn control
  • How system_input works in the Interactions API
  • Mid-conversation tool updates: added_tools and removed_tools
  • Security and backend responsibilities
  • Use cases Google highlights
  • Pricing, models, and how to try it
  • What developers should watch next
  • Compared with the old workarounds
  • Minimal Python pattern (from Google's sample)
  • What people are asking on developer forums
  • Cost modeling checklist
  • Governance notes for regulated teams
  • Related reading
← Back to blog

explainx / blog

Gemini API Mid-Conversation Instructions: system_input Without Breaking Cache

Gemini, Google DeepMind, AI Agents, Developer Tools, Prompt Caching

Part of Google Gemini and DeepMind

Google added mid-conversation system_input steps to the Gemini Interactions API preview. Change rules and tools mid-session while keeping the prompt cache warm.

Dec 3, 2026·9 min read·Yash Thakker
add explainx.ai
go deep
Gemini API Mid-Conversation Instructions: system_input Without Breaking Cache

Google added mid-conversation system instructions to the Gemini API on December 3, 2026. In preview on the Interactions API, you can send a system_input step before user_input on any turn, update policy text, and add or remove function tools while keeping the prompt cache on prior turns. Product managers Trey Nguyen and Daniel Kyme published the details on Google's developer blog.

Catch up on AI

One AI story explained in plain English, plus one thing to try. Every day, free. Unsubscribe anytime.

350K+ Students Already Joined

TL;DR: Mid-conversation Gemini controls

table · 2 cols
QuestionAnswer
What shipped?system_input steps in Interactions API preview
API surfacegoogle.genai Interactions API, api_version v1beta
ModelsAll Gemini 4 models listed in the announcement
Cache behaviorTop-level system_instruction stays fixed; prior tokens reuse cache
Tool changesadded_tools / removed_tools inside system_input, not top-level tools
PricingNo separate fee; system_input tokens at normal input rates
SecurityBackend must still authorize every function call

Why agents needed a first-class mid-turn control

Long-running agents routinely hit permission flips: a user finishes SSO, a billing review flag appears, or a downstream service goes offline. Until this release, Gemini developers faced an awkward trade-off documented in Google's post.

Putting new rules in a user message keeps the cache warm, but those lines compete with real user text and users can mimic them. Rewriting the global system instruction or the tools array invalidates the prompt cache, forcing the model to reprocess the full transcript. That shows up as latency and cost on threads that already span dozens of turns, the same pressure we described when Tool Retrieval shipped to shrink tool schemas.

system_input is Google's orchestration-layer answer: append authoritative instructions at a turn boundary without mutating the cached prefix.

Cached prompt slots with a fresh policy line at the latest turnCached prompt slots with a fresh policy line at the latest turn Illustration: mid-turn policy appended without rewriting the cached prefix.

How system_input works in the Interactions API

The pattern has four moving parts:

  1. Keep a stable top-level system_instruction string on every interactions.create call.
  2. Pass previous_interaction_id from the prior turn so the thread stays linked (see the Interactions API overview).
  3. In the input array, place system_input immediately before user_input on the turn where policy changes.
  4. Put updated text inside system_input.content as structured parts (type text in Google's Python example).

Google's infrastructure example is instructive. Turn one asks about latency spikes with a plain troubleshooting persona. Turn two injects:

text
A production deployment freeze is now active. Recommend read-only diagnostics and do not allow further rollouts.

The model then refuses a deploy command while suggesting read-only checks, showing that newer system_input wins when instructions conflict.

When you fetch the interaction with client.interactions.get, steps appear in order: system_input, user_input, model_output. That trace is your audit log for compliance reviews, similar to how tool-search steps appear in the Tool Retrieval announcement.

Conflict resolution and persistence

Google states that each system_input stays active for the rest of the session alongside the top-level instruction. Non-conflicting rules accumulate. When two instructions collide, the most recent system_input takes precedence. You may send one system_input per turn, directly before user_input, mixing text, tool updates, or both.

Because system_input appends at the current turn boundary, all preceding tokens remain identical and remain eligible for cached-token pricing on supported models.

Mid-conversation tool updates: added_tools and removed_tools

Permission boundary on an agent tool beltPermission boundary on an agent tool belt Illustration: enable or retire functions mid-session while the base tool schema stays fixed.

Function tool declarations live at the start of the prompt. Swapping the top-level tools list between turns breaks cache, so Google recommends:

  • Define a superset of tools at the top level on every turn (same list each time).
  • Use system_input.removed_tools and system_input.added_tools to change what the model may call.

The support-agent example in Google's post starts with get_store_hours and issue_refund. On a later turn, issue_refund is removed and create_escalation_ticket is added while the top-level tools array is unchanged. Tool updates persist until a later system_input changes them. If both add and remove appear in one step, the API processes removals before additions, enabling in-place replacements.

Limitation called out in the announcement: only function tools support add/remove through system_input today, not MCP server tools. Teams wiring MCP hosts should still plan separate connection management and treat system_input as policy text plus function allowlists.

Security and backend responsibilities

Google repeats a line agent builders should tattoo on every README: system_input, added_tools, and removed_tools steer the model. They are not authorization. Your server must approve every function execution, and you must keep untrusted content (user paste, web fetches, ticket bodies) out of system_input fields attackers could influence.

That matches the broader pattern in agent harness security: the model's plan is not the security boundary.

Use cases Google highlights

The announcement groups six scenarios worth mapping to product backlogs:

table · 2 cols
ScenarioWhat changes mid-session
Session-dependent constraintsWorkspace settings, entitlements, spend caps
Long-horizon reinforcementRe-state tone or formatting deep in a thread
Dynamic permissionsEnable write tools after auth, strip them after
Live operationsDisable call center tools when a dependency is down
Large tool catalogsStart minimal, add tools as the task narrows
Compliance freezesFlip read-only modes without new threads

Each maps to real orchestration rather than prompt hacks, which is why this release pairs naturally with November's Tool Retrieval work: defer rarely used schemas, then activate subsets through added_tools when the user reaches the right workflow stage.

Pricing, models, and how to try it

Google says mid-conversation instructions have no separate SKU. Bill system_input tokens at the model's standard input rate. Earlier turns can still hit cached-token rates when the prefix is unchanged.

Availability: public preview on all Gemini 4 models in the Interactions API via the v1beta endpoint. Gemini Enterprise Agent Platform support is coming soon per the post.

To experiment locally:

  1. Install the current google-genai client shown in Google's samples.
  2. Create a two-turn thread with previous_interaction_id.
  3. Log interactions.get step arrays to verify ordering.
  4. Measure input tokens with and without mid-turn policy changes to confirm cache hits on your project.

For production planning, read Google's doc alongside managed agents and credentials patterns if your deployment already stores per-user tool access.

What developers should watch next

Three open questions remain after launch day:

  1. MCP parity — when server tools can be added or removed mid-thread without cache busting.
  2. Enterprise Agent Platform — whether hosted agents expose the same step trace for auditors.
  3. Cross-provider portability — whether you can mirror the pattern on multi-harness workspaces that are not Gemini-native.

None of those gaps diminish today's release for Gemini-first agent teams. They clarify where portability work still lives.

Compared with the old workarounds

Google's post names two patterns teams already used. The table states what changes with system_input.

table · 4 cols
ApproachCache impactPolicy authorityUser spoofing risk
Fake "system" rules in user_inputPrior turns usually stay cachedLow — reads like user textHigh — users can paste similar instructions
Rewrite top-level system_instructionCache miss — full history reprocessedHighLow
Append system_input before user_inputPrior turns stay cache-eligibleHigh — same class as system promptLow for that step; still protect server execution

If you are migrating from user-message hacks, move immutable persona text into the stable top-level system_instruction, and move session state (freeze flags, entitlement tiers, temporary tool bans) into system_input.

Minimal Python pattern (from Google's sample)

Google's published flow uses google.genai with api_version v1beta. The structure below mirrors the announcement; adjust model IDs to your project allowlist.

python
from google import genai

client = genai.Client(http_options={"api_version": "v1beta"})
system_instruction = "You are an infrastructure troubleshooting assistant."

turn1 = client.interactions.create(
    model="gemini-4-neon",
    system_instruction=system_instruction,
    input="Latency just spiked on our service. What should I check first?",
)

turn2 = client.interactions.create(
    model="gemini-4-neon",
    previous_interaction_id=turn1.id,
    system_instruction=system_instruction,
    input=[
        {
            "type": "system_input",
            "content": [
                {
                    "type": "text",
                    "text": (
                        "A production deployment freeze is now active. "
                        "Recommend read-only diagnostics and do not allow further rollouts."
                    ),
                }
            ],
        },
        {
            "type": "user_input",
            "content": [
                {"type": "text", "text": "Give me the command to deploy a new release."}
            ],
        },
    ],
)

After turn two, call client.interactions.get(id=turn2.id) and inspect the steps array. You should see system_input precede user_input, which precede model_output. That ordering is what compliance reviewers will ask for when agents touch production systems.

What people are asking on developer forums

Does this replace a state machine outside the model? No. You still need application state for auth, billing, and infrastructure health. system_input is how you inform the model after state changes; it does not persist data or enforce network ACLs.

Can I stack multiple system_input steps on one turn? Google allows one system_input per turn, placed directly before user_input. Batch policy lines into that single step.

Will users see system_input text in the chat UI? That depends on your client. The Interactions API stores the step in the server-side trace. If you mirror steps into a visible transcript, treat system_input like internal operator notes unless product policy says otherwise.

How does this interact with Gemini Live or voice agents? This announcement targets the Interactions API text/agent loop. Voice stacks may need separate handling until Google documents parity.

Cost modeling checklist

Before rolling to production, instrument four counters on a staging thread of at least fifty turns:

  1. Input tokens on turns without system_input.
  2. Input tokens on turns with system_input (policy-only).
  3. Cached-token counts reported by the API on turn n+1 after a policy change on turn n.
  4. Latency p95 with and without mid-turn tool add/remove.

Compare against a baseline where you rewrote the system prompt each turn. Teams who already optimized Claude Code cache windows should expect similar economics: the win is avoiding repeated prefix work, not free tokens on the new instruction itself.

Governance notes for regulated teams

Financial services and health workflows often require immutable audit logs when an agent's permissions change. The interactions.get step list gives you a machine-readable sequence to archive. Pair it with your own authorization log whenever added_tools enables a sensitive function such as refunds or chart updates.

If your org runs corporate AI training on Gemini, add a lab exercise: students trigger a deployment freeze via system_input and verify the model refuses a write tool until the freeze is cleared. Hands-on policy drills beat slide-only compliance training.

Related reading

  • Gemini API Tool Retrieval · defer_loading and tool_search
  • Claude Code prompt cache sessions
  • OpenAI prompt caching limits
  • Google Gemini managed agents
  • MCP protocol guide
  • Soduwork multi-harness workspace
  • Together AI prefix cache for agents

Specifications follow Google's December 3, 2026 announcement and may change while the feature remains in preview.

Spotted something out of date? Let us know.
Daily briefFrom Yash · 350K+ students taught

Catch up on AI

One AI story explained in plain English, plus one thing to try. Every day, free. Unsubscribe anytime.

  • ✓ Free
  • ✓ One email a day, no spam
  • ✓ Unsubscribe anytime
Yash Thakker

Written by

Yash Thakker

Yash is an AI expert with over 300K learners. Join his workshops →

View Yash Thakker in People in AI →

Share

Gemini
Workshops

Learn by building

Live, hands-on workshops on Claude, agents, and AI tooling — taught by practitioners, not slides.

Explore workshops →

Related posts

Nov 19, 2026

Gemini API Tool Retrieval: Defer Loading and tool_search Explained

Google DeepMind launched Tool Retrieval in preview for the Gemini Interactions API. Agents keep a large tool library on standby and load a tool schema only when a task needs it. Here is how it works, what it costs, and what is still unmeasured.

Nov 28, 2026

Claude ML Sabotage Claims: Astropulse Neon Audit vs Anthropic

After Pietro Schirano's November 24 sabotage meme and Astropulse's November 27 Retro Diffusion training thread, Anthropic staffer Edwin Arbus denied serving-time degradation and asked for session IDs. Drew Breunig's November 27 essay argues proactive agents feel like sabotage without reproducible malice traces.

Nov 25, 2026

DeepMind Agents Control Part of Gemini Training Compute, Kavukcuoglu Says

Google DeepMind research chief Koray Kavukcuoglu told the company podcast that AI agents already control a percentage of compute used to train the next Gemini generation, while a full recursive self-improvement loop remains distant.