Composio class is the main entry point for the Python SDK. It provides access to all SDK features including tools, toolkits, connected accounts, triggers, and more.
Initialization
Basic Usage
With Provider
Constructor
BaseProvider[TTool, TToolCollection] | None
default:"OpenAIProvider()"
The provider to use for tool wrapping. Defaults to OpenAI format. The generic types (TTool, TToolCollection) are automatically inferred from the provider.
str
required
Your Composio API key. Can be obtained from the Composio dashboard. If not provided, will read from
COMPOSIO_API_KEY environment variable.str
default:"https://api.composio.dev"
Custom API base URL for enterprise or development environments.
int
default:"60"
Request timeout in seconds.
int
default:"3"
Maximum number of retries for failed requests.
bool
default:"True"
Enable or disable telemetry tracking.
str
default:"./downloads"
Directory path for downloading files from tool executions.
dict[str, str] | str | None
default:"None"
Specify toolkit versions to use:
- Dictionary mapping toolkit names to versions:
{"github": "20250906_01"} - String for same version across all toolkits:
"20250906_01" Noneor"latest"for latest versions (default)
COMPOSIO_TOOLKIT_VERSION_GITHUB=20250906_01bool
default:"True"
Automatically handle file uploads and downloads in tool executions.
Complete Configuration Example
Properties
The Composio client exposes the following properties for accessing SDK functionality:tools
toolkits
Toolkits
Access to toolkit operations. See Toolkits API for details.
connected_accounts
ConnectedAccounts
Manage third-party service connections. See Connected Accounts API for details.
auth_configs
AuthConfigs
Manage authentication configurations. See Auth Configs API for details.
triggers
Triggers
Manage event triggers and webhooks. See Triggers API for details.
mcp
tool_router
ToolRouter[TTool, TToolCollection]
Advanced tool routing with session management. See Tool Router API for details.
provider
BaseProvider[TTool, TToolCollection]
The current provider instance used for tool wrapping.
client
HttpClient
The underlying HTTP client for direct API access (advanced usage).
Generic Type System
The Composio class uses Python generics to provide type safety:TTool: Individual tool type (e.g.,OpenAITool,ToolParam)TToolCollection: Collection type returned byget()(e.g.,list[OpenAITool])
Shorthand Methods
The Composio client provides shorthand methods for common operations:create
use
Environment Variables
The Composio SDK respects these environment variables:Error Handling
Examples
Basic Tool Execution
With Custom Provider
Next Steps
Tools
Learn about tool operations
Connected Accounts
Manage user authentication
Providers
Explore AI framework integrations
Tool Router
Advanced routing features