What are tools?

Large Language Models (LLMs) are like a highly intelligent person who can understand and reason about almost anything but is sitting in an empty room with no ability to interact with the outside world. They can think and talk about sending emails, creating a ticket on Jira, or cloning a repository from GitHub, but can’t actually DO these things.

This is where tools come in. Tools give this intelligent being specific abilities to interact with the real world. Many AI models support tool calling (also called function calling).

The term tools and actions are used interchangeably in the documentation

How tool calling works

AI models with tool calling capabilities decide when and how to use specific tools to meet user requests. Developers create and provide these tools, equipping the AI with a toolbox to select the best tool for each task

For example, if a user asks an LLM to send an email to john@example.com with subject Meeting Tomorrow, the LLM can use the Gmail tool’s GMAIL_SEND_EMAIL action to send the email.

LLM’s thinking process:

  1. Recognizes this requires email sending capability
  2. Identifies the appropriate tool (Gmail) & action (GMAIL_SEND_EMAIL)
  3. Structures the necessary parameters:
    • recipient: john@example.com
    • subject: “Meeting Tomorrow”
    • body: [drafts appropriate content]
  4. Calls the action with these parameters

Tool calling with Composio

At Composio, tools are offered for multiple platforms, accessible via Python and JavaScript SDKs. These platforms, referred to as Apps or Tools, include popular services like GitHub, Twitter, Salesforce, Jira, and Notion. Within each of these Apps, we provide Actions, which are essentially functions that can be executed. For example, you can send an email on Gmail, star a repository on GitHub, or create an issue on Jira. These tools can also be used directly, similar to function calls, without needing agents.

Use the ComposioToolSet class to use and configure tools:

See all supported frameworks here.

Arguments Accepted by ComposioToolSet

Basic Uscase:

  • api_key: Composio API key. Get your API key here
  • entity_id: The ID of the entity to execute the action on. Defaults to default
  • connected_account_ids: Use this to define connected accounts to use when executing an action for a specific app

Extensive Use Case:

  • output_dir: Directory path to store downloaded files
  • metadata: Additional metadata for executing an action. Learn more here
  • processors: Request and response processors, use these to pre-process requests before executing an action and post-process the response after an action has been executed. Learn more here
  • logging_level: Accepted values: CRITICAL, FATAL, ERROR, WARNING, WARN, INFO, DEBUG
  • verbosity_level: This defines the size of the log object that will be printed on the console

Advanced Use Case:

  • base_url: Base URL for the Composio API server
  • output_in_file: Whether to output the result to a file
  • workspace_id: Workspace ID for loading an existing workspace
  • workspace_config: Used to specify the configuration for the workspace environment. Supported workspace types: Host, Docker, FlyIO, and E2B
  • max_retries: Maximum number of times a tool should be retried in case of a failure during execution
  • **kwargs: Additional arguments for advanced use cases

Getting Tools & Actions

1

Install packages

Python
pip install composio-langchain
2

Get tools

Python
from composio_langchain import ComposioToolSet, Action, App

tool_set = ComposioToolSet()

# Get all actions from a tool
tools = tool_set.get_tools(apps=[App.GITHUB])

Action Types

  1. External Tool Actions: Pre-configured actions for specific tools, such as creating issues or changing issue status in Jira.
  2. System Management Actions: Actions that interact with the execution environment, like file system operations, shell commands, and browser automation.
  3. Custom Actions: User-defined actions in Python or JavaScript that extend Composio’s capabilities to interact with new or existing tools.

Action Limits

Empirical evidence indicates that agents perform optimally when limited to fewer than 20 actions. Providing LLMs with too many actions can lead to significant performance issues, such as increased response time and decreased accuracy.

To optimize agent performance, it’s essential to limit the number of actions available. This can be achieved through effective action filtering strategies. Here are some recommended approaches:

  1. Use specific actions from a tool
  2. Use tags to filter actions
  3. Use use cases to filter actions
  4. Implement custom filtering logic

By carefully curating the action set, you can significantly improve agent efficiency and response quality.

Listing All Apps (Tools)

You can list all available tools in Composio along with their details in the following ways:

Listing All Actions

You can list all available actions in Composio along with their details in the following ways: