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
- Go to your GitLab project or group Settings > Webhooks
- Set the webhook URL:
https://your-server.com/api/gitlab/webhook - Set a secret token for verification
- 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=trueSupported Events
| Event | What happens |
|---|---|
| Bot assigned to MR/issue | Creates a task for the lead agent |
@bot-name in comment/issue/MR | Creates 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 reposThe 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:
| Operation | GitHub (gh) | GitLab (glab) |
|---|---|---|
| Create PR/MR | gh pr create | glab mr create |
| View PR/MR | gh pr view | glab mr view |
| Review | gh pr review | glab mr approve / glab mr note |
| Comment on issue | gh issue comment | glab issue note |
| Clone | gh repo clone | glab repo clone |
Workflow Triggers
GitLab events can trigger workflows:
gitlab.merge_request.openedgitlab.merge_request.mergedgitlab.merge_request.closedgitlab.issue.openedgitlab.issue.closedgitlab.note.createdgitlab.pipeline.failedgitlab.pipeline.success
Related
- GitHub Integration — GitHub webhook setup
- Environment Variables — GitLab configuration variables
- Workflows — Automate actions on GitLab events
- Task Lifecycle — How webhook events become tasks
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.
Azure DevOps Integration
Connect Azure Repos and Azure Boards so a bot mention in a pull request, or a work item assigned to the bot, creates a swarm task, and workers clone, push, and open PRs with git and the az CLI