Composio Client

1.33.0 · active · verified Tue Apr 14

Composio Client is the official Python library for interacting with the Composio API. It enables developers to integrate and automate actions across various tools and platforms. The library maintains a rapid release cadence, with frequent updates to its API surface to reflect changes and additions in the underlying Composio platform.

Warnings

Install

Imports

Quickstart

Initializes the ComposioClient and fetches a list of currently installed tools. This demonstrates basic connectivity and authentication. Ensure `COMPOSIO_API_KEY` is set in your environment variables.

import os
from composio_client import ComposioClient

# Ensure COMPOSIO_API_KEY is set in your environment
# Example: export COMPOSIO_API_KEY="your_api_key_here"
api_key = os.environ.get('COMPOSIO_API_KEY', '')

if not api_key:
    print("Error: COMPOSIO_API_KEY environment variable not set.")
    print("Please set it before running the quickstart.")
else:
    try:
        client = ComposioClient(api_key=api_key)
        # Fetch a list of installed tools
        tools = client.tool.get_installed_tools()
        print(f"Successfully initialized ComposioClient. Found {len(tools)} installed tools:")
        for tool in tools:
            print(f"- {tool.name} (ID: {tool.id})")

    except Exception as e:
        print(f"An error occurred: {e}")

view raw JSON →