gemini-interactions-api
Guides the usage of Gemini Interactions API on Gemini Enterprise Agent Platform
Install / Use
npx skills add google/skills --skill gemini-interactions-apiInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Education & ResearchSupported Platforms
Our assessment of gemini-interactions-api
gemini-interactions-api scores 95/100 on our quality scale, 18th of 152 Education & Research skills we index (top 12%).
Its SKILL.md is 20 KB long, well organised into 50 sections with 21 code examples: a thorough specification that gives an agent plenty to work with.
With 20,340 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 3 days ago, so gemini-interactions-api is actively maintained.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands.
Automated pattern scan on 2026-09-26. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
gemini-interactions-api compared with similar skills
All 4 of these similar skills score higher than gemini-interactions-api; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| gemini-interactions-api (this skill)by google | 95 | 20.3k | 3d ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 85.5k | 11d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 73.8k | today | CLAUDE.md |
| last30days-skillby mvanhorn | 100 | 62.9k | 3d ago | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 83.8k | today | MCP Server |
Frequently asked questions
- How do I install gemini-interactions-api?
- Run
npx skills add google/skills --skill gemini-interactions-api. The install tabs above show the steps for each supported agent. - Which AI agents does gemini-interactions-api work with?
- It is written for Gemini CLI, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is gemini-interactions-api safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. It is Apache-2.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is gemini-interactions-api still maintained?
- The repository was last updated 3 days ago, so gemini-interactions-api is actively maintained.
Skill content
View source on GitHubname: gemini-interactions-api metadata: version: "1.0.0" category: AiAndMachineLearning description: Guides the usage of Gemini Interactions API on Gemini Enterprise Agent Platform. Use when the user wants to use the stateful, server-managed Interactions API for multi-turn conversations, background execution, streaming, structured output, and function calling on the Agent Platform.
Gemini Interactions API Skill
This skill provides instructions for authenticating, connecting to, and utilizing the stateful, server-managed Gemini Interactions API on Gemini Enterprise Agent Platform.
The Interactions API is the modern, recommended way to execute Generative AI agent conversations, background research tasks, multi-turn chats, and structured, multi-step workflows.
[!IMPORTANT] CRITICAL: Unified SDK, Latest Models & GEAP Targeting * Unified SDK: Use the Google Gen AI SDK (
google-genai >= 2.3.0for Python,@google/genai >= 2.3.0for JS/TS). SDK versions>= 2.0.0are the minimum floor at which the steps schema activates, but>= 2.3.0is the supported/recommended floor. Legacy SDKs likegoogle-cloud-aiplatform,@google-cloud/vertexai, andgoogle-generativeaiare strictly unsupported for Interactions. * Mandatory Instruction: When explaining client initialization or writing import code, you must explicitly state/warn the user that legacy packages likegoogle-cloud-aiplatformorgoogle-generativeaiare strictly unsupported for interactions. * Latest Models Only: Usegemini-3.5-flash(fast, balanced, multimodal — the recommended default),gemini-3.1-pro-preview(complex reasoning, coding, research), orgemini-3.1-flash-lite(cost-efficient, high-frequency lightweight tasks). Refer to the latest model versions to check for new updates. Legacy models (gemini-3-flash-preview,gemini-2.5-*,gemini-2.0-*,gemini-1.5-*) are deprecated and do not support interactions. * Mandatory Instruction: In any interaction response, you must warn the user that legacy models likegemini-2.5-*,gemini-2.0-*, orgemini-1.5-*are deprecated and unsupported for the Interactions API. * GEAP requires a provisioned agent (no direct base-model calls yet): On Gemini Enterprise Agent Platform (GEAP), direct/base-model calls (model="...") via the Interactions API are not supported yet. You must target a provisioned agent or endpoint with theagent="<AGENT_ID>"parameter instead ofmodel="...". The code examples in this skill useagent=...for this reason. (This is the primary difference from the ai.google.dev documentation for Interactions, which usesmodel=...— whilemodel=...is valid for other Gemini API contexts, it is not supported on the Agent Platform.) Provision an agent per the Agent Platform docs and pass its ID asagent. * Turn-Scoped Parameters: Parameters liketools,system_instruction, andgeneration_configare turn-scoped. They MUST be passed with each interaction request.
1. Authentication
Before running any code, ensure you are authenticated with Application Default Credentials (ADC) and have the necessary API enabled.
-
Login:
gcloud auth application-default login -
Enable API (if not already enabled):
gcloud services enable aiplatform.googleapis.com
2. Client Initialization
You can initialize the client using environment variables (recommended) or by passing explicit configuration parameters.
Option A: Environment Variables (Recommended)
Configure environment variables to let the SDK automatically resolve settings:
export GOOGLE_GENAI_USE_ENTERPRISE=true
export GOOGLE_CLOUD_PROJECT="your-project-id"
export GOOGLE_CLOUD_LOCATION="global"
Python
from google import genai
# The SDK automatically picks up the environment variables
client = genai.Client()
TypeScript/JavaScript
import { GoogleGenAI } from "@google/genai";
// The SDK automatically picks up the environment variables
const ai = new GoogleGenAI();
Option B: Explicit Inline Parameters
Alternatively, pass configuration values directly inside your code:
Python
from google import genai
import google.auth
_, project_id = google.auth.default()
client = genai.Client(enterprise=True, project=project_id, location="global")
TypeScript/JavaScript
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({
enterprise: {
project: "your-project-id",
location: "global"
}
});
3. Core Interactions API Usage
Quick Start (Single-Turn)
Submit a single prompt and read the final text response. Under the modern schema, output content is retrieved from the steps list.
Python
interaction = client.interactions.create(
agent="your-agent-id", # GEAP: target a provisioned agent, not a base model
input="Explain serverless computing in one sentence."
)
# Use the output_text convenience accessor (combined text from the trailing model_output steps)
print(interaction.output_text)
TypeScript/JavaScript
const interaction = await ai.interactions.create({
agent: "your-agent-id", // GEAP: target a provisioned agent, not a base model
input: "Explain serverless computing in one sentence."
});
console.log(interaction.output_text);
Stateful Conversation (Multi-Turn)
Interactions are stateful by default. Store the conversation state in the cloud and reference it in the subsequent turn using previous_interaction_id.
Python
# Turn 1: Introduce ourselves
# Interactions are stored by default (store=True); pass store=False to disable
# server-side retention (which also disables previous_interaction_id and background).
turn1 = client.interactions.create(
agent="your-agent-id",
input="Hi! My name is John. I am working on AI agents.",
store=True
)
print(f"Turn 1: {turn1.output_text}")
# Turn 2: Refer back to the stored turn state
turn2 = client.interactions.create(
agent="your-agent-id",
input="What is my name?",
previous_interaction_id=turn1.id
)
print(f"Turn 2: {turn2.output_text}")
TypeScript/JavaScript
// Turn 1 (interactions are stored by default; pass store: false to disable)
const turn1 = await ai.interactions.create({
agent: "your-agent-id",
input: "Hi! My name is John. I am working on AI agents.",
store: true
});
// Turn 2
const turn2 = await ai.interactions.create({
agent: "your-agent-id",
input: "What is my name?",
previousInteractionId: turn1.id
});
console.log(turn2.output_text);
Real-Time Streaming
Stream responses in real-time. Passing stream=True returns an iterable chunk generator.
Python
# The stream yields typed events, not full interaction snapshots. The sequence is:
# interaction.created -> (step.start -> step.delta(s) -> step.stop)+ -> interaction.completed
for event in client.interactions.create(
agent="your-agent-id",
input="Write a short poem about debugging.",
stream=True
):
if event.event_type == "step.delta":
if event.delta.type == "text":
print(event.delta.text, end="", flush=True)
elif event.event_type == "interaction.completed":
print()
TypeScript/JavaScript
// The stream yields typed events, not full interaction snapshots. The sequence is:
// interaction.created -> (step.start -> step.delta(s) -> step.stop)+ -> interaction.completed
const responseStream = await ai.interactions.create({
agent: "your-agent-id",
input: "Write a short poem about debugging.",
stream: true
});
for await (const event of responseStream) {
if (event.event_type === "step.delta") {
if (event.delta.type === "text") {
process.stdout.write(event.delta.text);
}
} else if (event.event_type === "interaction.completed") {
console.log();
}
}
Structured Output (Pydantic / Polymorphic response_format)
Retrieve structured, type-safe JSON matching a schema. Under the modern Interactions API, a polymorphic response_format argument directly takes the target schema structure.
Python
from pydantic import BaseModel, Field
class Book(BaseModel):
title: str = Field(description="The title of the book")
author: str = Field(description="The book's author")
year_published: int
interaction = client.interactions.create(
agent="your-agent-id",
input="Recommend one famous sci-fi book.",
response_format=Book
)
# The text will be a valid JSON matching the Book schema
print(interaction.output_text)
TypeScript/JavaScript
import { Type } from "@google/genai";
const BookSchema = {
type: Type.OBJECT,
properties: {
title: { type: Type.STRING, description: "The title of the book" },
author: { type: Type.STRING, description: "The book's author" },
yearPublished: { type: Type.INTEGER }
},
required: ["title", "author", "yearPublished"]
};
const interaction = await ai.interactions.create({
agent: "your-agent-id",
input: "Recommend one famous sci-fi book.",
responseFormat: BookSchema
});
console.log(interaction.output_text);
Function Calling (Agent Tool Use)
Define local tools (functions) and submit execution results to the stateful interaction history.
Python
import json
def get_stock_price(ticker: str) -> float:
"""Gets the stock price for a given ticker symbol."""
if ticker.upper() == "GOOG":
return 175.50
return 100.0
# Turn 1: Pass tools to the model
interaction = client.interactions.create(
agent="your-agent-id",
input="What is the stock price of GOOG?",
tools=[get_stock_price]
)
# In the flat steps schema, a tool request is a top-level step of type
# "function_call" with flat `name` and `arguments` fields (no nested tool_calls).
for step in interaction.steps:
if step.type == "function_call" and step.name == "get_stock_price":
ticker_arg = step.arguments.get("ticker")
price = get_stock_price(ticker_arg)
# Turn 2: Submit the result back as a function_result step. Reference the
# originating call via call_id=step.id, and pass tools again (turn-scoped).
final_turn = client.interactions.create(
agent="your-agent-id",
input=[
{
"type": "function_result",
"name": step.name,
"call_id": step.id,
"result": [{"type": "text", "text": json.dumps(price)}],
}
],
tools=[get_stock_price],
previous_interaction_id=interaction.id
)
print(final_turn.output_text)
TypeScript/JavaScript
import { Type } from "@google/genai";
// Define local tool
function getStockPrice({ ticker }: { ticker: string }): number {
if (ticker.toUpperCase() === "GOOG") {
return 175.50;
}
return 100.00;
}
// Turn 1: Pass tools to the model
const toolDeclaration = {
functionDeclarations: [{
name: "getStockPrice",
description: "Gets the stock price for a given ticker symbol.",
parameters: {
type: Type.OBJECT,
properties: {
ticker: { type: Type.STRING, description: "The stock ticker symbol" }
},
required: ["ticker"]
}
}]
};
const interaction = await ai.interactions.create({
agent: "your-agent-id",
Truncated for display — read the full file on GitHub.
Related Skills
Agent-Reach
85.5kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
73.8kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
last30days-skill
62.9kAI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Scrapling
83.8k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
