Skip to main content

Overview

Tool execution is the core operation in Composio, allowing you to run actions from integrated services. This guide covers executing tools manually, handling authentication, managing versions, and customizing behavior with modifiers.

Basic Tool Execution

Version Control

By default, manual tool execution requires a specific toolkit version. If the version resolves to “latest”, execution will throw a ComposioToolVersionRequiredError unless dangerouslySkipVersionCheck is set to true.

Why Version Control Matters

Using “latest” version in manual execution can lead to unexpected behavior when new toolkit versions are released, potentially breaking your application. For production use, it’s recommended to pin specific toolkit versions.

Setting Versions

There are multiple ways to control toolkit versions:

Authenticated Tool Execution

Using Connected Accounts

Most tools require authentication. Use a connected account to execute authenticated tools:
If you don’t specify connectedAccountId, Composio uses the first active connected account for the user and toolkit.

Custom Authentication

For one-off requests, you can provide custom authentication parameters:
Custom authentication bypasses Composio’s token refresh and security features. Use connected accounts for production applications.

No-Auth Tools

Some tools don’t require authentication:

Execution with Modifiers

Modifiers allow you to customize tool behavior before and after execution. See the Modifiers Guide for detailed information.

Custom Tools Execution

Custom tools you’ve created can be executed the same way:
Custom tools with a toolkit slug automatically use the connected account for that toolkit. See Custom Tools Guide for more details.

Error Handling

Properly handle execution errors:
See the Error Handling Guide for comprehensive error management strategies.

Best Practices

Pin Versions

Always specify toolkit versions for production applications to avoid breaking changes.

Use Connected Accounts

Prefer connected accounts over custom auth params for better security and token management.

Handle Errors

Check both result.successful and catch SDK exceptions for robust error handling.

Enable Tracing

Set allowTracing: true in execution params for debugging and monitoring.

Advanced Options

Execution Tracing

Enable tracing to monitor tool execution:

Text-based Execution

Some tools support natural language input:

Next Steps

Authentication Flows

Learn how to set up and manage user authentication

Modifiers

Customize tool behavior with before and after execution hooks

Error Handling

Implement robust error handling strategies

File Handling

Work with file uploads and downloads in tools