Release workspace agents as an experimental feature
What does this MR do and why?
Workspace agents are custom sub-agents that a project defines in .agents/agents/*.md on its default branch. Duo Developer can use them.
We decided to release them as an experimental feature, with no new project setting. They are available when the existing Feature preview setting for GitLab Duo experiment and beta features is on. There is no per-project control:
- On GitLab.com, it's a top-level group setting, changed by a group Owner in the group's Settings > GitLab Duo. All subgroups and projects in the group follow it.
- On GitLab Self-Managed and GitLab Dedicated, it's an instance setting, changed by an administrator in Admin > Settings > GitLab Duo. All groups and projects follow it.
Projects that don't want agents can keep the files out with .gitignore or push rules.
Changes:
API::Helpers::DuoWorkflowHelpers#push_feature_flagsnow addsdap_workspace_agentsto thex-gitlab-enabled-feature-flagsheader when the setting is on. This is a deliberate, temporary hack for the experimental release. No AI Gateway change is needed.Ai::DuoWorkflows::StartWorkflowServicealways reads the repository's agents and passes them to remote sessions. The AI Gateway decides whether to use them.- The
dap_workspace_agentswip feature flag is removed.
Why the AI Gateway header?
Agents run in two places:
- Locally. Duo CLI reads the files from disk and sends them.
- Remotely. GitLab reads them from the repository for CI sessions.
The AI Gateway is the only place that sees both. It already gates workspace agents on the dap_workspace_agents name in the x-gitlab-enabled-feature-flags header. So the simplest way to gate both paths is to send that name in the header when the setting is on. We don't expect the experimental release to last long, so we want an easy approach that ships in 19.5.
References
- Decision: gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#2965 (comment 3937064271)
- Feature issue: #622600 (closed)
- Feature flag rollout issue (to close after cleanup): #627782
- MR that introduced workspace agents: !253760 (merged)
- AI Gateway gating code: https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/blob/c61ab3bdd2083c94bb2f15dd4efc3e1288617652/duo_workflow_service/agent_platform/v1/catalog/sources/base.py#L73
Screenshots or screen recordings
Not applicable. This is a backend-only change.
How to set up and validate locally
-
In a GDK project with GitLab Duo Agent Platform working, commit
.agents/agents/reviewer.mdto the default branch with this content:--- name: reviewer description: Reviews diffs. tools: read_file --- Be picky. -
Turn the setting on. In the Rails console, run
ApplicationSetting.current.update!(instance_level_ai_beta_features_enabled: true). You can also go to Admin > Settings > GitLab Duo > Change configuration, and under Feature preview select Use experiment and beta GitLab Duo features. -
Start a Duo Developer session in that project, locally with Duo CLI or remotely. Ask it to use the
revieweragent. The agent should be available. -
Turn the setting off with
ApplicationSetting.current.update!(instance_level_ai_beta_features_enabled: false). Start a new session. Check that therevieweragent is no longer available.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.