I built a self-hosted AI agent for GitLab. It has reviewed 1,000+ merge requests.
Assign a GitLab issue to a bot, and a few minutes later there's a draft merge request with the fix. Open an MR, and the same bot reviews it before a human gets to it. That's langgraph-harness, a self-hosted agent platform for GitLab I've been building and running on real projects since June. What it does MR review. A webhook fires when an MR opens or changes. The agent reads the diff and the code…
LangGraph-Harness, a self-hosted agent platform for GitLab, was built by the author and has been running on real projects since June. The platform's core function is merge request (MR) review, where a webhook triggers the agent to read the diff and surrounding code, draft comments, screen them, and post the final version. The agent also assigns issues to itself in a separate virtual machine (Kata Containers) where it can build and test the project before opening a draft MR.
In addition to MR review, the agent can comment on MRs, pick up where it left off on the same branch, and handle tasks or run on a schedule. It also offers a GitLab-aware assistant chat that can read projects, browse, and search past reviews. The entire system runs on the user's own servers, ensuring data privacy and allowing the user to choose the model (OpenRouter, Gemini, Groq, Ollama, or sglang).
The agent operates in a sandboxed loop, starting from a plain instruction or an issue, and repeating as needed. It can also chat with a GitLab-aware assistant that can read your projects, browse, and search past reviews. Sensitive information is pre-approved by the user before it is shared. The platform is built using LangGraph.js, createAgent, GitLab tools, and a system prompt, with an admin UI for live monitoring and an analytics page tracking the agent's interactions.
To make the agent trustworthy, the author implemented several guardrails. Failed runs are retried from their last checkpoint, preventing unnecessary token usage. Failure handling includes preventing the agent from repeatedly calling the same tool, avoiding endless loops, and adding a guard to handle cases where the agent asks for clarification. Comment drafts are also screened by a critic pass, which can drop 81 out of 310 comments so far. For large MRs, sub-agents handle individual files, providing more accurate reviews.
Memory management is an essential aspect of LangGraph-Harness. The agent learns from past experiences, retaining useful information like build commands, repository conventions, and false positives. It also allows for the addition, updating, or retirement of learned information during a run, providing flexibility and adaptability. The platform is open-source, with a MIT license, and can be set up using Node 22+, Docker, a GitLab access token, and an LLM key.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.