At around the same time period of agent’s evolution as software agents, actor model was introduced. Actors can be considered as the simpler version of agents: like the agents they are lightweight processes and reactive to the messages that they receive, but without the sophisticated decision-making that agents are capable of incorporating. Actors are preferred over agents when there is a requirement for concurrency and scalability in the system.
An actor can:
- Receive messages from a program or other actors
- Perform a task and store data
- Create new actors
- Send messages to other actors
Important to note that messages in an actor model are asynchronous and the actors do not share states, that means the data that an actor stores cannot be changed or corrupted by another actor without properly sending a message to the actor to do so.
Thespian: Python Actors
A number of frameworks and libraries have been developed to implement the actor models. Similar to agents, choosing a framework/library for actor model implementation is challenging and it depends on what are the requirements of the user. In Blind Watchmaker, we adopt the Thespian Python library for actors as the core programming in Blind Watchmaker is in Python and Thespian provides the following features which are valuable to our project:
Concurrency: actors in Thespian run independently with their own state; they can run as threads or processes in a concurrent fashion.
Distributed: Thespian allows the actors to run on any number of servers; Thespian provides the communication mechanism to handle the actors across distributed systems.
Fault Tolerant: Thespian provides the mechanism to restore the actors automatically in case they fail.
Scalable: Thespian allows to extend the number of actors dynamically based on the requirement of the program.