Skip to main content

Use Composio to get an array of tools with your Gemini agent.

Project description

composio-gemini

Adapts Composio tools to the google-genai SDK as Python callables compatible with Gemini's Automatic Function Calling.

Installation

pip install composio composio-gemini google-genai

Set COMPOSIO_API_KEY (create one at https://dashboard.composio.dev/settings) and GOOGLE_API_KEY (from https://aistudio.google.com/apikey) in your environment.

Quickstart

GeminiProvider wraps each Composio tool as a typed Python callable. Pass the callables to GenerateContentConfig(tools=...) and the google-genai SDK derives function declarations from their signatures and executes tool calls automatically inside the chat loop; there is no manual tool-call handling.

from composio import Composio
from composio_gemini import GeminiProvider
from google import genai
from google.genai import types

composio = Composio(provider=GeminiProvider())
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!'"
)
print(response.text)

If you disable Automatic Function Calling and handle function calls yourself, composio.provider.handle_response(response) executes the function calls in a Gemini response and returns Part objects ready to send back.

composio-gemini vs composio-google

This package targets the google-genai SDK (from google import genai). composio-google targets the older Vertex AI SDK (vertexai.generative_models). For new projects, Google recommends google-genai, so use this package.

Links

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

composio_gemini-0.18.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

composio_gemini-0.18.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file composio_gemini-0.18.1.tar.gz.

File metadata

  • Download URL: composio_gemini-0.18.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for composio_gemini-0.18.1.tar.gz
Algorithm Hash digest
SHA256 eed9e498a7dca535df56074b80a1e0262f45d6fb7109d516bf3a54a264e1c559
MD5 fdec82b65171c217980b68eb780a28db
BLAKE2b-256 90925be03679086bcce7a1c2e7bc999bcd4a2b69d3ca35886cddfe064c6dd92d

See more details on using hashes here.

File details

Details for the file composio_gemini-0.18.1-py3-none-any.whl.

File metadata

File hashes

Hashes for composio_gemini-0.18.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d43889bc3195298f995f97b91b8ef115751d7d66f3cb0295b70fffecea8ff39
MD5 bedd598809d8c7a36453cb795963d73a
BLAKE2b-256 3bd0e510819e1a329195ee1b691fb4f72ebb6f0b34690c6c1eae96086fbb5c29

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page