Self-hosted On-demand Runtime Environments
On-demand Runtime Environments are a way of executing robots on self-hosted infrastructure. On-demand Runtime Environments allow for spinning up a runtime environment only when there is a need to run a robot. Compared to having Workforce Agents running on VM's or dedicated servers, the on-demand way of running can bring significant cost savings.
The runtime environments can be containers running on Kubernetes, virtual machines running on Cloud infrastructure, or anything else that can connect to Control Room as a runtime environment.
On-demand Runtime Environments -feature is available on Pro and Enterprise plans. To ensure a smooth and secure implementation, we encourage getting in touch with your customer success representative to plan the deployment together with us.
On-demand Runtime Environment Provisioner
To use On-demand Runtime Environments, an On-demand Runtime Environment Provisioner is needed. The provisioner is a service that runs on local infrastructure, listens for requests for new environments from Control Room, authenticates those requests, and starts and stops environments as requested.
The provisioner provides a webhook endpoint that allows Control Room to communicate with the provisioner. This means the webhook endpoint needs to be accessible over the internet.
The request is authenticated using a Hash-based Message Authentication Code (HMAC) and a shared secret configured to Control Room and the Provisioner.
The request to start a new runtime environment contains a one-time link token, runtime environment ID and workspace ID. The provisioner is responsible for starting a new runtime environment that links itself to Control Room using the link token provided.
Control Room will recognize when the runtime environment with the correct runtime environment ID and workspace ID is linked and will immediately start the execution of the needed robot on it.
The following is an example sequence diagram of executing a simple process that contains only one step that uses On-demand Runtime Environments.
On-demand Runtime Environment Provisioner API
Documentation for the API can be found under the Control Room APIs and webhooks documentation.
Example implementations of the API done in Typescript can be found in the examples described in the following chapters.
Robocorp provides two example implementations of On-demand Runtime Environment Provisioners. The examples are designed to be production quality, but modifications may be required to adapt them to fit specific use cases.
The Kubernetes example executes robots on containers in the Kubernetes cluster are started when robot execution is requested and immediately shut down once robot execution is finished.
The example contains an example Terraform project for provisioning the required infrastructure, a scaffold project for the provisioner and a helm chart for deploying it. The actual provisioner is written in Typescript and uses an Express server for the webhook.
You can find a Kubernetes example on Robocorp Github
Azure Windows VM Provisioner
The Azure example executes robots in a virtual machine where every robot gets its own virtual machine provisioned that are torn down after the robot completes. The robot is booted into a Windows VM, which you can also configure to install custom windows software on the machine image itself. The VM itself is booted against an actual user session, allowing windows UI automation in a repeatable fashion against machines that scale with each robot.
The example contains Azure functions - application that does the provisioning and teardown, terraform infrastructure and a way to build the azure VM image.
You can find Azure example on Robocorp Github
Control Room Configuration
Adding a new On-demand Runtime Environment
You can add On-demand Runtime Environments from the Environments page.
Using On-demand Runtime Environments for a robot
Configured On-demand Runtime Environments can be used as an execution environment for process steps.
When a process step with an On-demand Runtime Environment is executed in Control Room following actions happen:
- Control Room calls the configured On-demand Runtime Environment Provisioner, which triggers the environment start and linking.
- Control Room detects when the linked environment comes online and the step execution starts on that runtime environment.