Using Composio With Gemini

Star A Repository on GitHub

In this example, we will use Gemini to star a repository on GitHub using Composio Tools

1

Install Packages

Python
$pip install composio-gemini
2

Import Libraries & Initialize ComposioToolSet & Gemini

Python
$from google.genai import types
>from google import genai
>from composio_gemini import Action, ComposioToolSet, App
>
>client = genai.Client(api_key="<gemini-api-key>")
>toolset = ComposioToolSet(api_key="<composio-api-key>")
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 and GEMINI_API_KEY in your environment variables.

4

Get All GitHub Tools & Create Config

You can get all the tools for a given app or specific actions as shown below. Learn more here

Python
1tools = toolset.get_tools(
2 apps=[
3 App.GITHUB
4 ]
5)
6
7config = types.GenerateContentConfig(tools=tools)
5

Execute the Agent

Python
1chat = client.chats.create(model="gemini-2.0-flash", config=config)
2
3response = chat.send_message(
4 "Can you star composiohq/composio repository on github",
5)
6
7print(response.text)
Built with