KuBots
This section will detail the steps required to develop and deploy a Kubot (aka assisted robot) using the KuBot Manager application.
Recommended readings before continuing:
The robot (aka KuBot)
Just as we said here, a Kubot is nothing more than an executable computer program that will normally run on the personal computer of the user it assists.
The development of the robot itself is beyond the scope of this documentation since this will depend on its business process. However, you can consult the step by step examples present in the documentation. However, as highlights, the following questions will probably be addressed during its development:
- Development language. If you are starting development from zero, a quick start might be to use Python as your programming language
- If you need application or web access through browsers, we recommend using Playwright or Playwright Python instead of Selenium, but that's just a recommendation. In that case, and if you use Python, we also recommend, we also recommend using browser management using the robocorp-browser open source library that act as wrappers for Playwright.
- Use the KuFlow SDKs to integrate the results produced by the robot into KuFlow tasks and processes.
- If you need extra dynamic configurations for your robot, use environment variable support.
KuBot package
The package that must be uploaded to the KuFlow cloud app is a ZIP package that contains at least a manifest file in YAML format that we call kubot.yaml
and the KuBot code or binaries as necessary.
The zip structure is the following:
ZIP_ROOT:
# Manifest: mandatory
./kubot.yaml
# KuBot code or binaries following a free structure: mandatory
./kubot_code_or_bin
# Any other
./any-other-0
./...
./any-other-n
KuBot manifest
This is a yaml file with an established format that controls which robots are distributed in the package, what execution environment they need, and automated instructions for their installation. This estructure is the next one:
Operations
This is a list that contains the robots present in the package and their execution command. Understanding by command, the instruction that would be written in a terminal and that would allow the robot to start.
operations:
- name: Extract a selected Google images
shell: >
python -m robocorp.tasks run robots/tasks.py
--output-dir ${KUFLOW_EXECUTION_OUTDIR}
-t run_robot
- name: Get user environment vars
shell: python robots/tasks-print-env.py
Tools
Robots need tools available for their execution and that these be isolated from those of other robots and those of the system. For example, a robot may need a specific version of Python or require Node or other software to run. This section lists the necessary ones so that the KuBot Manager application can install them automatically.
For example:
tools:
python: 3.11.4
Available tools:
python
It is an embedded distribution and comes with the latest version of Pip installed.nodejs
If you need anything else, you can request it from us.
Post-install
List of instructions that will be executed after installing the tools and that allows you to finish configuring the execution environment.
For example, if your robot is written in Python, you probably don't want to include dependencies in the package since they could be platform-dependent. So this is when the dependencies would be resolved by installing them for example with PIP. But remember that this is totally free and is based on your needs.
Example:
post-install:
- name: Install dependencies
shell: pip install -r requirements.txt
- name: Install browsers
shell: python -m robocorp.browser install chromium --isolated
So for example, a final manifest would be:
# kubot.yaml manifest
operations:
- name: Browser screenshot
shell: >
python -m robocorp.tasks run robots/tasks.py
--output-dir ${KUFLOW_EXECUTION_OUTDIR}
-t run_robot
tools:
python: 3.11.4
post-install:
- name: Install dependencies
shell: pip install -r requirements.txt
- name: Install browsers
shell: python -m robocorp.browser install chromium --isolated
This manifest must always exist in the root of the package and must be called “kubot.yaml”.
KuBot configuration
The next step is to upload our package to the KuFlow cloud application and configure it. To learn more about the on-screen options for this action, see the related documentation.
Environment variables
Sometimes it may be necessary to configure environment variables that control the Kubot deployment (installation and execution), such as proxies, specific certificate stores or configurable options for the KuBot.
Typical configurations in restricted environments
Proxy
If we needed to specify a proxy, we could require the following variables:
HTTP_PROXY = http://my-proxy:8080
HTTPS_PROXY = https://my-proxy:8083
Specific certificate store
In some private enterprise environments we might need to configure a specific certificate store for certain tools. Let's imagine that we distribute a certificate store in the root of the KuBot package, the configuration would be as follows:
For NodeJs:
NODE_EXTRA_CA_CERTS = ca-certs.pem
For Python:
SSL_CERT_FILE = ca-certs.pem
CURL_CA_BUNDLE = ca-certs.pem
REQUESTS_CA_BUNDLE = ca-certs.pem
How the environment variables mechanism works
KuBot manager has a mechanism that provides the exposure of environment variables to the KuBot both at the time of installation on the client and at each execution of the robot. To do this, it builds an environment where it exposes the variables defined by the Kubot administrators along with a series of variables that are automatically exposed by KuBot Manager.
List of automatically defined variables.
Name | Description | Available on Install | Available on Execution |
---|---|---|---|
KUFLOW_API_ENDPOINT | KuFlow API REST Endpoint | X | X |
KUFLOW_API_TOKEN | Current user token | X | X |
KUFLOW_API_TOKEN_EXPIRE_ON | User token expiration in milliseconds | X | X |
KUFLOW_TENANT_ID | Organization identifier | X | X |
KUFLOW_PROCESS_ID | Process identifier that requested KuBot Execution | - | X |
KUFLOW_TASK_ID | Task identifier that requested KuBot Execution | - | X |
KUFLOW_ROBOT_ID | KuBot identifier | X | X |
KUFLOW_ROBOT_OPERATION | Execute command requested | - | X |
KUFLOW_ROBOT_HOME_PATH | Path to the KuBot installation destination | X | X |
KUFLOW_EXECUTION_OUTDIR | Path to a specific robot run. Each run creates a path that the KuBot can use to write its outputs. This paths are frequently eliminated. | - | X |
Order of precedence
For the exposure of environment variables, KuBot Manager uses the following precedence mechanism (from highest to least precedence):
- Automatic variables
- User-defined variables
Expansion mechanism
A variable can be expanded with other variables using the following template format in the value specification${VARIABLE}
For example:
MY_VAR_A = ${OTHER_VAR}/files
MY_VAR_B = Name${OTHER_VAR}Surname
If you want to escape the interpolation template, use the reverse double slash characters.
MY_VAR_A = \\${OTHER_VAR}/files
Set up human task assisted by Kubot
Attach the robot to a task
Once our KuBot has been uploaded and configured, it is time to use it in KuFlow processes. This is achieved through Tasks.
Let's remember that a task is the concept we use in KuFlow to model a process in simpler fragments and provide interaction and feedback to those interested in the process. In the case at hand, we want to configure a human task assisted by a robot. That is, a robot will perform a job on behalf of the user in charge of the task.
Go to the task configuration part and select the Kubot and its desired operation. Visit task definition documentation for more information.
Installing KuBot on the client
The candidate user of the assisted task, or staff from their IT department, must install the KuBot Manager application, if they have not already done so.
The user will run the application and log in using their KuFlow credentials. At this point, if the user has access to KuBots in their organization, they will be listed and can be installed. Once installed, the user is ready to receive assisted work.
Require assisted work
When the process workflow determines that a certain user must perform a task that has been configured as assisted, they will receive a notification in KuFlow in the traditional way in which task assignments are received. Next, the user will access the KuFlow app to carry out the work.
Pressing the “Start” button starts the work execution request for the KuBot. A few seconds later, the KuBot Manager application will receive the work request and the robot will begin executing. Once successfully completed, the task can be completed and follow the flow defined in the process workflow.