> For the complete documentation index, see [llms.txt](https://docs.sealights.io/knowledgebase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/downloading-the-node.js-agent.md).

# Downloading the Node.js Agent

The SeaLights Node.js agent is published in the [npm registry](https://www.npmjs.com/package/slnodejs) and installed with `npm`. There is no separate binary to download.

{% hint style="info" %}
**Using an internal artifact repository?** If your organization mirrors npm packages through Artifactory, Nexus, or another private registry, install `slnodejs` from that registry instead. The package name and version syntax stay the same.
{% endhint %}

## Choosing an installation strategy

There are two ways to control which version to install:

<table><thead><tr><th width="183.666748046875">Strategy</th><th>When to use</th></tr></thead><tbody><tr><td><strong>Latest</strong></td><td>Quick start, dev environments, and POCs</td></tr><tr><td><strong>Specific version</strong> ⭐</td><td>Production pipelines — resolve from API or pin explicitly</td></tr></tbody></table>

## Strategy 1: Install the latest version

This installs the newest published release at runtime. Use it when you want the latest features and can tolerate version changes between runs.

{% tabs %}
{% tab title="Bash" %}
{% code overflow="wrap" %}

```bash
echo "[SeaLights] Installing Node.js agent (latest)..."
npm install slnodejs@latest
npm ls slnodejs --depth=0
```

{% endcode %}
{% endtab %}

{% tab title="GitHub Actions" %}
{% code overflow="wrap" %}

```yaml
- name: Install SeaLights Node.js Agent (latest)
  run: |
    echo "[SeaLights] Installing Node.js agent (latest)..."
    npm install slnodejs@latest
    npm ls slnodejs --depth=0
```

{% endcode %}
{% endtab %}

{% tab title="PowerShell" %}
{% code overflow="wrap" %}

```powershell
Write-Host "[SeaLights] Installing Node.js agent (latest)..."
npm install slnodejs@latest
npm ls slnodejs --depth=0
```

{% endcode %}
{% endtab %}

{% tab title="Azure DevOps" %}
{% code overflow="wrap" %}

```yaml
- script: |
    echo "[SeaLights] Installing Node.js agent (latest)..."
    npm install slnodejs@latest
    npm ls slnodejs --depth=0
  displayName: Install SeaLights Node.js Agent (latest)
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Strategy 2: Specific version (recommended)

Use this strategy in production pipelines. It gives you stable installs and controlled upgrades.

Choose one of these approaches:

* **Installer utility** — simplest path. It resolves and installs the approved version for you.
* **Explicit version management** — no extra package. You control the API call and `npm install` flow directly.

### Approach 1: Installer utility

Use this when you want the approved version from the Dashboard without managing the resolution logic yourself.

To run the installer, provide your SeaLights Agent Token either in `sltoken.txt` at the project root or as the `SL_TOKEN` environment variable.

{% tabs %}
{% tab title="Bash" %}
{% code overflow="wrap" %}

```bash
# Retrieve the SeaLights Agent Token from your vault or secret manager
export SL_TOKEN=$(vault kv get -field=token secret/sealights)

echo "[SeaLights] Installing Node.js agent via installer..."
npm install slnodejs-installer
npm ls slnodejs --depth=0
```

{% endcode %}
{% endtab %}

{% tab title="GitHub Actions" %}
{% code overflow="wrap" %}

```yaml
- name: Install SeaLights Node.js Agent via installer
  run: |
    echo "[SeaLights] Installing Node.js agent via installer..."
    npm install slnodejs-installer
    npm ls slnodejs --depth=0
  env:
    SL_TOKEN: ${{ secrets.SL_TOKEN }}
```

{% endcode %}
{% endtab %}

{% tab title="PowerShell" %}
{% code overflow="wrap" %}

```powershell
# Retrieve the SeaLights Agent Token from your vault or secret manager
$Env:SL_TOKEN = (vault kv get -field=token secret/sealights)

Write-Host "[SeaLights] Installing Node.js agent via installer..."
npm install slnodejs-installer
npm ls slnodejs --depth=0
```

{% endcode %}
{% endtab %}

{% tab title="Azure DevOps" %}
{% code overflow="wrap" %}

```yaml
- script: |
    echo "[SeaLights] Installing Node.js agent via installer..."
    npm install slnodejs-installer
    npm ls slnodejs --depth=0
  displayName: Install SeaLights Node.js Agent via installer
  env:
    SL_TOKEN: $(SL_TOKEN)
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
The installer authenticates with your token, resolves the approved version from the Dashboard, installs that exact `slnodejs` release, and writes `install.log` for troubleshooting.
{% endhint %}

### Approach 2: Explicit version management

Use this when you do not want to install an additional package or when you want full control over the commands in your pipeline.

{% hint style="info" %}
**Tip:** Leave `SL_AGENT_VERSION` empty in the snippets below to resolve the approved version from the Dashboard automatically.

* When the approved version changes, pipelines pick it up on the next run.
* When troubleshooting, set it to `latest` or pin it to `X.Y.Z`.
  {% endhint %}

**API endpoint**

{% code overflow="wrap" %}

```
GET https://{DOMAIN}/api/v2/agents/slnodejs/recommended/version
```

{% endcode %}

* Authentication: `Authorization: Bearer <your-agent-token>`
* Response: JSON object with a `version` field, for example `{"version": "4.2.1"}`

{% tabs %}
{% tab title="Bash" %}
{% code overflow="wrap" %}

```bash
SL_DOMAIN="<your-custom-domain>.sealights.co"   # Replace with your account domain
SL_TOKEN=$(cat ./sltoken.txt)                   # Or inject via secret/env var
SL_AGENT_VERSION=""                             # "" = resolve from API, "latest" = newest, "X.Y.Z" = pin

PKG_SPEC="slnodejs"
if [ "${SL_AGENT_VERSION}" != "latest" ]; then
  if [ -z "${SL_AGENT_VERSION}" ]; then
    SL_AGENT_VERSION=$(curl -sSf \
      -H "Authorization: Bearer ${SL_TOKEN}" \
      "https://${SL_DOMAIN}/api/v2/agents/slnodejs/recommended/version" \
      | grep -o '"version":"[^"]*"' | cut -d'"' -f4)
  fi
  PKG_SPEC="${PKG_SPEC}@${SL_AGENT_VERSION}"
fi

npm install "${PKG_SPEC}"
npm ls slnodejs --depth=0
```

{% endcode %}
{% endtab %}

{% tab title="GitHub Actions" %}
{% code overflow="wrap" %}

```yaml
- name: Install SeaLights Node.js Agent
  env:
    SL_DOMAIN: "<your-custom-domain>.sealights.co"   # Replace with your account domain
    SL_TOKEN: ${{ secrets.SL_TOKEN }}
    SL_AGENT_VERSION: ""   # "" = resolve from API, "latest" = newest, "X.Y.Z" = pin
  run: |
    PKG_SPEC="slnodejs"
    if [ "${SL_AGENT_VERSION}" != "latest" ]; then
      if [ -z "${SL_AGENT_VERSION}" ]; then
        SL_AGENT_VERSION=$(curl -sSf \
          -H "Authorization: Bearer ${SL_TOKEN}" \
          "https://${SL_DOMAIN}/api/v2/agents/slnodejs/recommended/version" \
          | grep -o '"version":"[^"]*"' | cut -d'"' -f4)
      fi
      PKG_SPEC="${PKG_SPEC}@${SL_AGENT_VERSION}"
    fi
    npm install "${PKG_SPEC}"
    npm ls slnodejs --depth=0
```

{% endcode %}
{% endtab %}

{% tab title="PowerShell" %}
{% code overflow="wrap" %}

```powershell
$SL_DOMAIN = "<your-custom-domain>.sealights.co"   # Replace with your account domain
$SL_TOKEN = Get-Content ./sltoken.txt              # Or inject via secret/env var
$SL_AGENT_VERSION = ""                             # "" = resolve from API, "latest" = newest, "X.Y.Z" = pin

$PKG_SPEC = "slnodejs"
if ($SL_AGENT_VERSION -ne "latest") {
  if ([string]::IsNullOrEmpty($SL_AGENT_VERSION)) {
    $headers = @{ "Authorization" = "Bearer $SL_TOKEN" }
    $SL_AGENT_VERSION = (Invoke-RestMethod `
      -Uri "https://$SL_DOMAIN/api/v2/agents/slnodejs/recommended/version" `
      -Headers $headers -Method Get).version
  }
  $PKG_SPEC = "$PKG_SPEC@$SL_AGENT_VERSION"
}

npm install $PKG_SPEC
npm ls slnodejs --depth=0
```

{% endcode %}
{% endtab %}

{% tab title="Azure DevOps" %}
{% code overflow="wrap" %}

```yaml
- script: |
    PKG_SPEC="slnodejs"
    if [ "${SL_AGENT_VERSION}" != "latest" ]; then
      if [ -z "${SL_AGENT_VERSION}" ]; then
        SL_AGENT_VERSION=$(curl -sSf \
          -H "Authorization: Bearer ${SL_TOKEN}" \
          "https://${SL_DOMAIN}/api/v2/agents/slnodejs/recommended/version" \
          | grep -o '"version":"[^"]*"' | cut -d'"' -f4)
      fi
      PKG_SPEC="${PKG_SPEC}@${SL_AGENT_VERSION}"
    fi
    npm install "${PKG_SPEC}"
    npm ls slnodejs --depth=0
  displayName: Install SeaLights Node.js Agent
  env:
    SL_DOMAIN: "<your-custom-domain>.sealights.co"
    SL_TOKEN: $(SL_TOKEN)
    SL_AGENT_VERSION: ""
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/downloading-the-node.js-agent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
