Chapter 33Lesson 01~350 minutes

GitLab Duo and Agentic DevSecOps: AI Features, Security Remediation, Governance, and Usage Controls: Concepts, Architecture, and Mental Model

Build a governance-first mental model for GitLab Duo, the Agent Platform, models, context, tools, flows, credits, privacy, human approval, and independent verification.

GitLab DuoAgent PlatformAI GovernancePrivacyHuman Approval

Learning objectives

  • Distinguish GitLab Duo non-agentic features from Agent Platform agents, flows, tools, sessions, and execution environments.
  • Explain how availability, feature maturity, GitLab Credits, add-ons, offerings, roles, and GitLab version form separate gates.
  • Map prompt/context data through GitLab and model providers without assuming that “AI enabled” means all data has identical retention or processing.
  • Apply tool governance and human authorization as controls independent from GitLab RBAC and independent from model quality.
  • Treat AI-generated code and security remediation as untrusted proposals whose correctness, provenance, and authorization must be independently verified.
Availability and governance baseline — verified 2026-08-22 against GitLab 19.3. The mandatory path does not call an AI service and consumes no GitLab Credits. Current GitLab documentation separates non-agentic Duo features, which generally require Premium/Ultimate plus a Duo add-on, from the GitLab Duo Agent Platform, where selected capabilities can also be available to Free namespaces with GitLab Credits. Agents and several flows are GA, while some governance/reporting capabilities remain beta. Exact access varies by feature, offering, add-on, credits, role, feature-preview setting, and version.

1. The practical problem: AI can propose and execute work faster than your old review assumptions

Traditional CI/CD automation is usually deterministic: a reviewed YAML file triggers known commands under a defined identity. Generative AI changes the failure model. A model can infer intent incorrectly, use stale context, hallucinate an API or security property, or choose a broader change than the human expected. Agentic systems add another step: the system may invoke tools that read repositories, edit files, run commands, call GitLab APIs, create branches or merge requests, or interact with external systems.

The operational question is therefore not “Is the AI smart enough?” It is: what data did it see, what authority could it exercise, what did it propose or execute, who approved consequential actions, what evidence proves the result, and what did the action cost? Those questions connect directly to earlier GitLab chapters on roles, protected resources, CI/CD runner trust, security findings, audit evidence, and operational diagnostics.

Core rule: model output is evidence of a proposal, not evidence of correctness. A successful tool call is evidence that an action executed, not evidence that the action was appropriate.

2. Product mental model: non-agentic assistance versus the Agent Platform

GitLab currently documents two related product families that learners should not collapse into one label. GitLab Duo non-agentic features perform focused AI-assisted tasks such as code suggestions, non-agentic Chat, code explanation, root-cause analysis, vulnerability explanation, and vulnerability resolution, subject to their individual entitlements. GitLab Duo Agent Platform adds agentic chat, agents, flows, tools, AI Catalog items, sessions, and execution paths that can perform multi-step work.

Concept Mental model Typical effect Governance question
Non-agentic feature Focused AI assistance around a bounded task Explanation, suggestion, summary, proposed remediation What context is sent, who can use it, and how is output reviewed?
Agent AI assistant with instructions and a tool set Reads or acts through selected tools Which tools are visible and what mode governs each?
Flow One or more agents orchestrated into a workflow Multi-step work, sometimes in CI/CD Where does it execute, under what identity, with what runner/network boundary?
Tool Callable capability exposed to an agent Read, write, delete, command, Git or API operation Allow, ask, or deny? Is the action separately authorized by GitLab?
Session / artifact Record of one interaction/workflow Conversation, tool calls, actions, result evidence What is retained, auditable, and safe to share?
Model Generative engine selected for a feature Produces text/decisions/tool-selection proposals Which provider processes the context and under what data policy?

3. Architecture: separate data flow, authorization, execution, and verification

The cleanest mental model uses four independent planes. The context plane decides what code, issue, vulnerability, chat history, or tool result reaches the model. The authorization plane combines GitLab role/resource permissions with agent tool governance. The execution plane may be the browser/IDE, local environment, or a CI/CD runner used by a flow. The verification plane consists of tests, security scanners, diffs, protected-branch policies, approvals, and human review.

Agentic DevSecOps control flow
flowchart TD
  U[Human intent] --> G[GitLab Duo / Agent Platform]
  C[Selected GitLab + repository context] --> G
  G --> M[Configured model/provider]
  M --> P[Proposed plan / tool call]
  P --> TG{Tool governance}
  TG -->|allow / approved| X[Tool or flow execution]
  TG -->|deny| D[No execution]
  X --> R[GitLab resource / workspace / runner]
  R --> E[Diff + tests + scans + audit/session evidence]
  E --> H{Human + repository governance}
  H -->|approved| A[Consequential change accepted]
  H -->|rejected| F[Revise or stop]

The diagram intentionally places tool governance before execution and independent verification after execution. A model can recommend a write, but a write should still face both the tool policy and normal GitLab authorization. A generated merge request must still face branch protection, required pipelines, code review, security policy, and human judgment.

4. Availability is a vector, not one “AI enabled” switch

When a feature is missing, check each dimension independently. A user can have enough project role but no eligible subscription/add-on. A group can have credits but have Agent Platform disabled. A beta feature can be disabled by the feature-preview setting. A Self-Managed instance can be on an older release. A flow can be enabled but remain queued because no compatible runner is available.

Gate Example question Evidence to inspect
Offering / version GitLab.com, Self-Managed, or Dedicated? Which release? Instance/version page or current documentation
Tier / add-on / credits Does this feature require Premium/Ultimate, Duo Pro/Enterprise, or credits? Subscription/usage settings and feature-specific docs
Feature maturity GA, beta, experiment, or feature-flagged? Feature page history/support level
Namespace configuration Is Duo / Agent Platform enabled at the relevant root/group/project? GitLab Duo settings; inherited controls
Role / membership Owner, Maintainer, Developer, member? Members and feature prerequisites
Execution Does the flow require hosted/self-managed Runner, tag, supported executor, network? AI session + pipeline/runner state
Tool governance Is requested tool allowed, approval-gated, or denied? Group/project governance matrix

5. Credits and add-ons are different commercial mechanisms

GitLab Credits are the usage currency for the Agent Platform. GitLab documents credit consumption at the top-level group/root namespace level and supports credit pools/usage billing patterns that can change over time. The older/non-agentic Duo Pro and Duo Enterprise feature set uses add-on entitlement rather than Agent Platform usage credits. Some features have both agentic and non-agentic variants, so “Chat used no credits yesterday” is not a reliable universal rule.

Course rule: do not enable a trial, purchase a credit pool, accept on-demand billing, or consume paid compute just to complete this chapter. Use the fixtures unless you already have an authorized sandbox and explicitly choose the optional live path.

Cost control belongs in governance because an agent can perform many model actions or invoke background flows. Budget owners need usage visibility, while developers need a graceful fallback when a feature is unavailable. Core GitLab functionality should not depend on an AI feature staying available.

6. Data and privacy: identify exactly what crosses each boundary

GitLab Duo features can send prompts and selected context to GitLab AI services and model subprocessors. Current GitLab documentation names multiple model providers and states that GitLab does not train generative AI models on customer content. Retention behavior is not identical for every provider/model or every product feature. Chat/workflow history, prompt caching, optional expanded/usage logging, and self-hosted model configurations introduce additional boundaries.

Data class Safe lab treatment Production question
Public/synthetic code Allowed in this course fixture Is the repository actually approved for the selected AI service?
Private source / customer data Do not submit for the lab Which processor/model receives it and what policy/contract applies?
Secrets / credentials Never submit Can context collection or logs include credentials? How are they prevented/redacted?
Vulnerability details Synthetic only Has security data sharing been approved and explicitly enabled where required?
Prompt + response Synthetic only Is history retained? Is optional usage logging enabled? Who can access it?
Tool results Synthetic and redacted Can API/tool output reveal private resource content or identifiers?
Prompt caching is not the same as model training, and optional usage logging is not the same as model-provider retention. Treat each as a separate data-processing control and verify current documentation.

7. Tool governance adds a human-in-the-loop boundary

Current Agent Platform tool governance classifies tools as read, write, or delete actions and supports Always Allow, Always Ask, and Always Deny. An approval card for Always Ask exposes the intended tool action before execution. Rules can be set centrally and narrowed at project level; project rules cannot be less restrictive than the governing group rule. GitLab documents fail-closed behavior for persistent governance-resolution errors.

Mode Use when Risk if misused
Always Allow Low-impact, read-only operations whose data exposure is approved Silent access can still expose sensitive context or amplify prompt-injection effects
Always Ask Interactive writes/deletes needing explicit human confirmation Approval fatigue can turn meaningful review into reflexive clicking
Always Deny Action/tool is outside policy or task intent Overly broad denial can reduce utility but preserves the boundary

Background runner execution needs special care: there may be no human present to answer an interactive approval prompt. Current documentation says Runner governance supports only allow/deny, not Always Ask. Therefore high-impact background actions should default to deny unless a separately approved workflow and protected environment can safely authorize them.

8. RBAC, composite identity, and tool governance answer different questions

GitLab role-based access control determines whether an authenticated principal may access a project/resource. Agent tool governance determines whether the AI is allowed to attempt a particular tool. Flows can use service-account/composite-identity mechanisms so execution does not escape the initiating user’s authorized scope. These controls overlap but are not substitutes.

Control Question it answers What it cannot prove
GitLab role / protected resource May this principal mutate the target resource? That AI should make this mutation
Tool governance May an agent invoke this tool in this context? That the tool call is semantically correct
Flow execution identity Which principal/service account actually calls GitLab? That the model selected the right action
MR/pipeline/security policy Does proposed code meet repository controls? That business intent was understood correctly
Human approval Does a responsible person authorize this consequence? That tests/security evidence are complete

9. AI security remediation is an untrusted proposal, not an automatic truth source

Vulnerability Explanation and Vulnerability Resolution can accelerate analysis and generate proposed fixes for supported findings, but GitLab explicitly warns that AI output is not guaranteed correct. The review target is not “does the patch look plausible?” It is: does the scanner finding disappear for the right reason, do tests preserve behavior, does the diff avoid unrelated scope expansion, and does the patch follow project security standards?

AI REMEDIATION REVIEW RECORD
Finding: synthetic path traversal in template lookup
Proposal source: fixture (no live AI call)
Expected security invariant: resolved path must remain under approved base directory
Functional invariant: valid template names still load
Evidence required:
  - focused unit tests
  - negative traversal test
  - diff review
  - security finding / static analysis re-check
  - no new external dependency or privilege
Decision: APPROVE / REJECT with reviewer and evidence IDs

10. Read-only inspection comes before enabling or spending

In a real namespace, start by documenting current state. Do not click “enable,” start a trial, accept billing terms, or run a flow merely to discover whether the feature exists. Inspect the current GitLab Duo settings, feature documentation, subscription/credit state, feature-preview configuration, user role, and runner requirements first.

READ-ONLY PREFLIGHT
[ ] offering and exact GitLab version recorded
[ ] top-level namespace/group identified
[ ] user role recorded
[ ] feature-specific tier/add-on/credits requirement verified in current docs
[ ] GitLab Duo availability inherited state recorded
[ ] Agent Platform availability recorded
[ ] beta/experimental feature-preview setting recorded
[ ] data/privacy and prompt-caching settings reviewed
[ ] tool-governance policy reviewed
[ ] flow runner/network requirement reviewed
[ ] no billable/trial setting changed

Knowledge check

Why should GitLab Duo non-agentic features and the Agent Platform be taught separately?

Does Always Ask replace GitLab permissions?

Why is an AI-generated security fix not evidence that the vulnerability is resolved?

Why can an AI feature be unavailable even when the user has Maintainer access?

What should happen if a background flow would need an interactive approval for a destructive action?

11. Lesson summary and bridge

  • GitLab Duo assistance and Agent Platform automation are related but have different authority, billing, maturity, and execution models.
  • Availability is determined by multiple independent gates: offering/version, tier/add-on/credits, namespace controls, role, feature status, runner state, and tool governance.
  • Data governance must account for prompt/context selection, model/subprocessor boundaries, history, caching, optional logging, and tool results.
  • Tool governance does not replace RBAC, and RBAC does not make an AI-requested action appropriate.
  • AI-generated remediation remains an untrusted proposal until independently verified and approved.

Next, you will convert this mental model into a completely local fixture lab: inspect feature state, classify tools, test remediation proposals, record a denied action, and build sanitized audit evidence without spending credits.

Primary sources and version notes

These lessons were finalized against current official GitLab documentation on 2026-08-22 with GitLab 19.3 as the release baseline. GitLab Duo and the Agent Platform are unusually version-volatile: feature maturity, model selection, credits, availability, governance behavior, UI placement, and data-processing details can change between releases. Re-check the documentation for the exact offering, subscription, add-on, and GitLab version you use. Current documentation notes that agents and several flow capabilities are GA, while AI audit-event reporting and some governance integrations can remain beta or feature-flagged. Do not generalize one feature’s support level to the entire Agent Platform.

Next lesson

Guided Hands-On Workflow and Core Operations

Use completely local fixtures to classify agent tools, test remediation proposals, record an explicit denial, and produce sanitized audit evidence.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this address.