Python Automation

Deploying Python bots using BotCity Maestro

Follow this article or the video below to learn how to deploy bots:


  • Runner: download it here.
  • BotCLI: download it here. Alternatively, Botcity’s BotStudio comes with a bundled BotCLI. The Studio can be found here.
  • You must be registered to the BotCity Maestro platform.
  • Access to a running Host Machine (which can be a virtual or a physical machine).
  • Java on both machines (to use the Runner and the BotCLI).
  • Python 3.7 or newer +  pip on the Host Machine.
  • (Windows Host Machine only) Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019.
  • (Linux Host Machine only) System Packages: python3-tk + scrot + xsel + xclip.

Step 1 – Log in to BotCity Maestro

Access the BotCity Maestro platform and log in with your credentials. In the home page, you may already take a peek at the Task Queue, but let’s go to its own page to see more details:

You’ll see this screen:

This is your personal / company environment. Every machine you register, activity you create or bot you deploy will be listed here. For now, notice how we blacked out three of the fields on the screen. They are your “Workspace”, “User” and “Key”. Note them down, because we’ll use this information later.

Step 2 – Set up your Host Machine

Let’s assume you have a Host Machine already running, be it a Virtual Machine (either local or cloud) or a Physical Machine. We’ll show you how to install the BotRunner on it and link it to your BotCity Maestro platform. Later, you will be able to run your robot’s tasks and collect it’s logs and reports without even accessing the Host Machine.

Connect to your Host Machine. In this tutorial, we will use Remote Desktop Connection Manager to connect to a Virtual Machine:

Assert that Python and pip are installed on the Host Machine with –version:

Use pip to Install the virtualenv package:

Step 3 – Set up the Runner on the Host Machine

Upload the Runner to your Host Machine and extract it wherever you prefer:

Open the Runner/conf/conf.bcf file, and fill it with the information obtained in step 1:

Log Screen: Setting this option to true allows the Runner to periodically send a print of the Host Machine screen to be displayed on BotCity Maestro.

LogApplication: Setting this option to true allows the Runner to periodically send the contents of its own log file to be displayed on BotCity Maestro.

The Runner is now awaiting for a task addressed to this machine to be created.

Step 4 – Bot deploy using BotCLI

We will use the command line to deploy our bot to the host machine. But first, download and extract the BotCLI to your computer. It’s convenient to keep it near or even inside your bot folder:

Then open its file:

Fill it with the information you gathered on step 1. After that, we will use the BotCLI to register our virtual machine to the BotMaestro platform using the following command:

This process only needs to be done once for each virtual machine.

Now you need to register your bot to the Maestro Platform. Open your command line interface and position it at the folder your botCLI.jar is, then run the deploy command. You will pass the package’s .tar.gz file path as an argument. If you don’t know how to generate that file, see this.

You only need to deploy your bot once for each version. If you want to deploy changes to this bot without releasing a new version, simply replace the word deploy in the above command with the word update.

The next step is to release this version, which will mark it as the standard version to be used when the BotRunner downloads your bot’s executable to the virtual machine. Here, use this command:

Let’s check if the bot has been properly released with the list command. In this case, the botId parameter is optionals, and not using it causes the CLI to list all versions of every registered robot:

If you see your bot in this list, then it’s ready to be run, but we still need to create a way to start it from the BotMaestro platform.

Step 5 – Create an Activity on BotCity Maestro

An activity describes a task the BotMaestro can start. It describes what machine it should be sent to be executed, what programming language it will execute at (Python or Java), and, if you wish, it can be scheduled for automated execution;

Let’s create an activity to run our bot. To do that, go to your BotCity Maestro platform and click on Activities:

And then, New Activity:

Now complete the fields as shown below:

Step 6 – Create a Task with BotCLI

A task can be seen for those familiar with object oriented programming as an instance of an activity. Each time the robot runs, it’s executing a task, and that task has its own ID. To create a task, go back to the BotCLI terminal and use this command:

Also, a task can be marked as a test task by using the optional parameter -test=true, which allows it to be restarted:

Once the task has been created, it’s available to be started by the Runner. If you have activated the Runner on step 4, your bot should run in a few moments, but the first execution may take longer, since it needs to create the Python Virtual Environment and install all the required dependencies.

Step 7 – Test Results

The bot will perform the same actions as it would if it was on your machine, but in the Host Machine instead. In our example, it will search for the BotCity’s youtube channel, then use the “I’m feeling lucky” button to open it:


Head of Developer Experience @ BotCity.

Leave a Reply