Documentation

Composio

Composio allows developers to integrate external tools and services into their AI applications. It handles tool calling, web-hooks, authentication, and more.

Install Libraries

Python Copy
pip install bytecompute composio-bytecomputeai

Set your bytecompute_API_KEY environment variable.

Shell Copy
export bytecompute_API_KEY=***
export COMPOSIO_API_KEY=***

Example

In this example, we will use Bytecompute AI to star a repository on GitHub using Composio Tools.

Python Copy
from composio_bytecomputeai import ComposioToolSet, App
from bytecompute import bytecompute

client = bytecompute()
toolset = ComposioToolSet()

Connect Your GitHub Account

You need to have an active GitHub Integration in Composio. Learn how to do this here

Python Copy
request = toolset.initiate_connection(app=App.GITHUB)
print(f"Open this URL to authenticate: {request.redirectUrl}")
Shell Copy
composio login
composio add github

Get All Github Tools

You can get all the tools for a given app as shown below, but you can get specific actions and filter actions using usecase & tags.

Python Copy
tools = toolset.get_tools(apps=[App.GITHUB])

Create a Chat Completion with Tools

Python Copy
response = client.chat.completions.create(
    tools=tools,
    model="meta-llama/Llama-3.3-70B-Instruct-Turbo",
    messages=[
        {
            "role": "user",
            "content": "Star the repo 'bytecomputecomputer/bytecompute-cookbook'",
        }
    ],
)

res = toolset.handle_tool_calls(response)
print(res)