Star A Repository on GitHub

In this guide, weโ€™ll:

  1. ๐Ÿ” Connect your GitHub account with Composio
  2. ๐Ÿ›  Fetch GitHub actions
  3. ๐Ÿง  Pass these actions to an LLM
  4. โญ Instruct to star the composiohq/composio repository
  5. โœ… Execute the action

Tools represent a group of actions specific to an app. Actions are operations you can perform - like starring a repo on GitHub or creating an issue in Linear.

1

Install Libraries

pip install composio_core composio_openai
2

Connect Your GitHub Account

Weโ€™ll use default as the user id, also known as entity id.

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

composio login 
composio add github -e "default"

Donโ€™t forget to set your COMPOSIO_API_KEY and OPENAI_API_KEY in your environment variables.

3

Initialise Composio Toolset and OpenAI

from composio_openai import ComposioToolSet, App
from openai import OpenAI

openai_client = OpenAI()
composio_toolset = ComposioToolSet(entity_id="default")
4

Fetch Github Actions, and pass them to LLM

tools = composio_toolset.get_tools(apps=[App.GITHUB])

task = "Star the repo composiohq/composio on GitHub"

response = openai_client.chat.completions.create(
    model="gpt-4o",
    tools=tools,
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": task},
    ],
)

Composio also supports action executions without LLMs or agents. Learn more.

5

Execute Tool Calls

result = composio_toolset.handle_tool_calls(response)
print(result)

Next Steps

Now that youโ€™ve seen how to use tools, you can explore the following resources: