Packaging RL agents for deployment – a trading bot
This is one of the crucial recipes of this chapter, where we will be discussing how to package the agent so that we can deploy on the cloud (next recipe!) as a service. We will be implementing a script that takes our trained agent models and exposes the act
method as a RESTful service. We will then package the agent and the API script into a Docker container that is ready to be deployed to the cloud! By the end of this recipe, you will have built a deployment-ready Docker container with your trained RL agent that is ready to create and offer your Agent/Bot-as-a-Service!
Let’s jump into the details.
Getting ready
To complete this recipe, you will first need to activate the tf2rl-cookbook
Python/conda virtual environment. Make sure to update the environment to match the latest conda environment specification file (tfrl-cookbook.yml
) in the cookbook’s code repository. If the following import
statements run...