ReAgent CLI & Python API

We have CLI to launch training & Python API to use programmatically, e.g., in your own script or Jupyter Notebook. To install this component, you will need to have Python 3.8+ installed on your system. If you don’t have that, you can either install it via pyenv or conda. To verify that you have the right version, type the following command on your shell:

python --version

Once you make sure you have the right version, you can simply clone this repo and pip install

git clone
cd ReAgent
pip install ".[gym]"

# install nightly torch (change cpu to cu102 if fit)
pip install --pre torch torchvision -f

If you don’t want need gym dependencies, you can remove [gym]

To verify your setup please run tox.

pip install tox

Spark preprocessing JAR

If you don’t want to rebuild the JAR, you can grab the pre-built version from CircleCI, under the artifact section of end_to_end_test.

To build from source, you’ll need JDK, Scala, & Maven. We will use SDKMAN! to install them.

curl -s "" | bash
source "$HOME/.sdkman/bin/"
sdk version
sdk install java 8.0.292.hs-adpt
sdk install scala
sdk install maven

If you are testing locally, you can also install Spark

sdk install spark 3.1.1

Now, you can build our preprocessing JAR

mvn -f preprocessing/pom.xml clean package

RASP (Not Actively Maintained)

RASP (ReAgent Serving Platform) is a decision-serving library. It also has standlone binary. It depends on libtorch, which cannot be statically linked at the moment. Therefore, we don’t have a pre-built version.

To build the CLI, you’ll need CMake and the following libraries:

If you don’t have those requirements, one easy way to get them is through conda. We recommend miniconda for this purpose. If you want to install those requirements via conda, you can type this in the shell:

conda install --file rasp_requirements.txt

To get libtorch, please go to pytorch. Please make sure to download the “Preview (Nightly)” since our code is tested with that version. Below, we assumed you put the extracted file at $HOME/libtorch.

You will also need to make sure to init git submodules

git submodule update --force --recursive --init --remote

Now, you are ready to build

mkdir -p serving/build
cd serving/build