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

# Using Composio With Autogen

> Integrate Composio with Autogen agents to let them seamlessly interact with external Apps

## Star A Repository on GitHub

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

<Steps>
  <Step title="Install Packages">
    ```bash Python
    pip install composio-autogen
    ```
  </Step>

  <Step title="Import Libraries & Initialize ComposioToolSet & LLM">
    ```bash 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>",
            }
        ]
    }
    ```
  </Step>

  <Step title="Connect Your GitHub Account">
    <Info>You need to have an active GitHub Integration. Learn how to do this [here](https://youtu.be/LmyWy4LiedQ?si=u5uFArlNL0tew0Wf)</Info>

    <CodeGroup>
      ```shell CLI
      composio login 
      composio add github
      ```

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

    <Tip>
      Don't forget to set your `COMPOSIO_API_KEY` and `OPENAI_API_KEY` in your environment variables.
    </Tip>
  </Step>

  <Step title="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](../../patterns/tools/use-tools/use-specific-actions)

    ```python 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)
    ```
  </Step>

  <Step title="Run the Agent">
    ```python Python
    task = "Star a repo composiohq/composio on GitHub"
    response = user_proxy.initiate_chat(chatbot, message=task)
    print(response.chat_history)
    ```
  </Step>
</Steps>
