Lifecycle scripts

What are lifecycle scripts?

Lifecycle scripts execute inside of the sandbox environment to setup and tear down challenges, give your learners feedback on their solution, or to automatically solve a challenge.

It is common to write the scripts in Bash, but you can write them in any language supported on your environment.

Scripts types

There are four types of challenge lifecycle scripts:

And one track life cycle scripts:

You can also use lifecycle scripts to publish events to external systems. For example, you can publish an event when a user starts a track. Use the script parameters to correlate these events with data in your own systems.

Script parameters

The Instruqt platform injects a set of parameters using environment variables into every script:

Environment Variable



The ID of the track


The ID of the challenge that the script is running on. This can be empty, in case of a track cleanup script.


The ID of the participant. This value is guaranteed to be unique for every play of a track, i.e. when a user starts the same track twice, the IDs will differ.


The ID of the track invite. It is only present if the user accessed the track via an invite link.


The ID of the user. This value uniquely identifies a user. This value can be empty, in case a script is run as part of a pooled instance.


The full name of the user (as they have entered it when creating their account). *


The email address of the user *


Whether the user accepted the organization's privacy policy.

* This value will only be present if the user has given consent to share their details. For example, if a learner started a track through a track invite.