Skip to main content

GitHub

The GitHub connector's functionality

The GitHub connector enables Squid AI agents to work with a GitHub repository on the user's behalf:

CapabilityDescription
Search pull requestsSearch PRs by query, state, author, or reviewer, or list the open PRs
Get PR detailsFull PR details, optionally including changed files and reviews
Search codeSearch the repository's code, optionally filtered by path or file extension
Read filesRead a file's content from any branch, tag, or commit
Create pull requestsOpen a PR (including draft PRs) between branches
Review and commentComment on a PR, or submit an approve/request-changes/comment review
Close and mergeClose a PR without merging, or merge it using merge, squash, or rebase

Each connector is scoped to a single repository. To work with multiple repositories, add one connector per repository.

With these capabilities, users can ask an AI agent things like "Summarize the open PRs," "Review PR #42," or "Where is the rate limiter implemented?"

Creating a GitHub App

The connector authenticates as a GitHub App installed on your repository:

  1. Create a GitHub App in your organization or user account.

  2. Grant the app the repository permissions your use case needs — at minimum Pull requests (read and write) and Contents (read).

  3. Install the app on the repository you want to connect.

  4. Note the App ID (in the app's About section) and the Installation ID (in the URL of the installation page, github.com/settings/installations/<ID>).

  5. Under Private keys, generate a private key and download the PEM file.

Adding the GitHub connector to your Squid application

  1. Navigate to the Connectors tab in the Squid Console.

  2. Click Available Connectors.

  3. Find the GitHub connector, and select Add Connector.

  4. Provide the following configuration details:

Connector ID: A string that uniquely identifies the connector in your code.

App ID: The App ID of your GitHub App.

Installation ID: The Installation ID for the repository.

Private Key: The private key generated for your GitHub App, in PEM format. The key is stored securely as a Squid secret.

Repository: The repository in owner/repo format, such as facebook/react.

Webhook Secret: Optional. A secret used to verify GitHub webhook signatures if you configure your GitHub App to deliver webhooks to Squid.

Using the GitHub connector in your application

No-code Studio

  1. Navigate to the Studio tab in the Squid Console.

  2. Click Create AI Agent.

  3. Provide an agent ID and description, such as "repo-agent" and "This agent helps the user manage pull requests".

  4. Click Add Abilities.

  5. Expand the GitHub entry and select the GitHub connector you created earlier.

  6. Give a description for how the agent should use this connection, such as "Call this when a user wants to work with pull requests or search the code base."

  7. Click on Test and try asking the agent "List the open pull requests".

Using the Squid SDK

If you are creating your AI agent with the Squid SDK, connect the GitHub connector by adding it to the connectedIntegrations option of the ask() function:

await this.squid
.ai()
.agent('AGENT_ID')
.ask('Summarize the open pull requests', {
connectedIntegrations: [
{
integrationId: 'GITHUB_CONNECTOR_ID',
integrationType: 'github',
description: 'Call this connector to work with pull requests and search code',
},
],
});

To learn more about interacting with an agent from the SDK, view the AI agent documentation.