Automations | GitLab Docs
/ Automations Tier : Premium, Ultimate Offering : GitLab.com, GitLab Self-Managed, GitLab Dedicated Introduced in GitLab 18.3 as an experiment with a feature flag named ai_flow_triggers . Enabled by default. Generally available in GitLab 18.8. Feature flag ai_flow_triggers removed in GitLab 19.1. Renamed from triggers to automations in GitLab 19.6 with a flag named duo_automations . Enabled by default. An automation determines when a flow or external agent runs.
An automation cannot be created for a custom agent or foundational agent. An automation is one of two kinds: An event-based automation runs a flow when something happens in the project, for example when someone mentions the service account or a pipeline fails. A scheduled automation runs a flow at a recurring time, for example every weekday at 9:00 AM. Detail Event-based automation Scheduled automation What starts the run An action by a person, such as a mention or an approval The schedule.
No person starts the run. Who the flow runs as The service account of the flow, with composite identity A dedicated service account , without composite identity What the flow receives For a mention, the comment. For other events, the web address of the merge request, work item, or project. The web address of the project To run the same flow on an event and on a schedule, create two automations. View automations Changed in GitLab 19.6 to allow the Developer role to view triggers.
Prerequisites: You must have at least the Developer role for the project. To view the automations for a project: In the top bar, select Search or go to and find your project. In the left sidebar, select AI > Automations . Event-based automations An event-based automation runs a flow when one of its conditions occurs, for example when someone assigns the service account as a reviewer. An automation can have several event conditions.
Create an event-based automation Configuration path option changed in GitLab 18.9 to require a flag named ai_catalog_create_third_party_flows . Disabled by default. Merge request ready and Merge request code conflict event types consolidated into the Merge request event type as the Marked ready and Merge conflict actions in GitLab 19.2. Trigger creation form changed to add conditions one at a time in GitLab 19.3. The availability of the Configuration path option is controlled by a feature flag.
For more information, see the history. Prerequisites: You must have the Maintainer or Owner role for the project. To create an automation: In the top bar, select Search or go to and find your project. In the left sidebar, select AI > Automations . Select New automation . In Name , enter a name for the automation. From the Runs with dropdown list, select one of the following: A flow or external agent enabled in the project.
If the Developer Flow is enabled, it is selected by default. Configuration file . Then, in Configuration path , enter the path to the flow configuration file (for example, .gitlab/duo/flows/claude.yaml ). From the Service account dropdown list, select a user to be the composite identity . To view this option, the ai_catalog_create_third_party_flows flag must be enabled. If the Instructions field is shown, enter what the flow must do.
For the Developer Flow, instructions are required. For more information, see Add instructions . Under Runs when , if a schedule is open, select Cancel . A new automation starts with a schedule when the flow can run on a schedule. For each event that should start the automation: Select Add trigger > On an event . From the Select an event dropdown list, select an event type . If the event type has actions, from the Run when dropdown list, select one or more actions.
Select Add event . Select Create . The automation now appears in AI > Automations . Event types Name Description Configuration Introduced in Mention When the service account user is mentioned in a comment on an issue or merge request. None GitLab 18.3 Assign When the service account user is assigned to an issue or merge request. None GitLab 18.5 Assign reviewer When the service account user is assigned as a reviewer to a merge request.
None GitLab 18.5 Pipeline events When a pipeline changes state. From the Run when dropdown list, select one or more of the following: - Running - Passed - Failed - Canceled GitLab 18.9 as an experiment . Generally available in GitLab 19.1. Merge request When a selected merge request action occurs. From the Run when dropdown list, select one of the following: - Approved : When a merge request has all required approvals.
Introduced in GitLab 19.1. - Created : When someone creates a merge request, draft or ready, and GitLab generates its diff. GitLab syncs code owner approval rules against that diff before the flow runs, unless the merge request joins a merge train or GitLab cannot reload the diff. Introduced in GitLab 19.4 . - Marked ready : When a draft merge request is marked as ready for review. Introduced in GitLab 19.0 . - Merge conflict : When a merge request can no longer be merged due to a code conflict.
Introduced in GitLab 19.1 . - Merged : When a merge request merges. The flow runs only when a Developer Flow session created the merge request or ran on it. An automation that runs the Developer Flow does not start a session on this action. For the user that the flow acts for, see actions that don’t initiate an automation . Introduced in GitLab 19.6 . GitLab 19.1 Work item When a selected work item action occurs. From the Run when dropdown list, select one of the following: - Created : When a work item is created.
Introduced in GitLab 19.1. - Status changed : When a work item’s status changes. When Status changed is the only selected action, you can select one or more statuses to run the flow only when the work item changes to one of them. Introduced in GitLab 19.2 . Status selection introduced in GitLab 19.5 . For both actions, from the Type dropdown list, you can select work item types to run the flow only for those types. When you select types, the Status dropdown list shows only the statuses of those types.
If the selected types do not use a selected status, the list shows that status in a separate group, so that you can clear it. When you select no type, the same applies to a status that no type uses. Type selection introduced in GitLab 19.6 . GitLab 19.1 Work item type IDs In the GraphQL API, the filter argument of the aiFlowTriggerCreate and aiFlowTriggerUpdate mutations sets the work item type filter with a work_item_type_id rule.
The rule uses the in operator to run the flow only for the listed types, or the not_in operator to run the flow for all other types. The value is a list of work item type IDs. The IDs are integers, for example 5 . GitLab rejects a string such as "5" . For example, this filter runs the flow only when the status of a task changes to In dev : json { "work_item" : { "rules" : [ { "field" : "action" , "operator" : "in" , "value" : [ "status_changed" ] }, { "field" : "status.name" , "operator" : "in" , "value" : [ "In dev" ] }, { "field" : "work_item_type_id" , "operator" : "in" , "value" : [ 5 ] } ] } } The default work item types have the same ID on every GitLab instance: Work item type ID Issue 1 Incident 2 Test Case 3 Requirement 4 Task 5 Objective 6 Key Result 7 Epic 8 Ticket 9 Custom work item types have other IDs.
To find the ID of a type, query the workItemTypes field of the project. The ID is the number at the end of the id of the type. The automation form shows and changes only in rules. For a not_in rule, the Type dropdown list shows Any type , and the form keeps the rule. If you change the types in the form, the form replaces the not_in rule. Automations for foundational flows An automation runs only when its foundational flow is turned on for your group or project.
For more information, see turn foundational flows on or off . Foundational flows can start in the following ways: Default automations that GitLab adds when you
The rest of this page is on the live site.