> ## Documentation Index
> Fetch the complete documentation index at: https://togetherai-migration.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Composio

> Using Composio With Together AI

Composio allows developers to integrate external tools and services into their AI applications. It handles tool calling, web-hooks, authentication, and more.

## Install Libraries

```py Python theme={null}
pip install together composio-togetherai
```

Set your `TOGETHER_API_KEY` environment variable.

```sh Shell theme={null}
export TOGETHER_API_KEY=***
export COMPOSIO_API_KEY=***
```

## Example

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

```py Python theme={null}
from composio_togetherai import ComposioToolSet, App
from together import Together

client = Together()
toolset = ComposioToolSet()
```

### Connect Your GitHub Account

You need to have an active GitHub Integration in Composio. Learn how to do this [here](https://www.youtube.com/watch?v=LmyWy4LiedQ)

<CodeGroup>
  ```py Python theme={null}
  request = toolset.initiate_connection(app=App.GITHUB)
  print(f"Open this URL to authenticate: {request.redirectUrl}")
  ```

  ```sh Shell theme={null}
  composio login
  composio add github
  ```
</CodeGroup>

### 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.

```py Python theme={null}
tools = toolset.get_tools(apps=[App.GITHUB])
```

### Create a Chat Completion with Tools

```py Python theme={null}
response = client.chat.completions.create(
    tools=tools,
    model="meta-llama/Llama-3.3-70B-Instruct-Turbo",
    messages=[
        {
            "role": "user",
            "content": "Star the repo 'togethercomputer/together-cookbook'",
        }
    ],
)

res = toolset.handle_tool_calls(response)
print(res)
```

## Next Steps

<Note>
  ### Composio - Together AI Cookbook

  Explore our in-depth [Composio Cookbook](https://github.com/togethercomputer/together-cookbook/blob/main/Agents/Composio/Agents_Composio.ipynb) to learn how to automate emails with LLMs.
</Note>
