Composio Python SDK Reference
This is the comprehensive SDK reference for the Composio Python SDK.
Main SDK Class
The main entry point for the Composio SDK.
composio.Composio
Composio SDK for Python.
Core Models
Tools
composio.core.models.Tools
Tools class definition
This class is used to manage tools in the Composio SDK. It provides methods to list, get, and execute tools.
execute
Execute a tool with the provided parameters.
This method calls the Composio API or a custom tool handler to execute the tool and returns the response. It automatically determines whether to use a custom tool or a Composio API tool based on the slug.
Returns: The response from the tool.
get
Get a tool or list of tools based on the provided arguments.
Toolkits
composio.core.models.Toolkits
Toolkits are a collectiono of tools that can be used to perform various tasks.
They’re conceptualized as a set of tools. Ex: Github toolkit can perform
Github actions via its collection of tools. This is a replacement of the
apps
concept in the earlier versions of the SDK.
authorize
Authorize a user to a toolkit
If auth config is not found, it will be created using composio managed auth.
Returns: The connection request.
list_categories
List all categories of toolkits.
Connected Accounts
composio.core.models.ConnectedAccounts
Manage connected accounts.
This class is used to manage connected accounts in the Composio SDK. These are used to authenticate with third-party services.
initiate
Compound function to create a new coneected account. This function creates a new connected account and returns a connection request.
Users can then wait for the connection to be established using the
wait_for_connection
method.
Returns: The connection request.
Auth Configs
composio.core.models.AuthConfigs
Manage authentication configurations.
create
Create a new auth config
Returns: The created auth config.
delete
Deletes an existing authentication configuration.
Returns: The deleted auth config.
disable
Disables an existing authentication configuration.
Returns: The disabled auth config.
enable
Enables an existing authentication configuration.
Returns: The enabled auth config.
get
Retrieves a specific authentication configuration by its ID
Returns: The retrieved auth config.
list
Lists authentication configurations based on provided filter criteria.
update
Updates an existing authentication configuration.
This method allows you to modify properties of an auth config such as credentials, scopes, or tool restrictions. The update type (custom or default) determines which fields can be updated.
Returns: The updated auth config.
Triggers
composio.core.models.Triggers
Triggers (instance) class
create
Create a trigger instance
Returns: The trigger instance
list_active
List all active triggers
Returns: List of active triggers
subscribe
Subscribe to a trigger and receive trigger events.
Returns: The trigger subscription handler.
Decorators
before_execute
composio.before_execute
after_execute
composio.after_execute
schema_modifier
composio.schema_modifier
Cross References
The Composio class is the main entry point for all SDK operations. It provides access to:
Tools
for tool management and executionToolkits
for toolkit operationsConnectedAccounts
for managing authenticationTriggers
for webhook and event handling
When you call Tools.execute
, it can use the before_execute() and after_execute() decorators to modify behavior.