> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modulex.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Greptile Integration for AI Agents & Workflows

> Query and search codebases using natural language with Greptile. Get AI-generated answers about your code, find relevant files, and understand complex codebases.

{/* Self-hosted logo — build-time vendored from modulex.json / Iconify (see scripts/lib/logo.js). */}

<img src="https://mintcdn.com/modulexaillc/df8MOr-hXotYLTh5/logos/placeholder.svg?fit=max&auto=format&n=df8MOr-hXotYLTh5&q=85&s=a4046f9cd6d738c81259050e9833913c" alt="Greptile logo" width="72" height="72" data-path="logos/placeholder.svg" />

## Overview

Add **Greptile** to any ModuleX agent or workflow. AI-powered codebase search and Q\&A against the Greptile v2 REST API (`api.greptile.com`). Query and search codebases using natural language, get AI-generated answers about your code with cited file references, index repositories, and check indexing status.

<Info>
  **Categories**: Developer Tools & Infrastructure · Version Control · Knowledge Base · **Auth**: API Key · **Actions**: 4
</Info>

## Authentication

### API Key Authentication

Authenticate using your Greptile API key plus a GitHub Personal Access Token so Greptile can access your repositories

<Steps>
  <Step title="Step 1">
    Go to [https://app.greptile.com](https://app.greptile.com) and sign up or log in
  </Step>

  <Step title="Step 2">
    Open Settings and create a new API key
  </Step>

  <Step title="Step 3">
    Paste the Greptile API key below
  </Step>

  <Step title="Step 4">
    Create a GitHub Personal Access Token with 'repo' read access at [https://github.com/settings/tokens](https://github.com/settings/tokens) and paste it as the GitHub token
  </Step>
</Steps>

#### Required Credentials

| Field            | Description                                                                                                   | Required | Format |
| ---------------- | ------------------------------------------------------------------------------------------------------------- | -------- | ------ |
| Greptile API Key | Your Greptile API key from app.greptile.com                                                                   | Yes      | `-`    |
| GitHub Token     | A GitHub Personal Access Token with 'repo' read access, used by Greptile to clone and index your repositories | Yes      | `-`    |

## Available Actions

<AccordionGroup>
  <Accordion title="query — Query repositories in natural language and get answers with relevant code references. Greptile uses AI to understand your codebase and answer questions.">
    ### Parameters

    <ResponseField name="query" type="string" required>
      Natural language question about the codebase
    </ResponseField>

    <ResponseField name="repositories" type="string" required>
      Comma-separated list of repositories. Format: 'github:branch:owner/repo' or just 'owner/repo' (defaults to github:main). Example: 'facebook/react' or 'github:main:facebook/react,github:main:facebook/relay'
    </ResponseField>

    <ResponseField name="session_id" type="string">
      Optional session ID for conversation continuity across multiple queries
    </ResponseField>

    <ResponseField name="genius" type="boolean">
      Enable genius mode for more thorough analysis (slower but more accurate)
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "$defs": {
        "QuerySource": {
          "additionalProperties": false,
          "description": "A single code reference returned by ``query`` and ``search``.",
          "properties": {
            "repository": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Repository"
            },
            "remote": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Remote"
            },
            "branch": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Branch"
            },
            "filepath": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Filepath"
            },
            "linestart": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Linestart"
            },
            "lineend": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Lineend"
            },
            "summary": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Summary"
            },
            "distance": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Distance"
            }
          },
          "title": "QuerySource",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Message"
        },
        "sources": {
          "items": {
            "$ref": "#/$defs/QuerySource"
          },
          "title": "Sources",
          "type": "array"
        }
      },
      "required": [
        "success"
      ],
      "title": "QueryOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="search — Search repositories in natural language and get relevant code references without generating an answer. Useful for finding specific code locations.">
    ### Parameters

    <ResponseField name="query" type="string" required>
      Natural language search query to find relevant code
    </ResponseField>

    <ResponseField name="repositories" type="string" required>
      Comma-separated list of repositories. Format: 'github:branch:owner/repo' or just 'owner/repo' (defaults to github:main). Example: 'facebook/react' or 'github:main:facebook/react,github:main:facebook/relay'
    </ResponseField>

    <ResponseField name="session_id" type="string">
      Optional session ID for conversation continuity across multiple searches
    </ResponseField>

    <ResponseField name="genius" type="boolean">
      Enable genius mode for more thorough search (slower but more accurate)
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "$defs": {
        "QuerySource": {
          "additionalProperties": false,
          "description": "A single code reference returned by ``query`` and ``search``.",
          "properties": {
            "repository": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Repository"
            },
            "remote": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Remote"
            },
            "branch": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Branch"
            },
            "filepath": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Filepath"
            },
            "linestart": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Linestart"
            },
            "lineend": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Lineend"
            },
            "summary": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Summary"
            },
            "distance": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Distance"
            }
          },
          "title": "QuerySource",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "sources": {
          "items": {
            "$ref": "#/$defs/QuerySource"
          },
          "title": "Sources",
          "type": "array"
        }
      },
      "required": [
        "success"
      ],
      "title": "SearchOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="index_repo — Submit a repository to be indexed by Greptile. Indexing must complete before the repository can be queried. Small repos take 3-5 minutes, larger ones can take over an hour.">
    ### Parameters

    <ResponseField name="remote" type="string" required>
      Git remote type: 'github' or 'gitlab' (Default: `github`)
    </ResponseField>

    <ResponseField name="repository" type="string" required>
      Repository in owner/repo format. Example: 'facebook/react'
    </ResponseField>

    <ResponseField name="branch" type="string" required>
      Branch to index (e.g. 'main' or 'master')
    </ResponseField>

    <ResponseField name="reload" type="boolean">
      Force re-indexing even if already indexed
    </ResponseField>

    <ResponseField name="notify" type="boolean">
      Send email notification when indexing completes
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "repository_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Repository Id"
        },
        "status_endpoint": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Status Endpoint"
        },
        "message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Message"
        }
      },
      "required": [
        "success"
      ],
      "title": "IndexRepositoryOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="status — Check the indexing status of a repository. Use this to verify if a repository is ready to be queried or to monitor indexing progress.">
    ### Parameters

    <ResponseField name="remote" type="string" required>
      Git remote type: 'github' or 'gitlab' (Default: `github`)
    </ResponseField>

    <ResponseField name="repository" type="string" required>
      Repository in owner/repo format. Example: 'facebook/react'
    </ResponseField>

    <ResponseField name="branch" type="string" required>
      Branch name (e.g. 'main' or 'master')
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "repository": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Repository"
        },
        "remote": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Remote"
        },
        "branch": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Branch"
        },
        "private": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Private"
        },
        "status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Status"
        },
        "files_processed": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Files Processed"
        },
        "num_files": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Num Files"
        },
        "sample_questions": {
          "items": {
            "type": "string"
          },
          "title": "Sample Questions",
          "type": "array"
        },
        "sha": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Sha"
        },
        "raw": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Raw"
        }
      },
      "required": [
        "success"
      ],
      "title": "StatusOutput",
      "type": "object"
    }
    ```
  </Accordion>
</AccordionGroup>

## Limits & Quotas

* Indexing is asynchronous: small repositories take 3–5 minutes, larger ones
  can take over an hour. Use `index_repo` to start indexing, then poll
  `status` until it reports `completed`.
* **Error model**: non-2xx responses and timeouts are caught and returned as
  `success=False` + `error` rather than raising. Plan retries on the agent
  side based on the error string.

## Related integrations

<CardGroup cols={3}>
  <Card title="GitHub" href="/integrations/tools/github" />

  <Card title="GitLab" href="/integrations/tools/gitlab" />

  <Card title="Airweave" href="/integrations/tools/airweave" />
</CardGroup>

## Links

* [Greptile](https://www.greptile.com)
