Vrajpal Jhala has deployed langgraph-harness, a self-hosted AI agent platform for GitLab that has already reviewed over 1,000 merge requests since its inception in June. Unlike SaaS-based code review bots, this system runs entirely on local servers, ensuring proprietary code never leaves the infrastructure. The agent integrates directly with GitLab webhooks to perform MR reviews, convert issues into draft merge requests, and execute scheduled tasks within isolated Kata Containers VMs.
Architecture and Reliability Engineering
The core of langgraph-harness is built on LangGraph.js, utilizing a Postgres checkpointer to manage state across complex agent loops. Each review typically involves around 26 model calls, making resilience critical; if a provider times out or a server restarts, the system resumes from the last checkpoint rather than restarting the entire process. This architecture also enables human-in-the-loop capabilities, allowing the chat assistant to pause for approval before executing sensitive actions.
Guardrails and Sub-Agent Verification
Jhala implemented specific middleware guards to prevent common agent failures, such as infinite tool loops or ending runs with unresolved questions. A separate critic pass screens every draft comment before it is posted, successfully dropping 81 out of 310 generated comments to reduce noise. For large merge requests, the system employs isolated verifier sub-agents that analyze individual files to maintain context quality, ensuring the main reviewer only acts on verified findings.
Persistent Memory and Analytics
The agent maintains a persistent memory system where it curates project-specific conventions and build commands after each run. This feature has accumulated 422 new memory entries, 22 updates, and 2 retirements, all viewable and editable via a React admin UI. Analytics indicate that 67% of the agent's comments are resolved by developers, suggesting high relevance and trust in the bot's output. The system supports various LLM providers, including OpenRouter, Gemini, Groq, Ollama, and sglang, allowing teams to choose their preferred model.
Key Takeaways
- langgraph-harness is an MIT-licensed, self-hosted alternative to SaaS code review bots, prioritizing data privacy.
- The system uses LangGraph.js and Postgres for state management, enabling crash recovery and checkpoint-based resumption.
- Over 1,000 MRs have been reviewed with a 67% comment resolution rate, indicating strong developer adoption.
- Guardrails and critic passes filter out 26% of draft comments, improving signal-to-noise ratio in code reviews.
- GitHub support is on the roadmap, expanding the platform's utility beyond the GitLab ecosystem.
The Bottom Line
Self-hosting AI agents isn't just about privacy; it's about control and reliability. LangGraph's checkpointing solves the flakiness that plagues most LLM agents, making them production-ready for critical workflows like code review.
Sources
https://dev.to/vrajpal-jhala/i-built-a-self-hosted-ai-agent-for-gitlab-it-has-reviewed-1000-merge-requests-2g7b