Automation management involves systematically planning, implementing, monitoring, and reviewing various automation.
In RPA, this process involves everything from choosing the right RPA software and platforms to the orchestration and continuous supervision of bots, ensuring that automation is effective and efficient for the developer’s day-to-day life and the organization’s strategic objectives.
With this in mind, we come to the fourth article in our series on RPA Orchestration, where we will understand how to manage automation flows through task states using our orchestrator, BotCity Maestro.
Learn more: RPA Orchestration: Why is it important to orchestrate your automation built in Python or other programming languages?
Benefits of good automation management
Whether for developers looking to facilitate day-to-day tasks or for companies with complex hyperautomation projects, there are several benefits of good automation orchestration:
- Better skill utilization: Allows RPA developers to focus on complex tasks, leaving repetitive routines to bots.
- Flexibility of integration with different development frameworks: Facilitates the integration of RPA with various existing tools and technologies.
- Project scope: Ability to scale from personal automation to complex business solutions.
Pillars of Automation Management in RPA
We will now explain how to orchestrate task states and workflows with BotCity, a Python RPA tool. But first, here are some pillars for RPA orchestration to keep in mind.
- Scheduling and robot queues are essential for efficient task management and automation.
- Error monitoring and automatic alerts for quick problem resolution.
- Batch processing for greater productivity, with batch processing of tasks, files, etc.
- Automation performance dashboards are interesting for having a clear view of automation performance.
- Governance, which is essential for RPA leaders, makes it easier to manage repositories and access groups for security and compliance.
Now, let’s look at a practical example of how to manage RPA automation. As a reference, we are using the project Enterprise RPA Orchestration, which is available on BotCity’s GitHub. If you follow the step-by-step with us, use the project too. However, it is essential to highlight that it does not need to be a robot developed in Python to perform orchestration.
Learn more: Orchestrate any automation with BotCity Maestro.
BotCity Maestro SDK
In this case, we will show how to manage automation in RPA with BotCity Maestro. It is important to highlight that the BotCity Orchestrator SDK is available for some programming languages, such as Python, Java, Javascript, and Typescript.
You can find out how to use it best by consulting our documentation. From the SDK, it will be possible to include the orchestrator’s functionalities in your code, such as controlling the states of the tasks we will understand below.
Integration with BotCity Orchestrator
Whenever you create a project using the BotCity template, your code already has some information for this integration. But if you haven’t used the template or have deleted what the framework created, adjust it considering the example below.
from selenium import webdriver
from selenium.webdriver.common.by import By
from botcity.maestro import *
from selenium.webdriver.firefox.service import Service
from time import sleep
def main():
# The Runner passes the server URL, the ID of the task,
# the access token and the parameters this task receives (when applicable).
maestro = BotMaestroSDK.from_sys_args()
# Fetches BotExecution with task details including parameters
execution = maestro.get_execution()
print(f"Task ID is: {execution.task_id}")
print(f"Task Parameters are: {execution.parameters}")
try:
...
...
⚠️ Attention:
While running the code locally on your computer, there is no authentication with BotCity Maestro. And therefore, some errors can happen. So, during your local tests, you can add the following line of code to prevent these problems from getting in the way:
# Disable errors if there is no connection to the orchestrator
BotMaestroSDK.RAISE_NOT_CONNECTED = False
Managing automation flows and task states
In the last article, “How to create and execute your automation tasks in BotCity Orchestrator,” we realized that we need to configure the task state in the automation code according to the process flow. When we don’t do this, even if the task executes as expected, it will have an error status in BotCity Orchestrator.
To configure the task completion status, we need three parameters:
- task_id: we need to know which task was completed, so from the “execution” variable, we access the task_id;
- status: in this example, we will create the variable “finish_status” and set it to SUCCESS;
- message: in this example, we will create the variable “finish_message” with a statement that clarifies that the execution was successful.
# Defines status and message of successful completion of the task
finish_status = AutomationTaskFinishStatus.SUCCESS
finish_message = "Task bot-selenium completed successfully"
We will use those variables above in the SDK’s finish_task() method. Follow more details in our documentation.
# Finish task with BotCity Maestro SDK
maestro.finish_task(
task_id=execution.task_id,
status=finish_status,
message=finish_message
)
In addition to the “SUCCESS” option, you can also use other types of status for your tasks, depending on what happened during execution:
- FAILED: means that an error occurred and the robot could not perform the task.
- PARTIALLY_COMPLETED: means that there was a partial success. For example, think of a robot that processes entries in a spreadsheet, but only part of the data is processed successfully.
A good programming practice is to use the following code structure for error validation:
try:
# in this scope, the code will try to execute
…
except Exception as error:
# this scope will be executed if there is an error in the try scope
…
It may be worth using this practice to control better the types of exceptions that can occur and which statuses and messages are appropriate for you to configure in your robot.
For example, in the case of except, you can configure the code as follows:
finish_status = AutomationTaskFinishStatus.FAILED
finish_message = "Task failed."
maestro.finish_task(
task_id=execution.task_id,
status=finish_status,
message=finish_message
)
Executing changes in the Orchestrator
You can update your robot’s build by running one of the scripts, depending on your system (build.bat, buid.sh or build.ps1), save the new version in BotCity Orchestrator, create a new task, or if you have made a test task, you can restart it to run.

In our case, you will notice that the message changed. The status is “finished,” and the message is exactly what we configured in the “Task bot-selenium completed successfully” code.
Is everything okay with managing your RPA automation?
To join our global RPA community, join our Slack or get in touch via our forum. If you have any questions, call us! And remember to create your free account to test the features we explore in our content.