# Building XAI-Based Agents for IoT Systems
## 1 Introduction
### Explainable Multi-Agent Systems for IoT  
Our choice to model IoT systems using an agent-based approach is based on several important considerations. First of all, the concept of an \"agent\" has been used as a metaphor for defining autonomous entities of AI systems for more than two decades, representing both humans and computers, physical robots, and virtual assistants. The authors in [14] agree that the general notion of an agent is so wide that both software entities and human beings may fit it and that such formal laxity is deliberate and useful because it allows human-machine and machine-machine interactions to be captured at the same level of abstraction. Moreover, a recent survey on agent-based Internet of things [15] states that the use of agents in IoT systems is motivated by their ability to model and simulate complex, dynamic, and autonomous systems. In the context of IoT, agents can represent devices, services, or applications and can cooperate to achieve a common goal, such as efficient resource management or real-time data analysis. Furthermore, the agents' programming paradigm allows for the encapsulation of control and coordination based on high-level asynchronous message-passing mechanisms, which can facilitate interoperability, scalability, and adaptability in the development of IoT systems.  
Though the research area of explainable agent-based systems is a relatively new and emerging field within the broader area of artificial intelligence (AI), the number of related studies is gradually increasing, and they are being carried out in different directions. For example, recently, there have been increasing efforts to explain ML models using virtual [16; 17] or conversational agents [18], which are closest to people in their way of communicating and, therefore, more acceptable to people. Experiments have shown that XAI principles implemented through conversational and virtual agents contribute to increasing user trust in the XAI system [17]. The authors in [9] discuss the concept of real-time multi-agent systems and how they are designed to operate in highly dynamic environments, highlighting the importance of meeting both soft and hard deadlines. The paper also explores the use of BDI-based agents, which are suited for unpredictable scenarios requiring dynamic decision-making, and how they can be used to develop explainable and real-time compliant MAS. Additionally, the research to date on explainable multi-agent systems comes under various definitions, namely \"XMAS\" [9], \"XMASE\" [19], \"Explainable agents\" [20], \"Explainable Agency\" [21], or goal-driven XAI [20].  
To sum up, recent studies advocated that multi-agent systems offer a coherent yet expressive set of abstractions, promoting conceptual integrity in the engineering of complex software systems and serving the purpose of social XAI [14]. Furthermore, the growing body of research supports the idea that multi-agent systems can be beneficial for explainable AI (XAI) by providing improved decision-making, increased trust and transparency, and better compliance with regulations [22; 23; 24].  
The main objective of this paper is twofold: to propose a method for building explainable agent-based IoT systems and to develop an application for controlling a smart home system in a real-time environment. This article addresses the problem of building explainable IoT systems that can control smart home environments in real-time using agent-based architectures. Specifically, this article proposes a method for developing these systems that incorporate explainable AI, which is important for ensuring transparency and user trust in IoT systems.