# 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.

Source: https://ailoot.ai/blog/en/gemini-interactions-api/
Canonical: https://ailoot.ai/blog/en/gemini-interactions-api/
Language: en
Publisher: Ailoot (https://ailoot.ai/)
Translation: guide-100357
Revision: sha256-ef2074d047cd41cc1e8e2a430ccc4f8f50ba75cd5628b55bab5f83ba5cdacb8b


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.

```python
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](https://ai.google.dev/gemini-api/docs/interactions) 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](https://ai.google.dev/gemini-api/docs/interactions#data-storage-retention) 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](https://ai.google.dev/gemini-api/docs/background-execution) 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](https://ai.google.dev/gemini-api/docs/function-calling) 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](https://blog.google/innovation-and-ai/technology/developers-tools/interactions-api-general-availability/); the documentation linked above is the reference for current behaviour.



<!-- ailoot-promo:7245888323ee7a53c9fe77133937f7d9028d9c98bafd195746edd400715add67 -->
<p>Explore <a href="https://ailoot.ai/">Gemini API access through Ailoot</a>. 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.</p>
<p>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.</p>
<p>Ailoot Arena gives your team a place to compare Gemini with other leading models.</p>
<p>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 <a href="https://ailoot.ai/">https://ailoot.ai/</a> or request a code from the team.</p>
<!-- /ailoot-promo -->


## Ailoot · The company and its project portfolio

Ailoot combines established operating experience, a large client base, stable service and ongoing KPI control.

The company and its project portfolio: millions of customers; monthly sales in the billions.

Ailoot brings that operating experience to API access for AI features in customer products, agents, applications and automations.
