agent-swarm.devagent-swarm.dev
Integrations

GitHub App Integration

Connect your GitHub repos to Agent Swarm — AI agents auto-trigger on @mentions, issue assignments, and labels via webhooks. Full setup guide with permissions, event handling, and bi-directional sync.

Enable GitHub webhooks for automated task creation from @mentions, issue assignments, and label-based triggers.

Setup

  1. Create a GitHub App
  2. Set webhook URL: https://your-server.com/api/github/webhook
  3. Generate a webhook secret

Required Permissions

  • Issues: Read & Write
  • Pull requests: Read & Write

Subscribe to Events

  • Issues
  • Issue comments
  • Pull requests
  • Pull request reviews
  • Pull request review comments
  • Check runs
  • Check suites
  • Workflow runs

Configuration

# Required for GitHub webhooks
GITHUB_WEBHOOK_SECRET=your-webhook-secret

# Optional: Bot name for @mentions (default: agent-swarm-bot)
GITHUB_BOT_NAME=your-bot-name

# Optional: Additional @mention aliases (comma-separated)
GITHUB_BOT_ALIASES=heysidekick,sidekick

# Optional: Labels that trigger agent action on PR/issue label events (comma-separated, default: swarm-review)
GITHUB_EVENT_LABELS=swarm-review

# Optional: Enable bot reactions (requires GitHub App)
GITHUB_APP_ID=123456
GITHUB_APP_PRIVATE_KEY=base64-encoded-key

# Optional: Disable GitHub integration
GITHUB_DISABLE=true

Runtime cancellation flags

GitHub unassign and review-request-removal events cancel the linked swarm task by default. You can disable either behavior independently through swarm_config without redeploying workers:

  • github.cancelOnUnassign — controls PR/issue unassigned events
  • github.cancelOnReviewRequestRemoved — controls PR review_request_removed events

Absent key, or any value other than "false", keeps the current cancel-on-event behavior. Setting the value to "false" leaves the task untouched and the handler returns { created: false }.

# Keep tasks alive when the bot is unassigned
agent-swarm set-config global github.cancelOnUnassign false

# Keep tasks alive when a review request is removed
agent-swarm set-config global github.cancelOnReviewRequestRemoved false

Supported Events

EventWhat happens
Bot assigned to PR/issueCreates a task for the lead agent
Review requested from botCreates a review task
PR review submittedCreates a review task for submitted human reviews, including inline comments bundled into the task description when present
@bot-name or @alias in comment/issue/PRCreates a task with the mention context
swarm-review label added to PR/issueCreates a task for review (configurable via GITHUB_EVENT_LABELS)
Bot unassigned / review request removedCancels the linked task by default; both behaviors are runtime-configurable via github.cancelOnUnassign and github.cancelOnReviewRequestRemoved

Submitted PR reviews with no top-level body are still processed when they contain inline comments. Agent Swarm fetches the full review-comment bundle, appends an Inline review comments section with path:line context to the spawned task, and avoids spawning duplicate follow-up tasks from the corresponding standalone pull_request_review_comment events.

Who can trigger mention and review tasks

Mentions in issues, PRs and comments, and submitted PR reviews, create a task only when the sender is one of:

  • a person linked to a swarm user (People page, GitHub identity),
  • the content's author, when GitHub reports them as OWNER, MEMBER or COLLABORATOR on the repo,
  • a login listed in GITHUB_ALLOWED_SENDERS (comma-separated, case-insensitive).

Other senders are listed on the People → Unmapped tab and the event returns {"created":false}. Assignment, label and review-request events need write or triage access on GitHub, so they skip this check. Dismiss on that tab hides a sender and stops recording it; it does not link or trust the sender, so their mentions still open no task. Logins ending in [bot] are hidden unless you turn on Show bots, and Show dismissed lists dismissed senders with an Undo.

# Optional: extra GitHub logins allowed to trigger mention and review tasks
GITHUB_ALLOWED_SENDERS=octocat,external-reviewer

Suppressed Events (Safety Defaults)

The following events are suppressed by default to prevent cascade behavior where agents auto-merge PRs without meaningful human review:

  • PR closed/merged — No automatic task creation on PR close
  • PR synchronize (new commits pushed) — No automatic task on push
  • CI check failures (check_run, check_suite, workflow_run) — No automatic task from CI events

These events still emit to the internal workflowEventBus for workflow triggers, but do not create agent tasks.

Bot Reactions

When someone pings the swarm from GitHub, the webhook reacts with 👀 on the item that pinged it as soon as it creates the task. The reaction authenticates in this order:

  1. GitHub App — when GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY are set and the event carries an installation id. The reaction appears as the bot.
  2. GITHUB_TOKEN — a personal access token, for deployments that use a plain webhook and no App. The reaction appears as the token's user. The token needs permission to write issues and pull requests on the repo (classic PAT: repo, or public_repo for public repos).
  3. Neither — the reaction is skipped. Task creation is never blocked by a reaction failure.

Automated replies to inline PR review threads must use the bot identity configured by GITHUB_TOKEN, not a user's OAuth connection. Agents verify the authenticated gh login before posting and append <!-- agent-swarm:review-ack --> so swarm-authored acknowledgements have explicit machine-readable provenance.

Eyes Reaction on Task Pickup

When an agent picks up a GitHub-sourced task (transitions to in_progress), a 👀 reaction is automatically added to the originating GitHub entity — the comment, issue, PR, or review that triggered the task. This gives immediate visual feedback that work has begun, without requiring the agent to post a comment.

Supported event types:

  • Issue/PR comments — 👀 added to the comment
  • PR review comments (inline) — 👀 added to the review comment
  • PR reviews (body) — 👀 added via GraphQL (REST does not support review reactions)
  • Issues/PRs (opened, edited, assigned, review requested, or labeled) — 👀 added to the issue or PR itself

Worker Git Configuration

Workers need git credentials to create PRs and push code:

GITHUB_TOKEN=your-github-token    # For git operations
GITHUB_EMAIL=worker@example.com    # Git commit email
GITHUB_NAME=Worker Agent           # Git commit name

Worker auth with the GitHub App

Workers can use short-lived App installation tokens instead of a static PAT. Set these on the API server:

GITHUB_APP_ID=123456
GITHUB_APP_PRIVATE_KEY=base64-encoded-key
GITHUB_APP_INSTALLATION_ID=12345678   # the installation on your org (Settings > GitHub Apps > Configure; the id is in the URL)

The App needs Contents: Read & Write to push, Pull requests: Read & Write for gh pr, and Workflows: Read & Write if agents edit .github/workflows/. GITHUB_WEBHOOK_SECRET is not required for worker auth. GITHUB_APP_INSTALLATION_ID is deployment-env only: PUT /api/config rejects it, so a config writer cannot pick the installation.

At boot each worker asks POST /api/github/installation-token (swarm API key plus X-Agent-ID). Only registered agents get a token; user tokens and ACP task tokens are refused. When the API answers with a token, the worker:

  • sets swarm-github-token git-credential as the git credential helper for the GitHub host, and
  • links a gh wrapper that passes the current token to gh on each call.

Each git or gh call asks the API for a token. The API caches it in memory until 10 minutes before its 1-hour expiry, and the worker never writes it to disk. The API refuses ACP task tokens. ACP harnesses still run as the worker user and can read the worker's own env, so give untrusted ACP targets a worker without GitHub credentials. The token never goes into a URL, a git remote or ~/.gitconfig. When the API cannot mint a token, git and gh fall back to GITHUB_TOKEN, so keep a PAT on workers if you want a fallback. Without GITHUB_APP_INSTALLATION_ID every call except one for a listed owner's repo (below) answers 404, and workers use GITHUB_TOKEN exactly as before. Boot logs GitHub App worker auth configured in App mode.

To serve repos from more than one account, install the same App on each account and list those owners (user or org logins, comma-separated) in GITHUB_APP_REPO_OWNERS on the API. When a worker names a repository of a listed owner, the API resolves that repository's App installation with the App JWT and mints a token for it. The repository must also be registered in the swarm on the configured GitHub host: otherwise POST /api/github/installation-token answers 403 and mints nothing. Any other call, with no repository or a repository of an unlisted owner, gets a token for GITHUB_APP_INSTALLATION_ID, so single-installation deployments are unchanged. GITHUB_APP_REPO_OWNERS is deployment env only, like GITHUB_APP_INSTALLATION_ID: swarm_repos rows are agent-writable, so the operator's owner list is what decides which installations workers can reach.

The worker's helper names the repo it is acting on: the url= of a git credential request, the --repo/-R argument or GH_REPO of a gh call, a gh api repos/<owner>/<repo>/… path, or the origin remote of the current checkout. An explicit --repo/-R or gh api path wins over GH_REPO, as in gh. In App mode the boot sets credential.useHttpPath for the GitHub host, so git passes the repository path to the helper. A listed owner's repo with no installation, or with an installation of an unlisted account, comes back as 502, and git or gh then uses the GITHUB_TOKEN fallback. Commits still use GITHUB_EMAIL / GITHUB_NAME.

GitHub Enterprise Server

One deployment can target a single GitHub Enterprise Server (GHES) instance instead of github.com. Set the same GITHUB_URL on the API server and every worker:

GITHUB_URL=https://ghe.example.com        # web base of your instance (default https://github.com)
GITHUB_API_URL=https://ghe.example.com/api/v3   # optional: only if your REST API is not at <GITHUB_URL>/api/v3
GITHUB_URLREST baseGraphQL
unset or https://github.comhttps://api.github.comhttps://api.github.com/graphql
https://ghe.example.comhttps://ghe.example.com/api/v3https://ghe.example.com/api/graphql
https://acme.ghe.com (GHE.com)https://api.acme.ghe.comhttps://api.acme.ghe.com/graphql
any, plus GITHUB_API_URL=XXX with /api/v3 replaced by /api/graphql, else X/graphql

GITHUB_URL must be the instance root (https:// or, for labs, http:// with a warning): no path, query or credentials. An invalid value disables the GitHub integration on the API, drops the scripts-runtime GITHUB_TOKEN binding and stops the worker at boot, so a GHES token is never sent to github.com. PR links and citations then fall back to github.com parsing. Error messages name the rule, never the value.

Both variables are deployment-env only. PUT /api/config rejects them because the API base receives your PAT, App JWT and installation tokens. Set them in compose, or in Helm with config.githubUrl / config.githubApiUrl.

Setup on GHES:

  1. Create the GitHub App at https://<host>/settings/apps/new with the permissions and events above, and the webhook URL https://<swarm-api>/api/github/webhook. The GHES instance must reach that URL.
  2. Create a PAT (or bot-user token) on the GHES host with repo scope for GITHUB_TOKEN.
  3. Workers export GH_HOST and GH_ENTERPRISE_TOKEN for gh, and add a git credential helper for the GHES host. The PAT moves out of GITHUB_TOKEN and GH_TOKEN in the worker and session env, because gh sends those to github.com. GHES mode needs gh 2.93.0 or later; an older gh stops the boot. Boot logs GitHub Enterprise auth configured (host: <host>).

App worker auth works the same on GHES: create the App on the GHES host, set GITHUB_APP_INSTALLATION_ID on the API as the no-repo fallback, and keep GITHUB_URL on the API and every worker. The API mints tokens on <GITHUB_URL>/api/v3, and the per-repo installation lookup (GET /repos/{owner}/{repo}/installation) uses the same base. Workers scope the credential helper to the GHES host and hand gh the token as GH_ENTERPRISE_TOKEN. The gh 2.93.0 minimum applies. A GHES PAT is optional and stays the fallback.

Not supported: github.com and GHES in one deployment, the claude-managed harness (it refuses to start a repo task when GITHUB_URL is set), and remote skill install, which still reads public github.com repos.

On this page