# A Multi-Agent Architecture for Data Analysis
## 3 ActoDatA Overview  
The features of the actor model and the flexibility of its implementation make ActoDeS suitable for building agent-based data analysis applications. In particular, actors have the suitable features for defining the agent models found in MAS and DAI systems [8]. In fact, actors and computational agents share certain characteristics: (_i_) Both react to external stimuli (i.e., they are reactive); (_ii_) both are self-contained, self-regulating, and self-directed (i.e., they are autonomous); and (_iii_) both interact through asynchronous messages, with such messages being the basis for their coordination and cooperation (i.e., they are social). Therefore, an actor library can be considered a suitable solution for the implementation of a multi-agent system. In our case, the actors provided by ActoDeS cannot be considered real agents, but the different types of actors defined and implemented for the development of ActoDatA applications offer some features for which they can be considered agents. Moreover, the use of ActoDeS simplifies the development of distributed, flexible, and scalable data analysis applications. In fact, the use of active and passive actors allows the development of applications involving a large number of actors, where each actor can perform a different behavior and react to the input data (i.e., messages) in real time. However, ActoDeS does not offer specific components for building data analysis applications. Therefore, we defined a software library, called ActoDatA (Actor Data Analysis), that, starting from ActoDeS, provides a set of agents and a multi-agent architecture useful for the development of such kinds of applications. The current implementation of ActoDatA supports the analysis of email and Twitter data. However, it can be easily extended to support the analysis of other types of data. In particular, ActoDatA provides a multi-agent architecture which eases the deployment and the concurrent execution of several social media analysis applications. This architecture takes advantage of: (_i_) A set of agents that perform all the analysis tasks; (_ii_) a data store that maintains data sets and analysis results; (_iii_) a user console that allows developers to configure, start, stop, resume, and kill applications; and (_iv_) a web /APP server that presents information about collected data and analysis results. Figure 2 shows the architecture of the ActoDatA multi-agent system. ActoData takes advantage of five types of agent: _Acquirer_, _preprocessor_, _engine_, _controller_, and _master_. Each agent acts as a wrapper for predefined or custom components that perform the different data analysis tasks of an application. For each type of agent there are some implementations suitable to wrap some specific data analysis components. In particular, each application involves some _acquirer_, _preprocessor_, and _engine_ agents and a _controller_ agent. Moreover, a _master_ agent has the duty of deploying and monitoring the execution of all the applications of a multi-agent architecture. An _acquirer_ agent has the duty of managing a data source, acquiring the data, and submitting some or all of the data to the agents initiating their processing. This agent is specialized for a specific data source and performs iteratively the following activities:  
* Waits for new data
* Filters the data on the basis of a specific pattern or a set of constraints (optional)
* Sends the (filtered) data to the registered preprocessor agents. As introduced above, for each type of agent there are different implementations. For this type of agent there are two implementations. The first supports the filtering of Twitter messages (in this case, filtering is based on the Twitter API and text pattern matching) and the second supports the filtering of email messages (in this case, filtering is based on the JavaMail API and text pattern matching). Figure 3 shows the code of a filter selecting Twitter messages on the basis of their language and the presence of keywords.