Overview

Aiomas’ main goal is making it easier to create distributed systems (like multi-agent systems (MAS)) with pure Python and asyncio.

Therefore, it adds three layers of abstraction around the transports (TCP or Unix domain sockets) that asyncio provides:

The three architectual layers of aiomas
  1. The channel layer allows you to send and receive actual data like strings, lists ob numbers instead of single bytes.

    The Channel class lets you make requests and wait for the corresponding replies within a coroutine: reply = await channel.send(request).

    Every channel has a Codec instance that is responsible for (de)serializing the data that is being sent via the channel. By default, JSON is used for that. Alternatively, you can use MsgPack and optionally compress it using Blosc. You can also extend codecs with custom serializers for more object types.

  1. The remote procedure call (RPC) layer lets you call function on remote objects.

    You can expose the methods of an object as well as functions within a dict. On the other side of the connection, proxy objects represent these exposed functions.

    You can call remote functions within a coroutine: return_value = await remote.method('spam', eggs=3.14).

  2. The agent layer hides some of the RPC layer’s complexity and allows you to create thousands of interconnected objects (agents) without opening thousands of unique connections between them.

    Therefore, all agents live within a container. Containers take care of creating agent instances and performing the communication between them.

    The container provides a clock for the agents. This clock can either be synchronized with the real (wall-clock) time or be set by an external process (e.g., other simulators).

The following sections explain theses layers in more detail.