Build, deploy, and scale your collaborative software bots with ease. Botica provides the framework for development and the infrastructure for orchestration.
Botica provides a collaboration framework designed to streamline the development and orchestration of multi-bot systems. It allows you to define your entire bot infrastructure, including bot types, instances, and communication patterns, within a single declarative configuration file.
Upon interpreting this configuration, Botica automatically provisions and manages the underlying message broker, the necessary network infrastructure, the deployment of each bot as an isolated container and the connections to the message broker and their complete lifecycle:
- Easy development: Official libraries for Java and Node.js (with Python and more planned) provide simplified APIs for building robust and collaborative bots.
- Declarative deployment: Define your multi-bot environment in a single YAML file, eliminating manual Docker commands and complex scripting.
- Simplified messaging: Bots interact via "orders"; Botica abstracts away the underlying message broker logic and message routing complexities.
- Integrated scalability: Scale bot instances by modifying a single
replicasvalue, supporting both distributed (work-stealing) and broadcast messaging strategies. - Shared filesystem: A common
/sharedvolume is automatically mounted across all bot containers for seamless data exchange. - Automated lifecycle management: Comprehensive handling of bot startup, readiness checks, heartbeats, and graceful shutdowns ensures system resilience.
This example demonstrates how Botica orchestrates a simple workflow: a Node.js generator bot
periodically publishes random data, which is then processed by a scalable team of
Java worker bots. The setup involves defining the bots in an environment.yml file and then
implementing each bot's specific logic using the respective Botica library.
bots:
generator-bot:
image: "my-org/generator-bot-node" # Your Docker image for the Node.js bot
replicas: 1 # Botica deploys 1 instance of this bot type
lifecycle:
type: proactive
period: 5 # Executes its proactive task every 5 seconds
worker-bot:
image: "my-org/worker-bot-java" # Your Docker image for the Java bot
replicas: 3 # Botica deploys 3 instances of this bot type
lifecycle:
type: reactive
subscribe:
- key: "worker_jobs"
strategy: distributed # Each order with "worker_jobs" key is sent to only one of the 3 workersThis configuration defines two bot types: generator-bot (Node.js) and worker-bot (Java).
- The
generator-botis configured asproactiveto run a task every 5 seconds. - The
worker-botis configured asreactiveandsubscribesto theworker_jobskey with adistributedstrategy, ensuring that each incoming order is processed by only one of its threereplicas.
Botica translates this configuration into a running, coordinated multi-bot system.
import botica from "botica-lib-node";
import {randomUUID} from "crypto";
const bot = await botica();
bot.proactive(async () => {
const data = {
id: randomUUID(),
timestamp: new Date().toISOString(),
value: Math.random() * 100
};
console.log(`Generated and publishing data: ${JSON.stringify(data)}`);
await bot.publishOrder("worker_jobs", "process_data", data);
});
await bot.start();This bot's logic uses botica-lib-node to define a
proactive task. It generates a unique data payload every 5 seconds (as configured in
environment.yml) and publishes it as an order with the action process_data to the worker_jobs
key.
import es.us.isa.botica.bot.BaseBot;
import es.us.isa.botica.bot.OrderHandler;
import org.json.JSONObject;
public class WorkerBot extends BaseBot {
@OrderHandler("process_data")
public void onProcessData(JSONObject payload) { // Order handler methods can accept String, JSONObject or any POJO types
String processedResult =
"Processed-" + payload.getString("id") + "-" + payload.getDouble("value") * 2;
System.out.println("Worker " + getBotId() + " finished processing: " + processedResult);
}
}This bot's logic uses botica-lib-java to define an
@OrderHandler method. When an order with the process_data action arrives on a subscribed key (in
this case, worker_jobs), this method is automatically invoked to simulate data processing and log
the result.
Once your bot code is implemented and your environment.yml is defined:
- Build your bot images: For each bot project (e.g.,
generator-bot,worker-bot), use thebuild.sh(Linux/macOS) orbuild.bat(Windows) script provided in the official library templates to build your Docker images. These scripts automatically handle compilation and Docker image tagging. - Run the Botica Director: Navigate to the directory containing your
environment.ymlfile and execute the Botica Director program. The Director will read your configuration, deploy the message broker and all bot containers, and manage their interactions.
To gracefully shut down the entire system, simply stop the Botica Director program with the stop
command. It will ensure all bots and associated container infrastructure are terminated cleanly.
To begin developing with Botica:
- Explore core concepts to understand the foundational principles.
- Follow the getting started guide for installation and your first deployment.
- Review example projects for practical implementations.
- botica-lib-java - The official Java library for building Botica bots.
- botica-lib-node - The official Node.js library for building Botica bots.
This project is distributed under the LGPL v2.1 License.