Robots Deployment

Hello All,

I would like to know how robots/bots are deployed on multiple PCs. I have looked at some of commercial RPAs, and it seems that a bot can be easily deployed to a user/machine via “client agent”.

How this process will work with Robot Framework? Say that I have a robot that is designed to check inbox and perform an action when specific type of email is received. How can I then deploy this to my 70 users?

Thanks!

Hi David,

That’s not really a “Robot Framework” functionality, so the answer will really depend on the tool you want to use with “Robot Framework”.

Once you have your robot file (“script” if you like) it gets called with the robot command to run the test/task.

I’ve not used Jenkins, but I believe it has “runners” that transfer the files (or checks it out from a version control system) to the machine that that will run the test/task and then executes robot with that file.

In my case with rfswarm, I have an agent process that pulls the robot files from a server and then launches robots based on the jobs assigned to the agent. rfswarm being a performance testing tool is probably not what you are after.

But if you don’t find a suitable tool there is nothing stopping you to write one, you could write a server component that assigns jobs based on your criteria/schedule to agents and reuse the rfswarm agent to handle the script distribution and run the jobs for you. The agent <–> server protocol is documented and if you decide to go down this path ping me with any questions.

Dave.

Do check out: GitHub - robocorp/rcc: RCC is a set of tooling that allows you to create, manage, and distribute Python-based self-contained automation packages - or 'robots' as we call them.

Dear Damies,
In the above post related to Robots deployment, you have mentioned the following

"
But if you don’t find a suitable tool there is nothing stopping you to write one, you could write a server component that assigns jobs based on your criteria/schedule to agents and reuse the rfswarm agent to handle the script distribution and run the jobs for you. The agent <–> server protocol is documented and if you decide to go down this path ping me with any questions.
"
Can you please elaborate more on the above solution given by you.
I am also looking for solution to robots distribution, execution and management on multiple agents.

Hi Jenny,

RFSwarm is a performance test tool that uses robot framework tests for generating load against a test system.

RFSwarm has 3 components:

  • Manager
  • Agent
  • Reporter

For this discussion you’ll care about the Manager and the Agent.

As RFSwarm is a performance test tool, in the manager you select a robot file, then select a test case from that robot file and assign the number of robots you want to run.

In a performance test you run the Agent component on each load generating machine and the Manager on a single machine, the Agent on all the Agent machines are configured to poll the Manager machine, when the performance test is started the Manager assigns the number of robots each agent should run for each test case selected, the Agent machines then run a robot for each robot job assigned to the agent.

The manager in RFSwarm runs a simple http server and this is what the Agents connect to making REST calls to the manager. The REST API is documented here Agent Communication

As RFSwarm is Open source, you are free to look at the code, or use components of it however you need. So you could write your own application that assigned jobs to agents however you want and reuse the agent component to do the actual execution of the robot framework tests. Your software just needs have a web server to respond as the Agent’s REST requests as the Agent expects.

Some examples of how this might be useful:

  • Say you had a test suite with 100,000 tests that you want to distribute across 100 Agent machines, you might write your server to read all the tests in the suite, and place them in a test queue, then it could pull tests from the queue and assign them to Agents monitoring the agents performance so you don’t overload the Agents, then as an agent finishes a test another is pulled from the queue and assigned to the agent until the queue is empty.
  • Say you want to run the same test at 20 different locations every hour, you might run an agent machine in each site, then write your server to assign that test to job to run on each of the Agents, then your server would sleep for an hour and then schedule the job to run again on each Agent, the server might also collect the results returned from the agent and update your system monitoring dashboard

Obviously I don’t know of any software that does any of these examples now, but there’s nothing stopping someone doing this or anything else they might want to do. Re-using the agent component of RFSwarm could save you a lot of work as that part is built, packaged, working, and quite well tested by now.

If you want to write a server that distributes jobs to agents in Python, you’ll probably want to look at the code for RFSwarm Manager, you may even want to copy some of the functions a large portion of the AgentServer class.
If you want to use a different language to write your server, then the manager code might still be useful as a guide. As the communication is all REST over http it should be possible to write the server in whatever language you are comfortable with.

I would suggest before you embark on something like this that you

  • read the RFSwarm documentation so you understand what RFSwarm is designed to do, particularly Overview / Concepts, especially the Robot File handling (transfer from Manager to Agent) section.
  • setup at least 2 machines, one Manager and one Agent, and run a small performance test with one of your test cases, watch the test files get transferred to the agent and the logs get transferred to the manager, even watch the communication with a packet sniffer if you want

And perhaps just using RFSwarm as is might do what you want, while it was designed for performance testing, there’s no reason that you have to use it for that, might be possible to achieve something close to both those examples with RFSwarm as is.

Hopefully that’s the information you were after,

Dave.

Dear Dave,
Thank you very much for the detailed explanation.
My RPA sample use case is about performing db backup and restoration on agent machines , through external trigger. I am looking for options to deploy the bots on agents and agent management. I do not want to do performance testing.

I will again go through you detailed reply and check the details, you have provided.

Thanks again.

1 Like

Hi Jenny,

In that case it might be easy enough to use to use RFSwarm as is to do what you need. (then you don’t need to write something if you don’t want)

  • say you have 10 machines that all have your database and application running on them
  • you want to do the same operation on all 10 machines
  • you install the rfswarm agent on all 10 machines and configure the agents to use your machine as the manager
  • you set up a robot RPA file something like this
*** Tasks ***
Backup App Database
	Stop Application xyz
	Run Database Backup
	Start Application xyz
	Sleep 	10

Restore App Database
	Stop Application xyz
	Run Database Restore
	Start Application xyz
	Sleep 	10
  • then you could setup a scenario in rfswarm manager like this
  • you would switch to the agents tab first and wait for all 10 agents to connect
  • then when you are ready you play the scenario
  • as the task will take longer than 10 seconds to run what should happen is one task should get assigned to each agent, the task will start, then by the time it’s finished the scenario will be in stopping mode and the task won’t start a second time
  • because of the way the rfswarm manager assigns robots to the agents as long as all 10 machines are connected before you start the scenario each agent machine will only get 1 robot
  • you could set up a second scenario for the “Restore App Database” task

If this is a task that needs to be run every day (like restoring a training database on a training server in 10 separate classrooms, ready for the next day’s class), then you might even want to schedule the scenario, rfswarm manager can be run from the command line with options to specify which scenario file to run and to wait for the right number of agents to connect before starting the scenario.

As I mentioned what RFSwarm was designed as a performance test tool you don’t have to use it for that.

Hope that helps,

Dave.

Hi Jenny,

Just woke up and had a thought, while RFSwarm may be able to do what you want, a better solution might be to use a configuration management solution like saltstack, though this is not really the forum for discussing the usage of those types of tools, so I’ll just mention its an option for you and let you discover the world of configuration management if you’re not familiar with it.

Dave.

Thanks Dave. I will go through the SaltStack solution also. This is new to me and I will check it.

1 Like

Dave,
Thank you for the elaborate explanation. In continuation with usage of rfswarm manager and agent for my usecase ( deploy and manage RPA bots for doing certain tasks (other than testing), I have the following queries .
In my case the requirement is these bots are to be triggered externally through external API

  1. the use case requires to execute bot on any of the agents from an External API
  2. The use case requires to execute bot on all the agents from an external API

It would be of great help to me if you provide inputs on these possibilities using rfswarm.

Hi Jenny,

That actually makes things simpler for you

You would simply need an intermediary service that takes the API calls from the other system, works out the jobs to run and internally assigns the jobs to the agent machines, then when the agents connect to your intermediary service it just has to respond with the API responses that the agents are expecting.

Basically your intermediary service would act as a translator between the API’s and handle the queuing of jobs to various agents.

Dave.

Thanks Dave. I will go through all the inputs given by you, so far.
Thanks once again.

1 Like

Dear Dave,
I have one more query, further to your reply to me on 24th July on this thread.
My query is, how can I communicate with the agents through my service( API).
Do I have to do this using rfswarm manager and agent .
Your detail clarification on this point will help me get started on this task.

Thank you in advance.

Hi Jenny,

You would need to make the API service provide the API endpoints that the rfswarm manager has. The Agent_Communication page of the rfswarm documentation lists the end points with examples of the request bodies the agent will make and the response the manager returns to the agent

If your API emulates the rfswarm manager then the rfswarm agent will run the jobs you ask it to run.

when the agent starts it will poll every 10 sec with /AgentStatus, /Jobs and /Scripts, once it starts a test run the poll period becomes ever 2 seconds and reduces to /AgentStatus, and /Jobs, however will send /Result at the end of each keyword

/File is uded to download script from the server in response to /Scripts, and to upload the result files at the end of the test

Hopefully the documentation is clear,

Dave.

Dear Dave,
Thanks. I will go through the documentation and get back to you in case of query.

1 Like

Dear Dave,
As per your earlier reply, rfswarm can possibly be solution to the RPA automation that I want to achieve. Hence I tried to explore basic rfswarm tool in past 2-3 days. I have now rfswarm manager and agent installed in my laptop. I created a very basic bot scenario of opening a Browser window. This task I am able to run from rfswarm manger window, through an agent. I am also able to view the results.
With reference to my requirement, I have gone through the Agent documentation of rfswarm recommended by you. With reference to my scenario (details in this email thread) and your reply above ,

I further have following queries and require your inputs.
(1) How can I pass any parameters through external API to the rfswarm manager. This could be eventually any information like say for example , name of the agent, that manager should assign task to .
(2) If I have 10 agents, how can I assign a specific job only to a specific agent out of the 10 agents.

Thank you in advance for being so patient, about all my stupid queries and for being very supportive.

Hi Jenny,

These are digging down into the details of the agent jobs, after a quick look ar the agent communication documentation I see I didn’t document it down to that level. Forgive me RFSwarm is a project I built in my free time, there’s no huge team of people.

To help answer these questions and any future ones, If you run the agent at debug level 7 (it’'ll be noisy) you’ll be able to see the responses from the manager look for lines that start with getjobs: resp: and you’ll see the details of the jobs generated.

When you add a test in the manager, at the right hand side of the test row there is a settings button → Additional settings for test group

  1. In the test row settings, there is a setting called “Robot Options” you can put any command line options you would normally put on the command line for robot framework, the manager will pass that through to the agent as part of the job data in the robotoptions key (job data is just a basic python dictionary)

  2. There’s two ways this can be controlled in the manager

  • When the agent queries /Jobs the manager only returns assigned to that agent (based on the agent name) so the manager takes care of that, so in your case your API server should also take care of that and only give jobs to an agent that are assigned to that agent.
  • if you are using the manager, and you want to tell the manager to assign a specific script to a specific agent or group of agents, you use the “Agent Filter” settings, you can set the filter to require an agent with a specific name, or exclude agents that have a property. You can add custom properties to the agent (using the command line options or ini file), but these agent filters are used by the manager to select which agent to assign a job to, so they don’t appear in the job data sent to the agent.

No worries, your doing something a bit out of the ordinary, it’s a great way to learn, you might end up building a tool that’s really useful to people, I had to ask a lot of questions and learn a heap of stuff over the decades, if I didn’t RFSwarm wouldn’t exist.

Dave.

Dear Dave,
I really appreciate your dedication and support and as always the loads of patience that you have. I shall go into the details of your reply and as usual, get back with another set of queries for you.

Thank you.

1 Like