Skip to main content

Star A Repository on GitHub

In this example, we will use SmolAgent’s Code Agent to star a repository on GitHub using Composio Tools
1

Install Packages

pip install composio-smol smolagents
2

Import Libraries & Initialize ComposioToolSet

from composio_smol import ComposioToolSet, Action, App
from smolagents import CodeAgent, HfApiModel
from dotenv import load_dotenv

load_dotenv()

composio_toolset = ComposioToolSet()
3

Connect Your GitHub Account

You need to have an active GitHub Integration. Learn how to do this here
composio login
composio add github
Don’t forget to set your COMPOSIO_API_KEY in your environment variables.
4

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
tools = composio_toolset.get_tools(actions=[Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER])
5

Define the Agent

agent = CodeAgent(tools=tools, model=HfApiModel())
6

Execute the Agent

task = "Star a repo composiohq/composio on GitHub"
agent.run(task)