Star A Repository on Github

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

1

Install Packages

Python
pip install composio-autogen
2

Import Libraries & Initialize ComposioToolSet & LLM

Python
from autogen import AssistantAgent, UserProxyAgent
from composio_autogen import ComposioToolSet, App

toolset = ComposioToolSet(api_key="<your-composio-api-key>")
llm_config = {
    "config_list": [
        {
            "model": "gpt-4o-mini",
            "api_key": "<your-api-key>",
        }
    ]
}
3

Define the Assistant & resigter the 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

Python
chatbot = AssistantAgent(
    "chatbot",
    system_message="Reply TERMINATE when the task is done or when user's content is empty",
    llm_config=llm_config,
)

user_proxy = UserProxyAgent(
    name="User",
    is_termination_msg=lambda x: x.get("content", "")
    and "TERMINATE" in x.get("content", ""),
    human_input_mode="NEVER",
    code_execution_config={"use_docker": False},
)

toolset.register_tools(apps=[App.GITHUB], caller=chatbot, executor=user_proxy)
4

Run the Agent

Python
task = "Star a repo composiohq/composio on GitHub"
response = user_proxy.initiate_chat(chatbot, message=task)
print(response.chat_history)