Skip to content
Codingmedium signalverified

Gemini API lets agents change system instructions and tools mid-conversation without losing the prompt cache

Google's Gemini API can now take new system instructions and tool changes partway through a conversation, through a new step type in the Interactions API. Until now, changing either one invalidated the prompt cache, so the model reprocessed the entire history at extra cost and with extra latency. The new step has the same authority as the original system instruction, and earlier turns stay cached. The feature is in public preview for all Gemini 4 models, has no separate fee, and does not yet cover tools from MCP servers.

By Redakcija WebAiRadarPublished 3 min readwritten by a model
Image: Google

Google has added a way to change an agent's rules partway through a conversation without paying to reprocess everything that came before. Since December 3, 2026, the Interactions API in the Gemini API accepts a system_input step at any turn, carrying a new system instruction, tool changes, or both. The feature is in public preview for all Gemini 4 models through the v1beta endpoint.

The problem it solves

A system instruction is the set of rules a developer gives the model up front, and it outranks what users type. The prompt cache lets the API reuse the part of a conversation the model has already processed, billed at the lower cached-token rate. Until now, changing the system instruction or the list of tools invalidated that cache, and the model had to reprocess the whole conversation history. Google says this added both cost and latency.

Developers worked around it by sending the new rule as a user message, which kept the cache intact. According to Google, such a message does not carry the weight of a system instruction, and users can try to imitate it.

How the new step works

With each new request, the developer passes the ID of the previous turn in previous_interaction_id and places a system_input step directly before the user_input step. One such step is allowed per turn. The model treats it with the same authority as the top-level system instruction, so the new rule takes precedence over user messages. The top-level system_instruction has to stay unchanged, because only then does the start of the prompt still match the cache.

Each system_input stays active for the rest of the session. Rules on different topics apply together, and when a newer rule conflicts with an earlier one, the model favors the most recent. When a stored conversation is retrieved, the system_input steps appear in order next to user input and model output, which makes an agent's run easier to audit.

Tools change the same way. Google recommends keeping the top-level tool list identical on every request and adding or removing callable functions through added_tools and removed_tools. Removals are processed before additions, so a tool definition can be replaced in a single step. For now this works only for function tools, not for tools that come from servers using the Model Context Protocol (MCP), the standard for connecting models to outside tools.

In Google's example, a support agent handling an account under billing review loses its refund tool and gains a tool for escalating the case.

Price and limits

Google charges no separate fee for the feature. Tokens in a system_input step are billed at the model's standard input rate, and earlier turns remain eligible for cached-token rates. The company says support for Gemini Enterprise Agent Platform is coming soon, without giving a date.

Google also warns that system_input, added_tools, and removed_tools only steer the model. It advises that the application still authorize every function call on its own backend before running it, and that untrusted external content and end-user content stay out of system_input.

BrandsGemini

Once a week, in your inbox

The whole week's news, gathered into one email. No ads, no passing your address on, one-click unsubscribe.

The address is used only for this roundup. It is not sold and not passed to anyone.

Related

Codingmedium signal

GitHub Copilot code review can now flag vulnerable dependencies and unusual licenses

GitHub added two optional scans to Copilot code review on December 3, 2026. When a pull request adds or updates a package, Copilot can comment on known vulnerabilities and on licenses outside a common open source set. Both scans are in public preview, are off by default, and count toward the AI credits a review uses. GitHub also added 17 connectors to Copilot and made server-to-server authentication generally available.

GitHubverified

NEXT.JS 16.54.2×faster cold compile in Vercel's own benchmark
Codingmedium signal

Next.js 16.5 compiles about four times faster in Vercel's benchmark and adds experimental Go routes

Next.js 16.5, released on December 2, 2026, cut cold compile time for Vercel's dashboard from 183 to 44 seconds in the company's own benchmark. Cached functions can now keep their entries across deployments, and a coding agent can upgrade an app on a schedule from GitHub Actions. Go route handlers and a Go-based production server arrive as experiments. The security fixes due on December 15 will ship only on the 16.5.x line.

Next.js Blogverified

GITHUB ACTIONSBlockedpull_request_target in public repositories sin
Codingmedium signal

GitHub Actions now blocks pull_request_target workflows by default in public repositories

Since December 2, 2026, GitHub Actions has blocked workflows triggered by pull_request_target in affected public repositories, unless an event policy explicitly allows them. The trigger runs with the base repository's secrets, so code from a fork can expose them or compromise the build pipeline. Private and internal repositories are not affected, and GitHub Enterprise Server is outside the change. Maintainers who still need the trigger have to allow it explicitly, and can limit the exception to specific workflow files.

GitHubverified