How GitLab engineers build GitLab with Duo AI agents
GitLab made its own Duo AI features the standard way its engineers write issues, merge requests, reviews and tests, and used AI agents to migrate a legacy rate-limiting system.
GitLabUnited StatesEnterprise softwareScaled
- Scale
- All GitLab team members are expected to use Duo for five standard development tasks
- Scenario
- AI code review and coding agents
- Business function
- Software engineering
- Kind of solution
- Software engineering assistant
- Who built it
- Built in-house (Anthropic and Google)
- Human oversight
- People approve each output
- Organization
- Enterprise
- AI types
- Generative AI, Agentic AI, Conversational AI
tl;drAI agents helped three GitLab engineers move all 121 rate-limit keys to a new framework.See the results
GitLab’s engineers use the company’s own GitLab Duo AI features to write issues, draft merge requests, review code and scaffold tests2. The engineering handbook makes this the standard development practice for all team members, so that GitLab acts as customer zero of its product2.
In May and June 2026, a pod of three engineers used GitLab Duo Agent Platform, Claude and other AI coding agents to migrate GitLab’s application-level rate limiting to a new framework1. By mid-June 2026, all 121 keys of the old rate limiter ran through the new framework, after 14 numbered specs and more than 30 merge requests1.
Before the deployment
For years, GitLab ran two rate-limiting paths in production1. The team wanted one implementation in the labkit-ruby gem that is observable, testable and operated the same way everywhere1.
- Application-level limiter: Gitlab::ApplicationRateLimiter held 121 keys1.
- Rack-level system: A separate system limited requests at the Rack layer1.
- Risk: Every request to the GitLab monolith touches rate limiting, so its failure modes have to be visible and reversible1.
Across the company, tasks such as summarizing long threads and creating boilerplate code required manual work5.
What was built
GitLab Duo drafts and checks the routine artifacts of development work, and AI agents run bounded changes inside a review loop that people control1, 2. The work divides like this:
- Duo features: Generate issues with cross-references to similar issues, draft merge request descriptions, address review comments, scaffold tests and draft documentation2, 3.
- Duo Code Review: Gives each merge request an AI-generated summary and first feedback before human reviewers see it3.
- Agents in the migration pod: Read context, drafted specs, implemented bounded changes, wrote tests and pre-reviewed merge requests1.
- Engineers: Own scope, architecture, rollout and final review, and every change, AI-assisted or not, goes through standard review1, 3.
- Merge request authors: Label each merge request on a 1-5 scale of how much AI contributed, from no AI use to fully AI-driven3.
Engineers also use Duo Chat to search the public handbook, the internal handbook and GitLab Docs at once, and Duo root cause analysis on failing pipelines3, 4. Earlier uses include merge request summaries, incident reviews and release notes5.
“All rollouts complete. Up to now, all rate limits from the applimiter and the labkit implementation agree. But I suspect this is because there’s not a lot of traffic there. I’m going to see if I can generate some traffic exceeding the limit.”
Rollout
- Key milestone
Cohort 1 tested five heavily trafficked keys, including pipelines_create, notes_create and user_sign_in1. The team planned five cohorts and needed six1.
Technology and architecture
GitLab Duo Agent Platform runs the agents, and Duo features inside GitLab draft issues, merge requests and reviews1, 2. The developer experience team also works with Claude, and its handbook sets up Claude Code to read repository conventions and reach GitLab data through the GitLab MCP server3.
| Layer | What they used | Role | Source |
|---|---|---|---|
| Agent orchestration | GitLab Duo Agent Platform | Runs the AI agents that the migration pod used to structure its work | 1 |
| Language model | Claude | Agent model in the migration and an assistant for writing, research and architecture discussions | 1, 3 |
| Task agent | Claude Code | Coding agent that reads repository conventions and GitLab data | 3 |
| Checker model | GitLab Duo Code Review | Reviews each merge request and summarizes it before human reviewers | 1, 3 |
| Chat interface | GitLab Duo Chat | Answers questions, searches the handbooks and docs, and debugs failing jobs | 4, 5 |
| Developer tools | GitLab Duo Code Suggestions | Suggests code in the editor for JavaScript and Ruby development | 5 |
| Language model | Foundation models from Google and Anthropic | Power the GitLab Duo features | 6 |
| Prompt and context management | Custom MR review instructions | Project rules that Duo adds to every merge request review | 3 |
| Prompt and context management | CLAUDE.md and AGENTS.md | Repository files that give coding agents the project’s conventions | 3 |
| Tools and actions | GitLab MCP server | Gives AI assistants live access to projects, issues, merge requests and pipelines | 3 |
| Offline evaluation | Centralized Evaluation Framework | Scores models and Duo features against a GitLab-specific prompt library | 6 |
The Duo features run on foundation models from Google and Anthropic, and GitLab isn’t tied to a single model provider6. Before a change to a Duo feature ships, the Centralized Evaluation Framework scores it against a prompt library of question and ground-truth answer pairs6.
Data inputs
- Source code and merge requests: Duo relates an issue’s requirements to the whole GitLab codebase and similar features4.
- Issues and epics: Agents read the epic before writing a spec1.
- Handbooks and docs: Duo Chat searches the public handbook, the internal handbook and GitLab Docs4.
- Pipeline logs: Root cause analysis and AI assistants parse failing jobs and large log outputs3.
- Repository instructions: A
.gitlab/duo/mr-review-instructions.yamlfile, CLAUDE.md and AGENTS.md carry project rules and conventions for Duo and coding agents3.
Integrations
- Merge requests: Duo appends the project’s custom rules to its standard review criteria on every merge request review3.
- CI/CD pipelines: Agentic Chat can apply changes to debug a failing job4.
- GitLab MCP server: Lets an AI tool like Claude Code read issues, merge requests, pipelines and project data, and create issues or comments3.
How one change moves through the agent loop
- An agent reads the epic and writes a spec1.
- A second pass runs adversarial review on the spec. Implementation starts only after the blockers clear1.
- The agent implements the change and verifies it with explicit evidence1.
- Adversarial review runs on the merge request, and GitLab Duo Code Review checks code quality1.
- After two resolution rounds at most, the change escalates to a human reviewer, who decides on the merge1.
- Engineers roll the change out behind feature flags in steps of 1%, 10%, 50% and 100%, and some cohorts run in shadow mode against the old implementation first1.
Results
| Metric | Before | After | Scope and timeframe | Reported by |
|---|---|---|---|---|
| Rate-limit keys moved to the new framework | Two rate-limiting paths in production | 121 keys | Application-level rate limiting in the GitLab monolith, May to mid-June 2026 | GitLab, measured1 |
| Call sites moved under one feature flag pair | About 95 individual flag flips and 190 YAML edits | 95 call sites | 83 call sites in the monolith and 12 in Enterprise Edition, May 2026 | GitLab, measured1 |
| Specs the agent loop shipped | Not disclosed | 14 numbered specs | Rate-limiting migration, to mid-June 2026 | GitLab, measured1 |
- 121 keys: Counts the ApplicationRateLimiter keys on the new framework by mid-June 2026. An audit confirmed that the legacy path is down to near-zero, and a guardrail stops future rate limits from bypassing the framework1.
- 95 call sites: Cohort 2 moved 83 call sites in the monolith and 12 in Enterprise Edition under a single feature flag pair. Without that consolidation, the rollout would have needed something like 95 individual flag flips and about 190 YAML edits1.
- 14 numbered specs: The pod shipped these with more than 30 merge requests into labkit-ruby1.
Outside the migration, Duo changed routine work. Summarizing long threads and creating boilerplate code became more efficient, and documenting and summarizing issues takes less time5. A new engineer on the Growth team used Duo to get a first merge request deployed to production in the first week4.
Lessons learned
Agents handled the mechanical fan-out across the codebase, which humans do badly1. Code generation stopped being the slow part, and the team found that the pod, the loop and the observability mattered more than the agents1.
An agent-built change passed every gate and still caused a user-facing error. The new adapter dropped an identifier on one unauthenticated code path, and a tiny portion of users saw a generic failure for a short time1. Shadow comparison had flagged the key as diverging, but the labels didn’t tell a structural collision from a normal disagreement1.
Claude missed a handful of EE-only rate limits, and 17 keys out of 121 slipped past the earlier cohorts1. A human audit on May 15, 2026, found them, because the team hadn’t asked the agents, or itself, to keep a running count against the full key inventory1.
The bottleneck moved to people. Review capacity, rollout judgement and operator attention became the slow parts1. Max Woolf, a staff backend engineer in the pod, wrote that he “ended up in circles with an agent” on one day and called the project “one of my steeper learning curves at GitLab, for sure.”1
GitLab’s own guidance treats AI output as fallible. The developer experience team warns that AI output can be confidently wrong, and the new engineer validates every output and uses AI as a discussion partner to protect his skills3, 4. The evaluation team notes that fixing one thing often breaks three others6.
Every figure is GitLab’s own, from its product blog and handbook, and the blog posts invite readers to try GitLab Duo1, 4.
Case study scorecard
- 121 keys Rate-limit keys moved to the new framework1
- 95 call sites Call sites moved under one feature flag pair1
- 14 numbered specs Specs the agent loop shipped1
Sources by publication date
- Organization 6
Build this solution yourself
Analysis
What you need
- A loop with human gates: The pod trusted agents on legacy code only inside a fixed sequence of spec, adversarial review, evidence and human merge. Check that your reviewers have the capacity for the volume agents produce1.
- Observability that separates failure modes: Shadow mode flagged the divergent key, but only labels that tell failure kinds apart would have stopped the ramp1.
- An inventory to count against: The missed keys surfaced only in a human audit, so give the agents and the team the full list of what the change must cover1.
Reference architecture
Software engineering assistant
A software engineering assistant writes, reviews, tests, or migrates code in the tools that developers already use, and a developer approves its output. A language model writes a change, a test, or a review comment from the code for a task, and automated checks and a checker model build, test, and filter it. A reviewer approves each checked proposal in code review before it merges, and developers do the work that fails the checks by hand.
- Developer tools (documented in this case study)
- Assistant platform
- Code repository
- Code index
- Deterministic code analysis
- Standards and guidelines
- Code and platform map
- Prompts and context (documented in this case study)
- Language model (documented in this case study)
- Automated checks
- Checker model (documented in this case study)
A check mark shows a building block that this case study's sources document.
Open the reference architectureOthers who built it
- Uber: How Uber scaled coding agents and cut cost per session. Cost per agent session fell 52% from its June peak as weekly agent requests grew 9.4x.
- Pictet Group: Pictet takes Claude Code from developers to business teams. About 700 Pictet staff now use Claude Code and Cowork, and prototypes take 2 hours, not 2 weeks.
- TUI Group: TUI cuts external IT staff with AI coding assistants. TUI's external IT workforce fell from thousands to maybe 30 or 50 as its developers coded with AI.
- eBay: eBay's Copilot pilot cut pull request merge time by 17%. Developers with Copilot cut pull request merge time 17% in eBay's 300-developer A/B test.
- Meta: Meta's just-in-time LLM tests catch bugs before code lands. JiTTests helped catch 74 serious privacy bugs at Meta before they landed in the first half of 2026.
- Deutsche Bank: AI coding assistants speed up software work at Deutsche Bank. Developers save an estimated 1.5 to 2.5 hours per week and report 10x gains on some tasks.
Cite this case study
Enterprise AI Case Studies. "How GitLab engineers build GitLab with Duo AI agents." Updated Nov 25, 2026. https://case-studies.ai/case-studies/engineering-and-research/ER-054-ai-coding-agents-dogfooding-gitlab/
@misc{csai-er-054,
author = {{Enterprise AI Case Studies}},
title = {{How GitLab engineers build GitLab with Duo AI agents}},
year = {2026},
note = {Updated 2026-11-25},
url = {https://case-studies.ai/case-studies/engineering-and-research/ER-054-ai-coding-agents-dogfooding-gitlab/}
}Sources
The following reporting, and every passage quoted from it, belongs to its publisher, not to this site. Sources and ownership
- Source 1:
How we used AI agents to migrate GitLab rate limiting
Supporting excerpts (42)
A small team at GitLab spent the past few weeks running an experiment: Could we use AI agents to migrate part of our legacy rate-limiting system without dropping the safety bar?
The pod, the loop, and the observability mattered more than the agents.
using GitLab, GitLab Duo Agent Platform, and other tools
GitLab has had two rate-limiting paths in production for years: an application-level Gitlab::ApplicationRateLimiter with 121 keys, and a separate Rack-level system.
The goal was to unify them on a single implementation in labkit-ruby.
Every request to the monolith touches it, so its failure modes have to be visible and reversible.
The pod comprised three GitLab team members and a handful of AI agents.
Max Woolf, a Staff Backend Engineer on the API Platform team, owned the monolith side and ran most of the rollouts. Bob Van Landuyt, who works on Scalability, owned the gem and shaped the architecture.
Agents read context, drafted specs, implemented bounded changes, wrote tests, and pre-reviewed merge requests.
GitLab Duo Code Review kept code quality high on merge requests.
Humans owned scope, architecture, rollout, and final review.
We ran a strict loop: read the epic, write the spec, run adversarial review on the spec, implement only after blockers cleared, verify with explicit evidence, run adversarial review on the merge request, escalate to human review, merge.
Adversarial review was capped at two resolution rounds before a human had to weigh in.
Across the project we shipped 14 numbered specs and somewhere north of 30 merge requests into labkit-ruby.
On legacy code, it's a loop I can trust an agent to execute.
Cohort 1 was the high-stakes test: five heavily-trafficked keys including pipelines_create, notes_create, and user_sign_in.
We rolled it 1% → 10% → 50% on May 4, 2026, 100% on May 5, 2026.
All rollouts complete. Up to now, all rate limits from the applimiter and the labkit implementation agree. But I suspect this is because there's not a lot of traffic there. I'm going to see if I can generate some traffic exceeding the limit.
Cohort 2 collapsed the next 95 call sites, 83 in the monolith, and 12 in Enterprise Edition (EE), under a single feature flag pair.
Without that consolidation, the rollout would have meant something like 95 individual flag flips and ~190 YAML edits.
Agents are very good at this kind of mechanical fan-out across a codebase. Humans are very bad at it.
Cohort 2 had been running in shadow mode for days, agreeing with the old implementation.
The new adapter quietly dropped an identifier on one unauthenticated code path.
A tiny portion of users saw a generic failure for a short period of time.
Shadow comparison had actually flagged that key as diverging.
We immediately turned the enforcement flag off.
The immediate fix shipped two days later.
It went through every step of the loop: spec, adversarial review, implementation, GitLab Duo Code Review, gradual rollout.
we had observability, but not observability that distinguished the failure modes that mattered.
On May 15, Max ran an audit against master, pinged me in Slack, and opened Cohort 6:
We had planned five cohorts. We needed six.
Claude had missed a handful of EE-only rate limits
17 keys out of 121 had slipped past the earlier cohorts.
We hadn't asked the agents, or ourselves, to keep a running count against the full key inventory.
They moved the bottleneck.
Review capacity, rollout judgement, and operator attention became the slow parts.
Mixed bag, ended up in circles with an agent.
one of my steeper learning curves at GitLab, for sure.
Working with agents is a skill, and the cost of building it is days where you'd have made more progress alone.
the feature flag per rate-limit is overkill, we shouldn't do these for the next migrations
By mid-June, all six cohorts are at 100%.
All 121 keys in the ApplicationRateLimiter run through the new framework, an audit confirmed the legacy path is down to near-zero, and we added a guardrail so no future rate limit can silently bypass it.
- Source 2:
Supporting excerpts (8)
Going forward, all team members are expected to perform these use cases using Duo as part of our standard development practice:
Always generate issues using Duo, with cross-references to similar issues to reduce duplication.
Use Duo to draft merge requests before manual editing, including the MR description and addressing the review comments where applicable.
Use Duo review to accelerate the review process and catch more issues.
collect developer feedback when Duo's review doesn't meet quality standards
Start test scaffolding with Duo as part of the Definition of Done for new features
Use Duo to generate technical and marketing documentation with specialized skillsets, making it the standard for all documentation updates.
Our goal is to be a true customer zero of our own product and identify wins and gaps to provide constructive feedback while celebrating victories.
- Source 3:
Supporting excerpts (21)
we prioritize GitLab Duo as our primary AI tool — both because it's our product and because using it as customer zero gives us direct feedback to improve it for all engineers.
Writing, research, architecture discussions, long-form documentation
Giving AI assistants live access to GitLab projects, issues, MRs, and pipelines
AI-assisted review, not AI-replaced review.
we expect every merge request author to apply a devex-ai-assistance scoped label before merging. The label is a simple 1–5 scale that captures how much AI contributed to the MR:
It gives us data to understand where AI is most effective and where it isn't yet.
All code, AI-assisted or not, goes through standard review. AI output can be confidently wrong.
Do not paste internal customer data, unreleased feature details, or other confidential information into AI tools outside GitLab's boundaries.
We use GitLab Duo Code Review to get an AI-generated summary and initial feedback before assigning human reviewers.
we use AI to accelerate test scaffolding — generating initial test cases from a function signature or spec, which we then refine.
we use GitLab Duo's root cause analysis feature on failing pipelines and use AI assistants to help parse large log outputs and identify patterns.
GitLab Duo's custom MR review instructions let you define project-specific standards that Duo automatically enforces on every merge request review.
Duo reads it whenever it reviews an MR and appends your custom rules to its standard review criteria.
Avoid duplicating checks already covered by static analysis. If RuboCop, or Danger can catch it deterministically, let them — it's cheaper, faster, and raised directly in the IDE.
CLAUDE.md is read by Claude Code at the start of every session.
AGENTS.md is an open standard supported by multiple tools including OpenAI Codex, Cursor, and Windsurf.
section to prevent agents from modifying sensitive files (migrations, CI config, secrets)
With it configured, an AI tool like Claude Code can directly read issues, merge requests, pipelines, and project data from GitLab without you copying and pasting context manually.
Have the AI create issues, comment on MRs, or trigger actions based on a conversation
We use GitLab Duo in our day-to-day work and file issues for friction points or missing functionality
When a new Duo feature ships, we aim to try it on real work within the sprint and share findings in our team retrospective
- Source 4:
GitLab engineer: How I improved my onboarding experience with AI
Supporting excerpts (10)
With GitLab Duo, I was able to get my first tiny MR deployed to production in the first week
GitLab has a public-facing handbook, an internal handbook, and GitLab Docs.
I can describe what I'm looking for in natural language via GitLab Duo Chat and search across all resources at once.
GitLab Duo will relate the requirements of the issue against the whole GitLab codebase, assess similar features, and prepare all the findings.
I always let GitLab Duo review my merge requests before assigning human reviewers.
Using GitLab Duo Agentic Chat, Duo can apply changes to debug the failing job.
I ask teammates fewer basic questions.
I avoid automation bias by always validating AI's outputs.
To avoid negatively affecting my skills, I use AI as a discussion partner rather than just implementing the code it generates.
Want to make GitLab Duo part of your onboarding experience? Sign up for a free trial today.
- Source 5:
Developing GitLab Duo: How we are dogfooding our AI features
Supporting excerpts (10)
including standouts like GitLab Duo Code Suggestions and GitLab Duo Chat
She effectively utilizes GitLab Duo to summarize merge requests, making it easier and faster to review code changes.
Steve Xuereb, Staff Site Reliability Engineer, employs GitLab Duo to summarize production incidents and create detailed incident reviews
uses GitLab Duo to craft brief, impactful summaries for release notes
Peter Hegman, Senior Frontend Engineer, has been using Code Suggestions for his JavaScript and Ruby development.
By testing these features internally, we ensure they meet our quality standards before release.
Many tasks that previously required manual intervention are now automated, freeing up valuable time for our engineers. For example, summarizing long threads and creating boilerplate code are now more efficient
The time taken to document and summarize issues has decreased, allowing for quicker information dissemination and decision-making.
The ongoing collection of use cases and metrics with the AI Impact analytics dashboard will guide enhancements
When I have a question about GitLab features, I default to using Chat instead of opening 100 browser tabs.
- Source 6:
Developing GitLab Duo: How we validate and test AI models at scale
Supporting excerpts (10)
GitLab is not tied to a single model provider by design. We currently use foundation models from Google and Anthropic.
GitLab Duo features are powered by a diverse set of models, which allows us to support a broad set of use cases and gives our customers flexibility.
Our Centralized Evaluation Framework (CEF) utilizes thousands of prompts tied to dozens of use cases
While other companies view and use customer data to train their AI features, GitLab currently does not.
This prompt library is composed of questions and answers.
those datasets may not be reflective of the use cases that we see for features at GitLab
We compare each response to our ground truth and provide it a ranking based on a series of metrics including: Cosine Similarity Score, Cross Similarity Score, LLM Judge, and Consensus Filtering with an LLM Judge.
At GitLab, we re-validate the performance of our features on a daily basis during active development to help ensure that all changes improve the overall functionality.
validate that it has increased the performance of the entire feature against the baseline from the day before
many times fixing one thing breaks three others
Comments
Start the conversation.
Invited members of the library comment here. Sign in to join the conversation.