Google Introduces Mid-Conversation Instructions in Gemini API

Google has launched a new feature in the Gemini API that allows developers to update system instructions and tools during an ongoing conversation without losing the prompt cache. This capability, available in preview through the Interactions API, enables agents to adapt to changing rules and tools without incurring additional costs or latency associated with reprocessing the entire conversation history.

Orin CodewellTools & Coding

1 min read1 source

Key takeaways

30-second read
  1. 1Developers can now implement more dynamic and responsive conversational agents that adapt to user needs in real-time, improving user experience.
  2. 2The ability to change instructions mid-conversation allows for more complex interactions, such as adjusting permissions or tools based on user actions or context.
  3. 3This feature reduces operational costs by maintaining the prompt cache, which is crucial for applications with long-running conversations. Developers can avoid unnecessary reprocessing of conversation history.
  • Confirmed

    Official source: Google AI Blog

  • Reported

    No secondary reporting linked

  • Verify yourself

    Eligibility, local prices and dates for your car, state or utility

Google Introduces Mid-Conversation Instructions in Gemini API

Google has introduced a significant update to the Gemini API, enabling developers to modify system instructions and tools mid-conversation without invalidating the prompt cache. This feature, available in preview through the Interactions API, allows for more adaptive and efficient conversational agents that can respond to changing contexts and user needs without the drawbacks of reprocessing previous interactions.

Key Features of the Update

Previously, developers faced limitations when attempting to update system instructions or tools during a conversation. They had to either embed new instructions within user messages, which lacked the authority of top-level instructions, or rewrite the entire system instruction, leading to increased costs and latency due to cache invalidation. With the new system_input step, developers can now send updates directly at any turn, maintaining the integrity of the conversation history.

The system_input step can be used to append new instructions or tool updates while keeping the top-level system_instruction unchanged. This means that developers can reinforce rules or alter tool availability based on the evolving context of the conversation. For example, a support agent can remove a tool like 'issue_refund' and add 'create_escalation_ticket' without breaking the prompt cache, ensuring a seamless user experience.

Practical Implications for Developers

This update is particularly beneficial for developers working on applications that require long-running interactions, such as customer support or virtual assistants. By allowing for dynamic updates, developers can implement session-dependent constraints, such as adjusting permissions based on user authentication or changing operational guidance in response to real-time events. Additionally, the feature supports a more efficient use of resources by reducing the need for costly reprocessing of conversation history.

As this feature is currently in public preview across all Gemini 4 models via the v1beta endpoint, developers are encouraged to explore the documentation and begin integrating these capabilities into their applications. This advancement represents a significant step forward in creating more intelligent and responsive AI-driven interactions.

0 people like this

Share this story

Gemini APIGoogleAI DevelopmentConversational AgentsAPI Updates

Sources

1 official
  1. [1]
    Introducing mid-conversation instructions in the Gemini API

    Google AI Blog · blog.google · published Dec 3

    Official
This brief was drafted with AI and published automatically after checks on its sources and content; an editor has not reviewed it. Articles are expected to link back to source material. Read our editorial standards or contact us with corrections at [email protected].

Newsletter

Weekly AI signal. No spam.

Comments

Sign in to join the discussion

Loading comments…