Creating a Custom Action with Authentication
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.
How to Use Connection Parameters of an Account?
Connection Parameters of an account are available in theconnected_account parameter of the custom action
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.