Star A Repository on GitHub
In this guide, weβll:
- π Connect your GitHub account with Composio
- π Fetch GitHub actions
- π§ Pass these actions to an LLM
- β Instruct to star the
composiohq/composio repository
- β
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.
Install Libraries
pip install composio_core composio_openai
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
herecomposio login
composio add github -e "default"
Donβt forget to set your COMPOSIO_API_KEY and OPENAI_API_KEY in your environment variables.
Initialise Composio Toolset and OpenAI
from composio_openai import ComposioToolSet, App
from openai import OpenAI
openai_client = OpenAI()
composio_toolset = ComposioToolSet(entity_id="default")
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. Execute Tool Calls
result = composio_toolset.handle_tool_calls(response)
print(result)
Install Libraries
npm install composio-core openai
Connect Your GitHub Account
Weβll use default as the user id (entity id).
You need to have an active GitHub Integration. Learn how to do this
herecomposio login
composio add github
Initialise Composio's OpenAIToolSet and OpenAI
import { OpenAI } from "openai";
import { OpenAIToolSet } from "composio-core";
const openai_client = new OpenAI();
const composio_toolset = new OpenAIToolSet();
Donβt forget to set your COMPOSIO_API_KEY and OPENAI_API_KEY in your environment variables.
Fetch GitHub Actions & and pass them to LLM
const tools = await composio_toolset.getTools({
actions: ["github_star_a_repository_for_the_authenticated_user"],
});
const instruction = "Star the repo composiohq/composio on GitHub";
const response = await openai_client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: instruction }],
tools: tools,
tool_choice: "auto",
});
Composio also supports action executions without LLMs or agents. Learn more. Execute Tool Calls
const result = await composio_toolset.handleToolCall(response);
console.log(result);
Next Steps
Now that youβve seen how to use tools, you can explore the following resources:
Tools
Checkout our toolset of 250+ LLM ready tools to build powerful AI applications
Connections
Learn how to create and manage connections for your users
Compatible Agentic Frameworks
Integrate with popular agentic frameworks
Triggers
Subscribe to triggers to execute actions automatically
Other Concepts
Learn about workspace environments, using CLI & other concepts