> ## Documentation Index
> Fetch the complete documentation index at: https://docs.augmentcode.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate GitLab Self-Hosted

## Introduction

In this page we’ll learn how to configure those items:

1. Get Gitlab to push events (ex: “new MR created”) to Augment Cosmos via webhooks
2. Configure a Cosmos Daemon on a AWS EC2 instance/VM (where the Gitlab local repos will be cloned locally)
3. Get Augment Cosmos to interact with Gitlab via the `glab` cli
4. Deploy your first Cosmos MR experts

Below is the flow we’ll configure with a simple MR reviewer expert:

```mermaid theme={null}
sequenceDiagram
	autonumber
	participant A as Augment Code | Cosmos
	participant AWS as AWS EC2
	participant GL as GitLab Self-Hosted
	GL->>A: Webhook: Merge Request created (MR payload)
	A->>AWS: run experts locally via Daemon
	AWS->>AWS: Start Expert (spawn/run expert agent)
	AWS->>AWS: Expert analyzes MR (diff + context)
	AWS->>GL: POST MR comment (GitLab CLI: create comment)
	GL-->>AWS: 201 Created (comment posted)
```

Below is a high level architecture diagram of the components at play:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-01.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=57cbb630ffe1de390e9846d20a45662c" alt="" width="2322" height="1304" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-01.png" />

## Prerequisites

To configure the one-time connectivity between Cosmos and Gitlab:

**Cosmos**

* must be an admin to create a Augment service account and webhooks

**Gitlab Self-Hosted**

* must have at least Maintainer or Owner role on a given project, or be Owner of a group that has access to given projects
* allow inbound connections from other VMs on your VPC (inbound calls will come from within your network)

**AWS**

* must have the ability to deploy EC2 instances in a VPC that has network connectivity to your Gitlab self-hosted. Must enable outbound network connectivity to \*.[augmentcode.com](http://augmentcode.com/) (see [https://docs.augmentcode.com/setup-augment/network-configuration](https://docs.augmentcode.com/setup-augment/network-configuration))

## Step 1 - Configure Gitlab to notify a Cosmos Webhook

### Webhook receiver in Cosmos

Let’s create a new webhook in Cosmos (so Cosmos can listen to Gitlab events):

* As an admin go to Cosmos ([https://cosmos.augmentcode.com](https://cosmos.augmentcode.com/)) > Settings > Webhooks > Create a webhook > Select type: GitLab > Enter Description: **GitLab MR events**

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-02.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=958a11df92f08cdb5f0330dab5fcc9ea" alt="" width="1770" height="1006" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-02.png" />

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-03.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=90a65ac0027aa1a7f7894d368d48d3ff" alt="" width="1744" height="1482" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-03.png" />

Make sure to copy the provided Webhook URL and the Secret token, then click on Create. You’ll get a confirmation that the webhook is ready to use.

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-04.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=593ffb0f0a2208effa1ce75ae66301f7" alt="" width="1542" height="744" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-04.png" />

Run this curl request (with your own parameters) to do a quick test:

```shell theme={null}
curl -i -X POST "https://XXX.api.augmentcode.com/webhooks/XXX" \
  -H "Content-Type: application/json" \
  -H "X-Gitlab-Event: Push Hook" \
  -H "X-Gitlab-Token: whsec_XXX" \
  -d '{"event": "test", "data": "your payload here"}'
```

You should get this response:

```plain text theme={null}
HTTP/2 200
content-length: 30
content-type: application/json
date: Sun, 02 Aug 2026 23:23:23 GMT
via: 1.1 google
alt-svc: h3=":443"; ma=2592000

{"message":"Webhook accepted"}%
```

### Webhook sender in Gitlab

Create a new webhook config in Gitlab\*\* \*\*(so Gitlab can POST to a given url when certain Gitlab events occur): as a Maintainer or Owner, go to your Gitlab repo > Settings > Webhooks > Add new webhook > Add those details:

* Name: **Notify Cosmos on MR created/updated/merged/commented**
* URL: the webhook url provided by Cosmos
* Secret token: the secret provided by Cosmos
* Trigger: `Comments` and `Merge request events`
* Custom header: leave empty
* Enable SSL verification: **keep it selected**
* Click on Add webhook

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-05.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=5758e60ce9a61c451ba710758cc26d2d" alt="" width="1754" height="2756" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-05.png" />

Now run a test: in Gitlab go back to your list of Gitlab webhooks (Settings > Webhooks) > click on the Test dropdown > Merge request events

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-06.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=87c5c4676b2eb46059255c3a8b492095" alt="" width="1700" height="906" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-06.png" />

You should see this banner at the top:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-07.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=589a352841e6a1b9588391e1aadb8672" alt="" width="444" height="66" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-07.png" />

Now go back to Cosmos and check that Cosmos received the event:

Cosmos ([https://cosmos.augmentcode.com](https://cosmos.augmentcode.com/)) > Settings > Automations > Events Log. You should see your event with source “Webhook · GitLab”:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-08.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=67886dcdf73bad92e5adf1dab5f076d2" alt="" width="1708" height="496" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-08.png" />

Click on the event to inspect the test payload:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-09.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=146d14eec9929f695c6ae49ccbf1e7f7" alt="" width="1698" height="1596" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-09.png" />

At this point Gitlab will automatically notify Cosmos whenever a MR is created/updated/commented on ✅

## Step 2 - Create a Gitlab Service Account

For headless automation and to start agentic workflows based on Gitlab events, you’ll create a dedicated Gitlab service account and its access token:

Gitlab repo > Settings > Service accounts > Add service account > Add a name (ex: **Cosmos-XXX**) and username (ex: **cosmos-xxx**):

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-10.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=926e952200fc1c1b2e6b84ad5b633c77" alt="" width="1002" height="442" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-10.png" />

Then next to that service account > 3 dots > Manage access tokens

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-11.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=3f68b0857e7a52f1cfe54d64efc494dd" alt="" width="1350" height="632" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-11.png" />

Click on Add new token:

* Enter a token name (ex: **Cosmos01**)
* Set a max expiration date as far out as possible
* Select scope `api`
* Click on Generate token

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-12.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=32d4ae9bd4707e7b547aaeeb3aacbc26" alt="" width="1354" height="1652" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-12.png" />

Click on the copy icon to copy the GITLAB\_TOKEN in your clipboard

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-13.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=7aa58fe4edac7aea2f98493d45c8613e" alt="" width="1356" height="838" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-13.png" />

Now get back to Gitlab and add your Gitlab service account with role=`Maintainer` onto the repos where the service account should be able to read/post (add it per repo or add it to the group that manages all the repos):

Go to your Gitlab repo(s) > Manage > Members > Invite members > add your Gitlab service account and click on Invite:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-14.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=8a891740a6ac9e904434ddcba20fe03b" alt="" width="664" height="642" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-14.png" />

Now your Gitlab service account has permissions to collaborate across your repos.

## Step 3 - Create a Augment service account

Before we start the websocket tunnel from your AWS EC2 instance to Cosmos, you’ll need to create a dedicated Augment service account, which will be used to authenticate and start the tunnel.

As an admin go to [https://app.augmentcode.com/](https://app.augmentcode.com/) > Service Accounts > + Add Service Account > Add:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-15.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=21b748e4684eb6e389d6e35a1c4bac3f" alt="" width="674" height="370" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-15.png" />

Then click on + Add API Token:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-16.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=6739835eabc72bdd0a9b9141df63eade" alt="" width="664" height="240" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-16.png" />

Enter an API Token Name (ex: Token01):

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-17.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=2d03bd1849269c7a2c017c8d4d9f81ad" alt="" width="666" height="258" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-17.png" />

Click on Download JSON:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-18.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=5bd0ff8f57ba67dbd2cb8ab63afa4b5f" alt="" width="664" height="642" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-18.png" />

You'll obtain a session.json, it will be used to authenticate the Cosmos daemon later on.

## Step 4 - Create a Cosmos daemon pool

Since you’ll be leveraging a AWS EC2 VM to host your daemon, it’s important to think about uptime and resilience: your VM could loose network connectivity or have an outage. The best practice is to create a daemon pool and attach your daemons to that daemon pool. Then you can later have N daemons (1 per VM) all tied to the same daemon pool, and Cosmos will use that pool which will automatically route to the next available daemon. In this guide you’ll create 1 daemon pool and 1 daemon running in 1 VM, but you can extend that approach to spin up 2 more VMs (and their respective daemons) for max resilience.

Go to Cosmos ([https://cosmos.augmentcode.com](https://cosmos.augmentcode.com/)) > Settings > Environments > Create an environment > Daemon Pool:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-19.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=c12edc37c50a7bb4b217c083a3121874" alt="" width="1502" height="312" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-19.png" />

Configure the pool with:

* Name: **Team01-Pool-Gitlab-SelfHosted**
* Daemon connector: select the dedicated service account you created in the section earlier
* Shared: **toggle on**
* Workspace behavior: `Isolated workspace`

Then click on Create Pool:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-20.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=3031ebe4ee194bba1c85699e6b0a40c8" alt="" width="2138" height="1960" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-20.png" />

You’ll get the confirmation that the pool has been created, note the pool-id:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-21.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=c7864ffc1b11e12576fd63a75ed234bc" alt="" width="894" height="364" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-21.png" />

Go back to your list of environments, you should see your pool (with no daemon online yet):

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-22.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=6ca1aba2b4d7647ea0b1c0b04c467504" alt="" width="2624" height="728" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-22.png" />

## Step 5 - Configure your VM with local Gitlab repos, glab cli and Cosmos daemon

In this section you’ll configure a AWS EC2 VM with the following:

* locally cloned Gitlab repos
* `glab` cli so Cosmos local agents can communicate to Gitlab
* a Cosmos pool + daemon (to establish an outbound websocket tunnel from AWS to Cosmos)

### Create the VM, with git and NVM/node

Create a new AWS EC2 Linux instance (ex: Ubuntu x86\_64 - ami-091138d0f0d41ff90) in a AWS VPC that will be able to reach your Gitlab Self-Hosted instance.

Minimum config recommended: **4 vCPU, 16 GB RAM, 100 GB SSD**

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-23.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=0e0d3b384faa2c40aa759698df18fd3b" alt="" width="2122" height="1258" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-23.png" />

Then SSH onto the AWS EC2 instance.

Install git

```bash theme={null}
sudo apt update && sudo apt install git -y
```

Verify the installation

```bash theme={null}
which git
git --version
```

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-24.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=ce19eeb3c3d050a306a81d6a512ae8d2" alt="" width="636" height="136" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-24.png" />

Install NVM

```bash theme={null}
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
```

Refresh the terminal profile

```bash theme={null}
source ~/.bashrc
```

Install the latest Long-Term Support (LTS) version of Node & NPM

```bash theme={null}
nvm install --lts
```

Verify the node install

```bash theme={null}
node -v
npm -v
```

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-25.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=193c253cdacd525aa8953a68b1216bfd" alt="" width="540" height="132" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-25.png" />

### Git clone your Gitlab repos locally

Create a local \~/workspace/ folder

In that workspace folder create folders for your Gitlab organizations

In the corresponding organization folders, git clone your repos (you need at a minimum an empty git repo with at least one commit for the git worktree configuration to be valid and for the agent to start)

You should have a “2 layers” folder structure like this:

* \~/workspace/augmentcode-sa1/REPO\_A/.git
* \~/workspace/augmentcode-sa1/REPO\_B/.git
* \~/workspace/augmentcode-sa2/REPO\_C/.git
* \~/workspace/augmentcode-sa2/REPO\_D/.git

<Note>
  Note: at this moment you have to own making sure that the git repos are locally cloned and are kept up to date regularly. In a future release, daemons will be able to handle that on your behalf - stay tuned
</Note>

### Install and authenticate the glab CLI

Install the `glab` cli: make sure you’re in your root folder, install the `glab` cli using this command:

```shell theme={null}
LATEST_TAG=$(curl -s "https://gitlab.com/api/v4/projects/gitlab-org%2Fcli/releases" | grep -o '"tag_name":"[^"]*' | head -n 1 | cut -d'"' -f4) && LATEST_VER="${LATEST_TAG#v}" && wget "https://gitlab.com/gitlab-org/cli/-/releases/${LATEST_TAG}/downloads/glab_${LATEST_VER}_linux_amd64.deb" -O /tmp/glab_latest.deb && sudo dpkg -i /tmp/glab_latest.deb && rm /tmp/glab_latest.deb
```

Then authenticate the `glab` cli, run:

```shell theme={null}
echo "<YOUR_GITLAB_PAT_TOKEN>" | glab auth login --hostname gitlab.yourdomain.com --stdin
```

You should see:

```plain text theme={null}
✓ Logged in as cosmos-xxx
✓ Stored your credentials in the configuration file.
```

### Start the daemon

cd into \~/workspace/

run

```shell theme={null}
nano session.json
```

Paste in there the content of session.json you retrieved earlier when creating the Augment service account. Then CTRL-O + RETURN to save the file and CTRL-X + RETURN to exit

Install Auggie

```bash theme={null}
npm install -g @augmentcode/auggie
```

Start the Cosmos daemon using the Augment service account and attach the daemon to the pool, run:

```shell theme={null}
auggie daemon --augment-session-json "$(cat /path/to/session.json)" --pool-id <YOUR-POOL-ID> --discover-workspaces=2 --allow-indexing
```

That will start the daemon, note in your daemon logs:

* “Launch dir is a non-git container; adopting N discovered git repo(s) as workspaces \[…]” ⇒ check that all your local git repos have been discovered
* “Git worktree support: supported”
* “Joining daemon pool: \<YOUR-POOL-ID>”
* “Indexing enabled for workspace: \[…]”
* “Starting Auggie Daemon \[…]”
* “Connecting to Cosmos...”

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-26.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=284e01f2011c1b679d1d7a2ec6b7b1ce" alt="" width="3136" height="1086" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-26.png" />

You can now see the daemon running from Cosmos: Cosmos ([https://cosmos.augmentcode.com](https://cosmos.augmentcode.com/)) > Settings > Environments:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-27.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=42ac4691922baebbcfb8953ec5e8f457" alt="" width="1460" height="708" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-27.png" />

If you click on the pool, then top right you can set this pool as default environment to run your agents:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-28.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=28165c70797e77496b4e13613de70961" alt="" width="1904" height="1352" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-28.png" />

## Step 6 - Connectivity test

Now you’ll create a session in Cosmos (cloud) and verify it can connect to the VM, make sense of the local repos and from that VM reach out to Gitlab via the `glab` CLI.

Go to Cosmos > New Session ([https://cosmos.augmentcode.com/home](https://cosmos.augmentcode.com/home))

Under the prompt, click on the dropdown list with the cloud icon > select Daemon > select your daemon pool:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-29.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=6d7643b6423145cbdff213639ebd1dd0" alt="" width="1410" height="612" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-29.png" />

Prompt the session with **What are those repos about?**, you should see a response powered by the Augment Context Engine that already made sense of your repos:

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-30.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=54ee68e18ffe232a5d49d0a65d2fb0cd" alt="" width="1680" height="1842" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-30.png" />

The connectivity between Cosmos (cloud) and your local VM has been verified ✅

Now prompt the session with: **Use the glab cli to look up \<INSERT-LINK-TO-ONE-OF-YOUR-GITLAB-MR>**

<img src="https://mintcdn.com/augment-mtje7p526w/8BrHp0zhabcfYque/images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-31.png?fit=max&auto=format&n=8BrHp0zhabcfYque&q=85&s=50efa4e3ead8fc395f777160fa9ca64d" alt="" width="2292" height="1166" data-path="images/cosmos-integrations/gitlab-self-hosted/gitlab-self-hosted-31.png" />

Observe that the Cosmos session was able to use the `glab` cli to lookup the MR.

## Step 7 - Create your Cosmos Experts

Now that connectivity is established, you can focus on deploying your Cosmos experts.

You can follow the steps in [https://docs.augmentcode.com/cosmos/gitlab-cloud#step-3-create-a-mr-deep-reviewer-expert](https://docs.augmentcode.com/cosmos/gitlab-cloud#step-3-create-a-mr-deep-reviewer-expert) to create a MR author, MR Deep Code Reviewer etc. The only key difference is you’ll have to explicitly instruct Cosmos Advisor to do the following when deploying those experts:

* <strong>use the <code>glab</code> cli </strong>(instead of the native Gitlab Cloud integration)
* <strong>use your daemon pool </strong>(instead of the cloud environment)
* <strong>use the Gitlab webhook </strong>(instead of the native Gitlab Cloud integration)

<br />Congratulations, you’ve integrated Cosmos with Gitlab Self-Hosted and deployed your first MR experts! 🎉
