GitLab CI/CD pipeline that runs SWE-agent against your own GitLab issues — autonomously creating branches, commits, and merge requests from plain-language issue descriptions.
Addresses SWE-agent#760 (no native GitLab support).
- Open an issue, label it
run:swe - Scheduled pipeline picks it up, labels it
swe:in-progress - SWE-agent edits code, runs tests, commits to
swe-agent/issue-<iid> - Pipeline opens a merge request for review
- Post-merge CI builds and deploys
In your project's .gitlab-ci.yml:
include:
- project: 'YOUR_GROUP/swe-agent-gitlab-ci'
file: '/swe-agent.gitlab-ci.yml'
variables:
OPENAI_API_BASE: "http://lm-studio:1234/v1"
OPENAI_MODEL: "lm_studio/openai/gpt-oss-120b"| Variable | Purpose |
|---|---|
ISSUE_AUTH_TOKEN |
GitLab token with api scope, used to scan and label issues |
OPENAI_API_BASE |
LM Studio (or any OpenAI-compatible) endpoint |
OPENAI_MODEL |
Model identifier exposed by the endpoint |
OPENAI_API_KEY |
Defaults to lm-studio for local LM Studio runs |
| Label | Effect |
|---|---|
run:swe |
Required trigger label |
model:<name> |
Override the model for this issue |
maxtokens:<n> |
Override SWE_MAX_INPUT_TOKENS |
swe:in-progress |
Applied automatically; prevents re-runs |
- Trigger: scheduled pipeline (hourly) scans open issues via the GitLab API
- Branch naming:
swe-agent/issue-<iid>per issue - Idempotency:
swe:in-progresslabel +resource_grouplock per project/MR - Auth: prefers
CI_JOB_TOKEN, falls back toPRIVATE-TOKEN - Model gateway: any OpenAI-compatible endpoint (LM Studio, vLLM, llama.cpp, OpenAI itself)
Blog post: Learning to Automate My Side Projects
- SWE-agent + LM Studio (Qwen3-coder-30b or gpt-oss-120b)
- GitLab CI/CD (self-hosted)
- Kubernetes (deploy target on merge)
- Job completion detection is loose — SWE-agent can run ~50 unnecessary steps before stopping
- Unit-test integration into the agent loop is still in progress
- Model selection currently driven by labels; a config-file approach would generalize better
MIT