Who this is for
This guide is for developers building multi-turn chat applications on the Gemini API who need to change rules or tools in the middle of a session. By the end you should be able to send a request with a system_input step and know which mistakes return HTTP 400.
What mid-conversation instructions are
Mid-conversation system instructions are in preview. They require the v1beta API version, and the API surface may change before general availability[1].
In long conversations, rules and available tools often change after the first turn. Editing the initial system instructions or tool list forces the model to reprocess the whole conversation history[1]. On the Interactions API, a system_input step appends new rules or tool updates and keeps earlier turns cached[1].
Typical uses include reinforcing a rule late in a long session, adding a constraint learned mid-session such as a budget cap or a jurisdiction rule, and enabling or disabling function tools when a feature is paused or a user completes OAuth[1].
Sending an instruction mid-conversation
To send an instruction, pass the previous turn's ID in previous_interaction_id. Place a system_input step directly before the user_input step in the input array[1]. The first turn starts the conversation:
from google import genai
client = genai.Client(http_options={"api_version": "v1beta"})
first = client.interactions.create(
model="gemini-4-hydrogen",
input="Hi, I'd like some help with my account.",
)The second turn carries the rule in system_input, followed by the user's question[1]:
interaction = client.interactions.create(
model="gemini-4-hydrogen",
previous_interaction_id=first.id,
input=[
{
"type": "system_input",
"content": [
{
"type": "text",
"text": "The user is in California. Show the CCPA disclosure before sharing any address data.",
}
],
},
{
"type": "user_input",
"content": [
{"type": "text", "text": "Can you show me all stored addresses on my account?"}
],
},
],
)Each system_input becomes its own step in the history. It does not replace or delete earlier instructions[1]. The top-level system_instruction and every earlier system_input remain in context for the rest of the conversation[1].
If a new instruction conflicts with an older one, the model favors the most recent instruction. Older instructions stay in context, so the new one should say what changed, for example that refunds are available again and the earlier pause should be ignored[1].
Request rules and common errors
If a request breaks any of these rules, the API returns HTTP 400[1]:
- Send at most one
system_inputper turn, directly before auser_inputstep[1]. - Do not send
system_inputon its own, and do not send it during a function-calling loop, such as when returning afunction_resultstep[1]. - Send text only in
content, and include text incontentunless the step adds or removes tools[1].
Adding and removing tools mid-conversation
Tool definitions sit at the start of the prompt. Changing the tools list between turns invalidates the prompt cache[1]. Instead, send the same tools list on every turn, and use added_tools and removed_tools on a system_input step to change which functions the model can call[1].
These two fields support only custom function tools. MCP servers and built-in tools such as Google Search or code execution are not supported yet[1]. Each removed_tools entry is an object such as {"type": "function", "name": "issue_refund"}, not a bare string. Each added_tools entry is a full function definition using the same schema as entries in tools[1].
When one step includes both fields, the API processes removed_tools first and then added_tools[1]. Tool changes stay in effect until another system_input changes them[1].
A few details are easy to get wrong:
- In a
previous_interaction_idchain, keep passing the top-leveltoolslist on every turn, including tools you removed. Stored history is validated against each request'stoolslist, so dropping a removed tool causes HTTP 400 on later turns[1]. - Do not re-declare a tool added with
added_toolsin the top-leveltoolslist on later turns. Doing so returns HTTP 400[1]. - When removing a tool, add a short text note so the model can explain why the action is unavailable[1].
Inspecting and limits
When you retrieve an interaction, the system_input step appears in order with the other steps, including any added_tools and removed_tools[1]. The response lists the system_input step first, then the user turn, then the model's reply[1].
The limits are as follows:
- Only
gemini-4-carbon,gemini-4-neonandgemini-4-hydrogensupportsystem_input. Other models return HTTP 400[1]. - It works only on the Interactions API (
v1beta). ThegenerateContentmethod does not support it[1]. - It works only on model interactions. Agent interactions are not supported[1].
- Each
system_inputstays in context for the rest of the conversation and cannot be removed[1]. - The
tool_choicesetting applies only to tools in the initialtoolslist. The model can still call tools added mid-conversation withadded_tools[1].
Practical advice
Keep baseline behavior in system_instruction, and reserve system_input for rule or tool changes that happen mid-session[1]. To reverse an earlier system_input, tell the model to ignore the earlier rule, because prior steps stay in context[1].
Next steps
Confirm your model is on the supported list, then call the Interactions API with v1beta. The feature is still in preview, so check the official documentation before relying on it in production[1].
Sources
- 1Mid-conversation system instructionsGoogle AI for Developers
Cite this page: Updating instructions and tools mid-conversation in the Gemini API. TellWorld, https://www.tellworld.net/practice/practice-gemini-mid-conversation-instructions. Updated 2026-12-04