Interactions API: a unified interface for Gemini models and agents
Google’s Interactions API provides a unified interface for Gemini models and agents, with server-side state, background execution, tool combination and multimodal generation.
A useful first decision when building a Gemini application is where conversation history should live. Google’s Interactions API lets an application create a turn, receive an interaction ID and use that ID to continue the conversation. The same interface also supports tasks with models and managed agents. This guide walks through the choices a developer should make before adding it to an application.
Start with a two-turn conversation
Install Google’s current Python SDK, configure a Gemini API key for the SDK, and choose a model available to your account. This example asks a follow-up question by linking the second request to the first. It prints both answers so you can inspect the result; it does not claim to measure accuracy or cost.
from google import genai
client = genai.Client()
first = client.interactions.create(
model="gemini-3.6-flash",
input="Suggest a name for a small garden shop.",
)
print(first.output_text)
second = client.interactions.create(
model="gemini-3.6-flash",
input="Give me a short slogan for that name.",
previous_interaction_id=first.id,
)
print(second.output_text)
Consult the current Interactions documentation for SDK setup, supported models and the latest request format. The model ID in an example is a choice, not a promise that it will remain available indefinitely.
Decide whether to store the interaction
By default, Google stores interactions so that an application can refer to earlier turns using previous_interaction_id. If the application must keep history itself, store=false opts out of storage. Google states that this option cannot be combined with background execution or used to continue that interaction through previous_interaction_id.
On Google’s paid tier, stored interactions are retained for up to 55 days by default; a shorter period can be configured. Review the provider’s current storage and retention details and your data requirements before sending sensitive content.
Treat a background task as a separate workflow
Long-running tasks may use background=true. Your application should keep the returned interaction ID, check the task’s status, and handle completion or failure before presenting a result. See Google’s background execution guide for the current polling and streaming patterns. Do not treat a started task as a completed answer.
Add tools only when the task needs them
Tools can extend a model’s work, for example by letting it search or call a function supplied by your application. Check the function-calling documentation and the selected model’s supported features before combining tools. If your code executes a function, validate its arguments and handle errors in your application. Access to one model does not establish that every tool is supported by it.
Check costs and operational limits
Select a model and service tier for the actual workload, then consult Google’s current pricing and rate limits. Keep separate records for each request and any background task so that failures, retries and changes in usage can be examined. A server-managed conversation may simplify history handling, but it does not remove the need to assess token use, retention and application behaviour.
Google described the API’s general availability in its Interactions API announcement; the documentation linked above is the reference for current behaviour.
Explore Gemini API access through Ailoot. Ailoot issues one API key for 1,284 models and variants across 15 categories, making it one of the world’s largest AI routers by model count. The catalogue covers text with GPT or Claude, images with FLUX, video with Kling, voice with Eleven v4, music with Suno, 3D assets with Tripo3D and ranking with Cohere Rerank.
Put Gemini 4 Hydrogen or Gemini 4 Argon to work on reasoning, code and documents with Ailoot. The same account also gives you Nano Banana 2.1 for images and Veo 3.1 for video.
Ailoot Arena gives your team a place to compare Gemini with other leading models.
Use new flagship models from day one on the same Ailoot balance. One subscription covers the full catalogue. Subscriptions and promo codes can bring model costs down by up to 50% compared with official provider API prices. Open your account at https://ailoot.ai/ or request a code from the team.
Originally published on the Ailoot technical blog.