Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ComposioHQ/composio/llms.txt

Use this file to discover all available pages before exploring further.

Composio provides adapters for Google’s Gemini models through both the @google/genai SDK (TypeScript and Python) and the Google Agent Development Kit (ADK, Python only). Tools are formatted as FunctionDeclaration objects compatible with Gemini’s function calling API, and Composio handles execution of each function call result.

Installation

npm install @composio/core @composio/google @google/genai
Set your API keys in a .env file:
.env
COMPOSIO_API_KEY=your_composio_api_key
GOOGLE_API_KEY=your_google_api_key

Gemini function calling

import { Composio } from '@composio/core';
import { GoogleProvider } from '@composio/google';
import { GoogleGenAI } from '@google/genai';
import 'dotenv/config';

const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

const composio = new Composio({
  apiKey: process.env.COMPOSIO_API_KEY,
  provider: new GoogleProvider(),
});

async function main() {
  // Tools are returned as FunctionDeclaration[] — Gemini's native format
  const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER');

  const task = "Fetch the details of the user 'pg' on HackerNews";

  const response = await ai.models.generateContent({
    model: 'gemini-2.0-flash-001',
    contents: task,
    config: {
      tools: [{ functionDeclarations: tools }],
    },
  });

  if (response.functionCalls && response.functionCalls.length > 0) {
    const functionCall = {
      name: response.functionCalls[0].name || '',
      args: (response.functionCalls[0].args || {}) as Record<string, unknown>,
    };

    // Execute the function call through Composio
    const result = await composio.provider.executeToolCall('default', functionCall);
    console.log(JSON.parse(result).data);
  } else {
    console.log(response.text);
  }
}

main();

Google Agent Development Kit (ADK)

The Google ADK provider wraps Composio tools as FunctionTool instances for use inside ADK agents. This integration is Python-only.
from composio import Composio
from composio_google_adk import GoogleAdkProvider
from google.adk.agents import Agent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.genai import types

app_name = "github_agent"
session_id = "session_001"
user_id = "user_123"

composio = Composio(provider=GoogleAdkProvider())

# Tools are returned as ADK FunctionTool objects
tools = composio.tools.get(user_id=user_id, toolkits=["GITHUB"])

agent = Agent(
    name=app_name,
    model="gemini-2.0-flash",
    instruction="You are a GitHub utility agent with access to GitHub APIs.",
    tools=tools,
)

session_service = InMemorySessionService()
session_service.create_session_sync(
    app_name=app_name,
    user_id=user_id,
    session_id=session_id,
)

runner = Runner(
    agent=agent,
    app_name=app_name,
    session_service=session_service,
)

content = types.Content(
    role="user",
    parts=[types.Part(text="Star the composiohq/composio repository on GitHub")],
)

events = runner.run(user_id=user_id, session_id=session_id, new_message=content)
for event in events:
    if (
        event.is_final_response()
        and event.content is not None
        and event.content.parts
    ):
        print("Agent Response:", event.content.parts[0].text)
The Google ADK integration (composio-google-adk) is Python-only. The Gemini function calling integration (@composio/google for TypeScript, composio-gemini for Python) supports both languages.

Executing tool calls

The GoogleProvider exposes executeToolCall(userId, functionCall) for running individual function calls:
const result = await composio.provider.executeToolCall('user_123', {
  name: 'GITHUB_STAR_REPO',
  args: { owner: 'composiohq', repo: 'composio' },
});

console.log(JSON.parse(result)); // parsed tool execution result

Build docs developers (and LLMs) love