About osBrain

osBrain logo

Feature overview

osBrain is a general-purpose multi-agent system module written in Python.

  • Agents run independently as system processes and communicate with each other using message passing.
  • Message passing is implemented using ØMQ, and in particular, the PyZMQ Python bindings.
  • ØMQ allows for efficient, asynchronous communication using different commonly used communication patterns such as request-reply, push-pull and publish-subscribe.
  • osBrain integrates Pyro4 to ease the configuration and deployment of complex systems.
  • Thanks to Pyro4, remote agents can be treated as local objects and reconfigured even when they are running. Not just variables, but also new methods can be created in the remote agents.
  • osBrain provides the base for implementing robust, highly-available, flexible multi-agent systems.
  • Being implemented in Python, osBrain can take advantage of a huge set of packages for data analysis, statistics, numerical computing, etc. available in the Python ecosystem.

In order to fully understand osBrain capabilities, it is highly recommended to read the Pyro4 documentation and the ØMQ guide.

OsBrain’s history

osBrain was initially developed in OpenSistemas based on the need to create a real-time automated-trading platform. This platform needed to be able to process real-time market data updates fast and in a parallel way. Robustness was very important as well in order to prevent running trading strategies from being affected by a failure in another strategy.

Python was chosen for being a great language for fast prototyping and for having a huge data analysis ecosystem available. It was kept for its final performance and the beautiful source code created with it.

The appearance of osBrain was a consequence of a series of steps that were taken during the development process:

  1. Isolation of agents; creating separate system processes to avoid shared memory and any problems derived from multi-threading development.
  2. Implementation of message passing; making use of the modern, efficient and flexible ØMQ library.
  3. Ease of configuration/deployment; making use of the very convenient, well implemented and documented Pyro4 package.
  4. Separation from the trading platform; what started as a basic architecture for implementing a real-time automated-trading platform, ended-up being a general-purpose multi-agent system architecture.

What can you use osBrain for?

osBrain has been successfully used to develop a real-time automated-trading platform in OpenSistemas, but being a general-purpose multi-agent system, it is not limited to this application. Other applications include:

  • Transportation.
  • Logistics.
  • Defense and military applications.
  • Networking.
  • Load balancing.
  • Self-healing networks.

In general, osBrain can be used whenever a multi-agent system architecture fits the application well:

  • Autonomy of the agents.
  • Local views.
  • Decentralization.

Performance

The performance of osBrain, just as the performance of any other system architecture, depends a lot on the actual application. The developer should always take this into account:

  1. Pyro4 is used only for configuration, deployment, updating and debugging, which means that the actual performance of the system should not depend on this package.
  2. ØMQ is used with the PyZMQ Python bindings, which means that the system performance depends on the PyZMQ performance.
  3. osBrain uses pickle for serialization by default, which means that the system performance may as well depend on this package. Serialization is configurable, though.
  4. osBrain default transport is IPC for operating systems that provide UNIX domain sockets, and TCP for the rest. It can be changed globally or configured specifically for each bind. Note, however, that when using TCP, the network may have a great impact on performance.