agent-swarm.devagent-swarm.dev
Integrations

GitLab Integration

Set up GitLab webhooks for automated task creation from merge requests, issues, and comments

Agent Swarm supports GitLab alongside GitHub through a provider adapter pattern. GitLab webhooks create tasks from MR reviews, issue assignments, and @mentions — just like the GitHub integration.

Setup

  1. Go to your GitLab project or group Settings > Webhooks
  2. Set the webhook URL: https://your-server.com/api/gitlab/webhook
  3. Set a secret token for verification
  4. Select the events you want to receive

Events to Enable

  • Merge request events
  • Issue events
  • Note (comment) events
  • Pipeline events

Configuration

# Required for GitLab webhooks
GITLAB_WEBHOOK_SECRET=your-webhook-secret

# GitLab API access (PAT or Group Access Token)
GITLAB_TOKEN=your-gitlab-token

# Optional: GitLab instance URL (default: https://gitlab.com)
GITLAB_URL=https://gitlab.com

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

# Optional: usernames allowed to trigger mention tasks without a linked swarm user
GITLAB_ALLOWED_SENDERS=alex,external-reviewer

# Optional: Disable GitLab integration
GITLAB_DISABLE=true

Supported Events

EventWhat happens
Bot assigned to MR/issueCreates a task for the lead agent
@bot-name in comment/issue/MRCreates a task with the mention context
Pipeline failure (on MRs with existing tasks)Creates a CI notification task

A mention creates a task only when the sender is a linked swarm user or a username listed in GITLAB_ALLOWED_SENDERS (comma-separated, case-insensitive). A sender whose public email belongs to an existing swarm user is linked to that user on first contact; other senders are dropped, logged, and listed as unmapped identities on the People page. Assigning the bot to an issue needs Reporter access on GitLab, so it is not gated.

Worker Git Configuration

Workers have glab CLI pre-installed for GitLab operations. Configure git credentials for GitLab repos:

GITLAB_TOKEN=your-gitlab-token    # For git operations and glab CLI
GITLAB_EMAIL=worker@example.com   # Git commit email for GitLab repos
GITLAB_NAME=Worker Agent          # Git commit name for GitLab repos

The runner automatically detects whether a task targets a GitHub or GitLab repository and uses the appropriate CLI tool (gh or glab).

At boot, docker-entrypoint.sh also adds a git credential helper for the GitLab host (GITLAB_URL, default https://gitlab.com) that reads GITLAB_TOKEN from the environment, so the token is never written to disk. Registered GitLab repos that auto-clone at boot use plain git clone with it, because gh repo clone only speaks GitHub.

VCS Provider Detection

Agent Swarm uses a provider adapter pattern to support both GitHub and GitLab. When a task is created from a webhook event, the vcsProvider field is set automatically. Workers use this to select the right CLI:

OperationGitHub (gh)GitLab (glab)
Create PR/MRgh pr createglab mr create
View PR/MRgh pr viewglab mr view
Reviewgh pr reviewglab mr approve / glab mr note
Comment on issuegh issue commentglab issue note
Clonegh repo cloneglab repo clone

Workflow Triggers

GitLab events can trigger workflows:

  • gitlab.merge_request.opened
  • gitlab.merge_request.merged
  • gitlab.merge_request.closed
  • gitlab.issue.opened
  • gitlab.issue.closed
  • gitlab.note.created
  • gitlab.pipeline.failed
  • gitlab.pipeline.success

On this page