The Google provider formats Composio tools for Gemini and the Google Agent Development Kit (ADK). Pick the tab that matches your setup.
The Google Generative AI provider transforms Composio tools into Gemini function declarations. Gemini is non-agentic, so the model returns function calls and you run the loop: execute each call with composio.provider.executeToolCall, feed the result back, and repeat until the model replies with text.
Install
pip install composio composio_google google-genainpm install @composio/core @composio/google @google/genaiConfigure API Keys
Set COMPOSIO_API_KEY with your API key from Settings and GOOGLE_API_KEY with your Google API key.
COMPOSIO_API_KEY=xxxxxxxxx
GOOGLE_API_KEY=xxxxxxxxxCreate session and run
from composio import Composio
from composio_google import GoogleProvider
from google import genai
from google.genai import types
composio = Composio(provider=GoogleProvider())
client = genai.Client()
# Create a session for your user
session = composio.create(user_id="user_123")
tools = session.tools()
config = types.GenerateContentConfig(tools=tools)
chat = client.chats.create(model="gemini-3-pro-preview", config=config)
response = chat.send_message("Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'")
# Agentic loop: keep executing tool calls until the model responds with text
while response.function_calls:
parts = []
for fc in response.function_calls:
result = composio.provider.execute_tool_call(user_id="user_123", function_call=fc)
parts.append(types.Part.from_function_response(name=fc.name, response=result))
response = chat.send_message(parts)
print(response.text)import { Composio } from '@composio/core';
import { GoogleProvider } from '@composio/google';
import { GoogleGenAI, type Part } from '@google/genai';
const composio = new Composio({
provider: new GoogleProvider(),
});
const ai = new GoogleGenAI({ apiKey: process.env.GOOGLE_API_KEY! });
// Create a session for your user
const session = await composio.create("user_123");
const tools = await session.tools();
const chat = ai.chats.create({
model: 'gemini-3-pro-preview',
config: {
tools: [{ functionDeclarations: tools }],
},
});
let response = await chat.sendMessage({
message: "Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'",
});
// Agentic loop: keep executing tool calls until the model responds with text
while (response.functionCalls && response.functionCalls.length > 0) {
const parts: Part[] = [];
for (const fc of response.functionCalls) {
const result = await composio.provider.executeToolCall("user_123", {
name: fc.name || '',
args: (fc.args || {}) as Record<string, unknown>,
});
parts.push({
functionResponse: {
id: fc.id,
name: fc.name,
response: JSON.parse(result),
},
});
}
response = await chat.sendMessage({ message: parts });
}
console.log(response.text);Next
What is a session?
How sessions scope users, tools, and auth, and how to reuse them across requests.