Open-Source Wikis

/

GitLab

/

Features

/

GitLab Duo

gitlab-org/gitlab

GitLab Duo

GitLab's AI suite: code suggestions, chat, code review, and autonomous agents.

Components

Component What it does Source
Code Suggestions Inline LLM completions in IDEs and the Web IDE ee/lib/code_suggestions/
Duo Chat Chat assistant for issues, MRs, code, docs ee/lib/gitlab/llm/, ee/app/services/llm/
Duo Code Review LLM-assisted MR review ee/app/services/duo/code_review/
Duo Workflow / Agent Platform Autonomous agents lib/gitlab/duo_agent_platform/, ee/lib/duo_workflow/
AI Gateway proxy The monolith's HTTP client to AI Gateway ee/lib/gitlab/llm/anthropic_client.rb etc.

High-level architecture

graph LR
    User[GitLab UI / IDE]
    Rails[Rails monolith]
    AIGW[AI Gateway service]
    Workflow[Duo Workflow Service]
    LLM[(LLM providers<br/>Anthropic, OpenAI, ...)]

    User -->|prompt| Rails
    Rails -->|HTTP| AIGW
    AIGW -->|API| LLM
    User -->|websocket| Rails
    Rails -->|gRPC| Workflow
    Workflow -->|HTTP| AIGW
    Workflow -->|tool calls| Rails

The Rails monolith never calls LLMs directly. All LLM traffic goes through the AI Gateway service, which adds:

  • Tenant isolation and rate limits.
  • Provider routing (Anthropic, OpenAI, AWS Bedrock, GCP Vertex).
  • Prompt caching.
  • Telemetry and audit.

Code Suggestions

  • Editor extensions (VS Code, JetBrains, Neovim) call AI Gateway directly with a token issued by the monolith.
  • The token is a Cloud Connector JWT (ee/lib/cloud_connector/).
  • Telemetry flows back into Rails for usage attribution.

Duo Chat

  • UI in app/assets/javascripts/ai/, ee/app/assets/javascripts/ai/.
  • Streaming responses via Action Cable.
  • "Tools" let the chat model call into Rails for things like "read this issue" or "show recent commits". The tool catalog is in ee/lib/gitlab/llm/chain/tools/.
  • Conversations are persisted (ee/app/models/ai/conversation.rb and friends).

The "chain" abstraction (ee/lib/gitlab/llm/chain/) is a small agent framework that selects tools, manages tool-call loops, and handles model outputs.

Duo Code Review

  • Triggered automatically on MRs (configurable per project).
  • A worker calls the AI Gateway with diff context, receives review comments, and posts them as MR comments via the standard Notes flow.
  • ee/app/services/duo/code_review/ orchestrates.

Duo Workflow / Agent Platform

The agent platform is a long-running, stateful agent runtime:

  • Duo Workflow Executor — separate service that orchestrates agents. Pinned via DUO_WORKFLOW_EXECUTOR_VERSION.
  • lib/gitlab/duo_agent_platform/ — Rails-side definitions and proxy.
  • Workhorse proxies AI-related WebSocket traffic via internal/ai_assist/duoworkflow/.

Active Context

ee/lib/active_context/ and gems/gitlab-active-context provide retrieval-augmented context for chat and agents:

  • Embeddings of code, docs, issues, MRs.
  • Search APIs (vector + keyword hybrid).
  • Backend-agnostic (pgvector, ClickHouse, OpenSearch).

Self-managed and offline

  • Self-managed installs without internet access can disable Duo entirely.
  • "Custom models" (scripts/custom_models/, ee/lib/code_suggestions/) let customers point Code Suggestions at their own LLM endpoints.
  • argo_translation.yml records translation policies.

Telemetry and trust

  • Every LLM round-trip emits an internal event (see Internal events).
  • Audit events log Duo interactions for EE customers.
  • Cloud Connector tokens are short-lived JWTs.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

GitLab Duo – GitLab wiki | Factory