Google just fixed one of the most annoying trade-offs in long-running agents — and the fix is so obvious it makes you wonder why it took this long.
Until now, changing an agent's instructions mid-conversation meant choosing your poison: stuff the new rule into a user message and watch users learn to imitate it, or rewrite the system prompt and blow up your entire prompt cache, reprocessing hundreds of turns at full price. Google's new system_input step for the Gemini API kills that trade-off. New rules land with system-level authority, the cache survives, and the session keeps going.
The old choice was rigged
- User-message injection preserved the cache, but it was a security smell. A rule that lives in a user message carries no more weight than anything the user types — and teaches users exactly how to spoof it.
- Rewriting the system prompt was honest but ruinous. Full authority, zero cache. Every long session paid the reprocessing tax the moment reality changed — a spending limit hit, a service went down, an entitlement changed.
- Both workarounds punished the exact sessions that matter most: the long, expensive, multi-hundred-turn ones.
What system_input actually does
- It appends a step at the current turn boundary, carrying an instruction change, a tool change, or both — with the same authority as the top-level system instruction and precedence over user messages.
- Because it appends rather than rewrites the prompt prefix, earlier turns keep their cached status. The top-level instruction stays untouched; that's the whole trick.
- Each step stays active for the rest of the session, newer instructions win on conflict, and only one
system_inputper turn, directly beforeuser_input. The trace shows exactly which rule was in force at which turn — which is the audit trail long-running agents have been missing.
Tools can be revoked mid-session — and that's the interesting half
- Keep the top-level tools list identical and use
added_tools/removed_toolson the step. Google's example: a support agent losesissue_refundand gainscreate_escalation_ticketthe moment an account goes under billing review. - Pair it with a one-line explanation and the model tells the user why refunds are paused instead of stonewalling them. Small detail, big difference in how the refusal lands.
- But don't mistake this for a security boundary: Google is explicit that removing a tool stops the model calling it, it does not replace backend authorisation. Enforce every function call server-side anyway.
The fine print worth reading
- Preview only, via the Interactions API on all Gemini 4 models through v1beta. Enterprise Agent Platform support is "coming soon" — don't assume it's there.
- MCP server tools can't be updated this way yet; function tools only. No separate fee, but "eligible for cached-token rates" is eligibility, not a guaranteed saving.
- And the guardrail that matters most: never put untrusted content in
system_input. It carries system-level authority, so anything in it is treated as an instruction from the application. User content belongs in user content.
Go deeper
Read the full breakdown — the code examples, the five patterns Google lists, and the pricing and guardrails in detail — on Agentic Affairs: Google's Gemini API now lets agents change instructions mid-conversation without losing the cache
Originally published on Agentic Affairs (https://agentic-affairs.com)