Composio Core
Composio Core was the foundational Python package acting as a bridge between the Composio platform and other services. It is now officially DEPRECATED. Users are strongly advised to migrate to the 'composio' package for all new and existing projects, which offers improved performance, enhanced developer experience, and continued support. The 'composio' library is actively maintained with frequent updates and a clear release cadence.
Warnings
- breaking The `composio-core` package is officially DEPRECATED and no longer supported. Continuing to use it may expose your application to unpatched security vulnerabilities (e.g., arbitrary command injection, file read vulnerabilities in older versions) and prevent access to new features and performance improvements.
- breaking Direct tool execution methods like `composio.tools.get()` and `composio.tools.execute()` are deprecated in the current `composio` SDK versions (0.6.0+). Using these methods directly without a session is discouraged and may lead to unexpected behavior or future breakage.
- breaking Starting with Python SDK v0.9.0 and TypeScript SDK v0.2.0 (for the `composio` library), manual tool execution (if still performed, though sessions are recommended) now requires explicit version specification. The `tools.execute()` method will fail without a version.
- gotcha Hardcoding API keys directly in your source code or configuration files is a security risk. API keys can be compromised if the code is exposed.
Install
-
pip install composio-core -
pip install composio
Imports
- Composio
from composio_core import OpenAIToolSet
from composio import Composio
Quickstart
import os
from composio import Composio
# Ensure COMPOSIO_API_KEY is set in your environment variables
# (e.g., in a .env file or directly in your shell)
composio = Composio(
api_key=os.environ.get('COMPOSIO_API_KEY', '')
)
def verify_connection():
try:
# 'user-id-123' should be a unique identifier for your user
# Toolkits specifies which sets of tools to load (e.g., HACKERNEWS, GITHUB)
tools = composio.tools.get(user_id='user-id-123', toolkits=['HACKERNEWS'])
print(f"Successfully connected! Found {len(tools)} tools.")
except Exception as error:
print(f"Connection failed: {error}")
if __name__ == '__main__':
verify_connection()