# Runtime parameters

## Overview

Runtime parameters are key/value pairs that are injected as environment variables into [lifecycle scripts](/sandboxes/lifecycle-scripts.md). The values for runtime parameters can be hard coded values, or sensitive values fetched from our [secrets ](https://docs.instruqt.com/concepts/secrets)feature.

{% hint style="info" %}
Runtime parameters are only injected during lifecycle script executions and are by default not stored in / accessible via containers or virtual machines.
{% endhint %}

{% hint style="warning" %}
Runtime parameters specified when starting a track via the API will override the values configured on an invite if there are duplicate keys.
{% endhint %}

## Configure runtime parameters

Select the sharing method appropriate to your use case.

{% tabs %}
{% tab title="🌐 Embed" %}

1. Copy the [embed URL](/tracks/share/embed-a-track.md) of the track you want to add runtime parameters to.&#x20;
2. Append `rtp_<name>=<value>` or `rts_<name>=<value>` to the URL for runtime parameters and secrets, respectively. In either case, the `<name>` value will be available as an environment variable in lifecycle scripts.&#x20;

The following example sets an environment variable called `USER_ID` to the value `testuser` and an environment variable called `API_KEY` to the value in the configured in the secret named `SECRET_API_KEY`.

```bash
https://play.instruqt.com/embed/TEAM/tracks/EXAMPLE?token=TOKEN&rtp_USER_ID=testuser&rts_API_KEY=SECRET_API_KEY
```

{% endtab %}

{% tab title="✉️ Invites" %}

1. Select the invite you want to add runtime parameters to. Learn how to create invites [here](/tracks/share/track-invite-links.md).&#x20;
2. Below the **Add content** section, beside *Advanced options*, click **+Runtime parameters.**&#x20;
3. Click the **Add secret** or **Add variable** buttons to add a secret or variable parameters.&#x20;
   * For **Secrets** you will input a key (any name you like) and select a value (an existing secret)
   * For Variables you will input a key and a value.
4. Repeat as needed, adding as many parameters as needed.
5. Click **Save changes** in the bottom-left corner.&#x20;
   {% endtab %}

{% tab title="🧪 Track test" %}
To specify runtime parameters in track tests, use the `--runtime-parameters` flag where the value is a comma delimited list of key/value pairs separated by an `=` sign.&#x20;

To specify runtime secrets use the `--runtime-secrets` flag where the value is a comma delimited list of key/value pairs separated by an `=` sign and the value part is the name of a secret.

The following example sets an environment variable called `USER_ID` to the value `testuser` and an environment variable called `API_KEY` to the value in the configured in the secret named `SECRET_API_KEY`.

```
instruqt track test TEAM/TRACK --runtime-parameters=USER_ID=testuser --runtime-secrets=API
```

{% endtab %}

{% tab title="🔥 Hot start" %}
&#x20;If you are making use of [hot start](https://docs.instruqt.com/concepts/hot-start) tracks, runtime parameters will not be available in the sandbox setup script. \
\
Tracks that need to be hot started and make use of runtime parameters should do setup in the first challenges setup script.
{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.instruqt.com/sandboxes/runtime/runtime-parameters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
