Star A Repository on Github

In this example, we will use CrewAI Agent to star a repository on Github using Composio Tools

1

Install Packages

Python
pip install composio_crewai crewai langchain_openai
2

Import Libraries & Initialize ComposioToolSet & LLM

Python
from composio_crewai import ComposioToolSet, App
from crewai import Agent, Task, Crew
from langchain_openai import ChatOpenAI

toolset = ComposioToolSet(api_key="<your-composio-api-key>")
llm = ChatOpenAI(api_key="<your-openai-api-key>")
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

4

Define the Agent, Task & Crew

Python
crewai_agent = Agent(
    role="Github Agent",
    goal="You take action on Github using Github APIs",
    backstory="You are AI agent that is responsible for taking actions on Github on behalf of users using Github APIs",
    verbose=True,
    tools=tools,
    llm=llm,
)

task = Task(
    description="Star a repo composiohq/composio on GitHub",
    agent=crewai_agent,
    expected_output="Status of the operation"
)

crew = Crew(
    agents = [crewai_agent],
    tasks = [task]
)
5

Crew Kickoff

Python
result = crew.kickoff()
print(result)