Executing Tools
Tool calling is a feature of all frontier LLMs to allow them to interact with the outside world. Earlier you might be able to ask an LLM to write you a nice email, but you would have to manually send it. With tool calling, you can now provide an LLM a valid tool, for example, GMAIL_SEND_EMAIL
to go and accomplish the task autonomously.
Using Chat Completions
For non-agent providers—such as OpenAI, Anthropic, and Google AI—you can process tool calls using the tool call handlers provided by the Composio SDK. This approach works consistently across all supported non-agent providers.
To learn how to setup these providers, see Providers.
Using Agentic Frameworks
Composio also has first-party support for agentic frameworks which execute tools, feed the result to the LLM and continue the conversation.
Here, the tool execution is handled by the agentic framework. Composio makes sure the tools are formatted into the correct objects for the agentic framework to execute.
Tools are scoped to a user
Each tool and tool action is scoped to a user. Hence, a user_id
is required to fetch and execute tools.
The authentication state is checked and used while fetching and executing a tool.
You need to authorize the user to execute tools. For more information on authentication, see Authenticating Tools.
For Humans (deterministic tool calling)
In case you just want to call a tool manually — not using any framework or LLM provider, you can do so using the execute
method.
Proxy Execute — Manually calling toolkit APIs
You can also proxy requests to an API of any supported toolkit. This is useful when you want to manually call an API of a toolkit and inject the authentication state from Composio.
If you’re interested in extending toolkits and creating custom tools, see Custom tools.
Automatic File Handling
Composio SDK includes automatic file handling for tools that work with files. When enabled (default), the SDK automatically handles file uploads and downloads during tool execution.
File Upload
When a tool accepts file inputs (marked with file_uploadable: true
), you can pass local file paths or URLs or a File
object. Here’s an example using Google Drive upload:
The SDK automatically:
- Reads the file content
- Uploads it to secure storage
- Passes the file metadata to the tool
File Download
When a tool returns file outputs, the SDK automatically:
- Downloads the file to a local temporary directory
- Provides the local file path in the response
Disabling Auto File Handling
You can disable automatic file handling when initializing the Typescript SDK:
For more details on file handling, see Auto Upload and Download Files.