Composio

Learn how to use Composio with Composio

Overview

SLUG: COMPOSIO

Description

Composio enables AI Agents and LLMs to authenticate and integrate with various tools via function calling.

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Composio toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["COMPOSIO"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Execute Composio Tool

Description

Execute a tool using the composio api.

Action Parameters

allow_destructive
boolean
arguments
objectRequired
connected_account_id
string
tool_slug
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Search Composio Tools

Description

Search for tools across toolkits for specific use cases. use this when unsure what tool to use or to discover new tools.

Action Parameters

toolkits
array
use_case
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Check active connection

Description

Check if any active connected accounts exist for a given toolkit or status of the connected account with a specific id. if an active connected account exists, the tool will return true, otherwise it will return false. active connected accounts allow an agent to perform any actions on top of the toolkit.

Action Parameters

connected_account_id
string
toolkit
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Download S3 File

Description

Download a file from a public s3 (or r2) url to a local path.

Action Parameters

local_path
string
s3_url
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Enable trigger

Description

Enable a specific trigger for the authenticated user.

Action Parameters

config_params
object
connected_account_id
stringRequired
toolkit_slug
stringRequired
trigger_name
stringRequired
user_id
stringDefaults to default

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get required parameters

Description

This action retrieves the necessary parameters required to initiate a connection with a specified toolkit. for instance, linear may need 'client id' and 'client secret', zendesk might require similar oauth credentials, and slack could need a 'webhook url'. the required parameters vary based on the authentication scheme employed. for example, api key authentication requires an api key, whereas oauth2 with composio-managed auth typically does not require any parameters because it involves redirecting the user to the toolkit's website for authorization.

Action Parameters

toolkit
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get response schema

Description

Retrieves the response schema for a specified composio tool. this action fetches the complete response schema definition for any valid composio tool, returning it as a dictionary that describes the expected response structure.

Action Parameters

tool
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Initiate connection

Description

Initiate a connection to a toolkit with comprehensive authentication support. supports all authentication scenarios: 1. composio default oauth (no parameters needed) 2. custom oauth (user's client id/client secret) 3. api key/bearer token authentication 4. basic auth (username/password) 5. hybrid scenarios (oauth + connection fields like site name) 6. connection-only fields (subdomain, api key at connection level) 7. no authentication required automatically detects and validates auth config vs connection fields, provides helpful error messages for missing parameters.

Action Parameters

parameters
object
toolkit
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List toolkits

Description

List all the available toolkits on composio with filtering options.

Action Parameters

category
string
min_tools
integer
name_filter
string
no_auth_only
boolean
size
integerDefaults to 10

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List triggers

Description

List available triggers and their configuration schemas.

Action Parameters

toolkit_names
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve Toolkits

Description

Toolkits are like github, linear, gmail, etc. tools are like send email, create issue, etc programmatic functions that can be used to perform the action. not all toolkits support all tools. some toolkits support only a subset of tools that might be possible to perform with that toolkit. use this action to retrieve the toolkits that can be used to perform the action. this list is only probabilistic. retrieve toolkits for a specified usecase. so for example, if use case is to "send an email" this action will return all the toolkits that can be used to send email. simiarly if use case is to "create a github issue" this action will return all the toolkits that can be used to create a github issue. after using this, to confirm whether the toolkit can indeed potentially support the use case, use the action retrieve actions.

Action Parameters

category
stringRequired
page
integerDefaults to 1
page_size
integerDefaults to 10

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve Tools

Description

Toolkits are like github, linear, gmail, etc. tools are like send email, create issue, etc programmatic functions that can be used to perform the action. get tools for a given usecase using similarity search. these tools are most relevant to the usecase but still might not be actual tools needed for the usecase. this decision should be made by you. this should be used to narrow down for a toolkit, and find the most relevant tools for the usecase. in some cases, you might want to even check if the usecase is supported by the toolkit or not.

Action Parameters

limit
integerDefaults to 100
scopes
array
toolkit_name
stringRequired
usecase
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Wait for connection

Description

Wait for a connection to be established for a given toolkit or check the status of a connected account with a specific id. wait for a given amount of time and then check again the status of the connection.

Action Parameters

connected_account_id
string
timeperiod
integerDefaults to 30
toolkit
string

Action Response

data
objectRequired
error
string
successful
booleanRequired