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

> Integrate Composio with LLamaIndex agents to let them seamlessly interact with external apps

## Star A Repository on Github

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

<Steps>
  <Step title="Install Packages">
    <CodeGroup>
      ```bash Python
      pip install composio-llamaindex llama-index
      ```

      ```typescript Typescript
      coming soon
      ```
    </CodeGroup>
  </Step>

  <Step title="Import Libraries & Initialize ComposioToolSet & LLM">
    <CodeGroup>
      ```python Python
      from llama_index.llms.openai import OpenAI
      from llama_index.core.llms import ChatMessage
      from llama_index.core.agent import FunctionCallingAgentWorker
      from composio_llamaindex import App, ComposioToolSet

      toolset = ComposioToolSet()
      llm = OpenAI()
      ```

      ```typescript Typescript
      coming soon
      ```
    </CodeGroup>
  </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}")
      ```

      ```javascript TypeScript
      const connection = await toolset.connectedAccounts.initiate({appName: "github"})
      console.log(`Open this URL to authenticate: ${connection.redirectUrl}`);
      ```
    </CodeGroup>

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

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

    <CodeGroup>
      ```python Python
      tools = toolset.get_tools(apps=[App.GITHUB])
      ```

      ```typescript Typescript
      coming soon
      ```
    </CodeGroup>
  </Step>

  <Step title="Define the Agent">
    <CodeGroup>
      ```python Python
      prefix_messages = [
          ChatMessage(
              role="system",
              content=(
                  "You are a Github Agent, and you can use tools to perform actions on Github."
              ),
          )
      ]

      agent = FunctionCallingAgentWorker(
          tools=tools,
          llm=llm,
          prefix_messages=prefix_messages,
          max_function_calls=10,
          allow_parallel_tool_calls=False,
          verbose=True,
      ).as_agent()
      ```

      ```typescript Typescript
      coming soon
      ```
    </CodeGroup>
  </Step>

  <Step title="Execute the Agent">
    <CodeGroup>
      ```python Python
      result = agent.chat("Star a repo composiohq/composio on GitHub")
      ```

      ```typescript Typescript
      coming soon
      ```
    </CodeGroup>
  </Step>
</Steps>
