Star A Repository on Github

In this example, we will use Vercel AI SDK to star a repository on Github using Composio Tools

1

Install Packages

JavaScript
npm install @ai-sdk/openai composio-core ai
2

Import Libraries & Initialize ComposioToolSet & LLM

JavaScript
import { openai } from "@ai-sdk/openai";
import { VercelAIToolSet } from "composio-core";
import { generateText } from "ai";

const toolset = new VercelAIToolSet();
3

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. Learn more here

JavaScript
const tools = await toolset.getTools({ apps: ["github"] });
4

Define the Agent

JavaScript
const output = await generateText({
    model: openai("gpt-4o-mini"),
    streamText: false,
    tools,
    prompt: 'Star the repository "composiohq/composio"',
    maxToolRoundtrips: 5,
});
5

Execute the Agent

JavaScript
console.log(output.text);