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.
Installation
Install the Composio Python SDK using your preferred package manager:
Requirements
Python : Version 3.9 or higher (Python 3.10+ recommended)
pip : Latest version recommended
Environment Setup
Get your API key
Sign up at composio.dev and obtain your API key from the dashboard.
Configure environment variables
Create a .env file in your project root and add your API key: COMPOSIO_API_KEY = your-api-key-here
COMPOSIO_BASE_URL = https://backend.composio.dev/api # Optional: Custom API base URL
COMPOSIO_LOG_LEVEL = info # Optional: silent, error, warn, info, debug
COMPOSIO_DISABLE_TELEMETRY = false # Optional: Set to "true" to disable telemetry
For production applications, use a secure method to manage environment variables such as python-dotenv or your deployment platform’s secret management.
Initialize the SDK
Import and initialize the Composio SDK in your application: import os
from composio import Composio
composio = Composio(
api_key = os.getenv( "COMPOSIO_API_KEY" ),
)
Verification
Verify your installation by running a simple test:
import os
from composio import Composio
composio = Composio(
api_key = os.getenv( "COMPOSIO_API_KEY" ),
)
# Test the connection
def verify ():
try :
user_id = "test-user"
tools = composio.tools.get( user_id = user_id, toolkits = [ "HACKERNEWS" ])
print ( f "Successfully connected! Found { len (tools) } tools." )
except Exception as error:
print ( f "Connection failed: { error } " )
verify()
Provider-Specific Packages
Depending on your AI framework, you may want to install a provider-specific package:
OpenAI
OpenAI Agents
Anthropic
LangChain
LangGraph
LlamaIndex
CrewAI
AutoGen
Google Gemini
Google ADK
pip install composio-openai
Quick Start Example
Here’s a complete example using OpenAI Agents:
Install dependencies
pip install composio-openai-agents openai-agents
Create your agent
import asyncio
import os
from agents import Agent, Runner
from composio import Composio
from composio_openai_agents import OpenAIAgentsProvider
# Initialize Composio client with OpenAI Agents Provider
composio = Composio( provider = OpenAIAgentsProvider())
user_id = "user@acme.org"
tools = composio.tools.get( user_id = user_id, toolkits = [ "HACKERNEWS" ])
# Create an agent with the tools
agent = Agent(
name = "Hackernews Agent" ,
instructions = "You are a helpful assistant." ,
tools = tools,
)
# Run the agent
async def main ():
result = await Runner.run(
starting_agent = agent,
input = "What's the latest Hackernews post about?" ,
)
print (result.final_output)
asyncio.run(main())
Virtual Environment (Recommended)
It’s recommended to use a virtual environment for your Python projects:
# Create virtual environment
python -m venv .venv
# Activate (Linux/macOS)
source .venv/bin/activate
# Activate (Windows)
.venv\Scripts\activate
# Install Composio
pip install composio
Next Steps