Build Tools with Auth
Create custom actions that leverage existing tool authentication to extend functionality.
Custom Actions are powerful building blocks that enable you to create custom functionality while leveraging existing tool authentication.
Creating a Custom Action with Authentication
Install Dependencies
Import necessary modules & initialize them
Creating a custom action
Below are examples of creating a custom action called list_repositories
(Python) & star_repo
(JavaScript) that integrates with the github
tool.
You need to add the action, input parameters & return content description, this is what the LLM will use to understand the action.
The execute_request/executeRequest
method is used to make API calls, it accepts the following arguments:
endpoint
: Endpoint URL. The base URL of the API will be prepended to this. You can find it in your connection’s Connection Info sectionmethod
: HTTP method to usebody
: Request body to pass to the APIparameters
: Custom Authentication Parametersconnection_id
: ID of the connected account
Since github
is a registered tool in Composio, the authentication credentials are automatically injected into your custom action!
Executing the Custom Action
Executing the custom action using LLM. Learn how to execute the custom action without LLM here.
Why Use Custom Actions?
Custom Actions provide several advantages:
- Data privacy: Execution happens on the user’s machine, ensuring sensitive data doesn’t leave the local environment.
- Flexibility: Users can create and customize as many tools and actions as needed.
- Compatibility: Custom actions can be integrated seamlessly across various Composio-supported platforms.
Was this page helpful?