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.0.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.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for composio_gemini-0.18.0.tar.gz
Algorithm Hash digest
SHA256 85bc57ce15d1c5e3d406c56bbac019312291d1fd243005ebcfc8c2f9a506de13
MD5 820e5fbc5d7b7971be08d3e1cea16a35
BLAKE2b-256 32a8ee8957836ea1dcad137452dacdd61931269ae186f57ad97f79bd885db896

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for composio_gemini-0.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33e668b3dd4811f121e96d22450dc85879e5199ee67fb97227a6270ae0496ad8
MD5 bedb866cc729c8a7c7162616ec402068
BLAKE2b-256 b58055b82a5f84c92a60a78b3fc2d1a8fbae8ad85c3da520cc1190c546e77dcf

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