Creating a Local Tool
How to create a Local Tool and add it to your Agent
What are local tools?
Composio provides you with hundreds of tools and thousands of prebuilt actions, which contains both:
- Managed and run at Composio’s end,
- Running and executed locally at the user’s machine.
The second kind is termed as Local Tools and some of its advantages are:
- The execution data does not need to leave user’s machine,
- User can add as many new Tools and Actions by themselves, and once added, can use with any of Composio’s supported platforms.
We have already added a number of useful local tools and are continuously adding more.
-
Here’s the list of already available local tools.
-
Here’s the link to use all of them out.
Adding a Custom Local tool in Python
In addition to the existing tools, a user can easily create their own tool and use with any of the supported frameworks of composio.
Add the action Decorator
In your code, add @action(toolname=[TOOL_NAME], requires=["LIBRARIES"])
decorater to the function that returns the response to the LLM.
Specify the tool name as the decorater’s parameter
Import your Action
Now that your Custom Action is ready, Import it in your main file and start using it with your LLM. Integrate this with any agentic framework you want!
Adding a Custom Local tool in Javascript
Coming Soon!
Examples/Sample Code:
There are lot of local tools available in composio/tools/local
directory, that you can use as a reference. To get started, you should check out the below two tools:
- Mathematical tool: Simple tool to perform mathematical operations.
- Greptile tool: Tool to integrate with Greptile framework.
Was this page helpful?