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.
TL;DR: Mid-conversation Gemini controls
| Question | Answer |
|---|---|
| What shipped? | system_input steps in Interactions API preview |
| API surface | google.genai Interactions API, api_version v1beta |
| Models | All Gemini 4 models listed in the announcement |
| Cache behavior | Top-level system_instruction stays fixed; prior tokens reuse cache |
| Tool changes | added_tools / removed_tools inside system_input, not top-level tools |
| Pricing | No separate fee; system_input tokens at normal input rates |
| Security | Backend 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 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:
- Keep a stable top-level
system_instructionstring on everyinteractions.createcall. - Pass
previous_interaction_idfrom the prior turn so the thread stays linked (see the Interactions API overview). - In the
inputarray, placesystem_inputimmediately beforeuser_inputon the turn where policy changes. - Put updated text inside
system_input.contentas structured parts (typetextin Google's Python example).
Google's infrastructure example is instructive. Turn one asks about latency spikes with a plain troubleshooting persona. Turn two injects:
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 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_toolsandsystem_input.added_toolsto 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:
| Scenario | What changes mid-session |
|---|---|
| Session-dependent constraints | Workspace settings, entitlements, spend caps |
| Long-horizon reinforcement | Re-state tone or formatting deep in a thread |
| Dynamic permissions | Enable write tools after auth, strip them after |
| Live operations | Disable call center tools when a dependency is down |
| Large tool catalogs | Start minimal, add tools as the task narrows |
| Compliance freezes | Flip 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:
- Install the current
google-genaiclient shown in Google's samples. - Create a two-turn thread with
previous_interaction_id. - Log
interactions.getstep arrays to verify ordering. - 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:
- MCP parity — when server tools can be added or removed mid-thread without cache busting.
- Enterprise Agent Platform — whether hosted agents expose the same step trace for auditors.
- 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.
| Approach | Cache impact | Policy authority | User spoofing risk |
|---|---|---|---|
Fake "system" rules in user_input | Prior turns usually stay cached | Low — reads like user text | High — users can paste similar instructions |
Rewrite top-level system_instruction | Cache miss — full history reprocessed | High | Low |
Append system_input before user_input | Prior turns stay cache-eligible | High — same class as system prompt | Low 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.
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:
- Input tokens on turns without
system_input. - Input tokens on turns with
system_input(policy-only). - Cached-token counts reported by the API on turn n+1 after a policy change on turn n.
- 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.
