# Building XAI-Based Agents for IoT Systems
## 1 Introduction
### The Need for Explainability in Smart Home Domain  
Some AI and ML application domains can be considered very sensitive and high-risk, closely associated with human lives, their wellness, and safety--industrial control,healthcare, military domain, or self-driving cars perfectly represent instances of such safety-critical domains. Most authors agree that the demand for XAI in safety-critical domains is inseparable from further developments, as they involve high-consequence decisions, and a failure of the AI system could result in significant harm to people or the environment [7; 8; 9].  
Smart homes are not generally considered a safety-critical domain because the consequences of the AI system's failure in a smart home setting are typically less severe than in other safety-critical domains such as transportation or healthcare. However, smart homes are challenging environments for XAI, as they are decentralized systems that undergo runtime changes. Moreover, an explanation is more likely to be required when the user is faced with a contradicting situation [10]. There are some scenarios where the failure of the AI system in a smart home could potentially lead to harm. For example, if the system controls heating, lighting, or other safety-related functions, a failure could result in unsafe conditions. Thus, it is important that AI-based systems, especially for home security or controlling higher-risk devices, provide clear explanations for their decisions and potential outcomes. The actions of various AI-enabled gadgets, minimizing the effort and time required for everyday household activities, should also be transparently explained, especially if they do not fully meet users' preferences. Overall, smart home systems should take responsibility not only for real-time control behavior but for protective behavior as well if potential threats have been recognized for the security of humans, their personal data, or assets. Unintended consequences, system malfunctioning, false notifications of various home subsystems, and unpredicted errors are key concerns undermining trust and confidence in any AI solution. XAI is important in smart home settings because it can help users understand and interact with the AI system in a more natural and intuitive way. By providing explanations for its decisions, the AI system can increase users' trust and understanding of the system, which can lead to greater acceptance and adoption.  
The research on the application of XAI to the smart home domain focuses on various aspects. A study in [11] applied XAI principles to the domain of activity recognition in smart homes, aiming to provide end users with transparent explanations for the system's decision-making processes. The main idea behind the research is to propose and evaluate four computational techniques for generating natural language explanations of smart home data based on explainable artificial intelligence (XAI) methods. The paper evaluates the effectiveness of each technique in generating accurate and useful explanations and presents recommendations for the best approach in the domain of smart home automation. Another study in [12] provides valuable insights into the current state and future potential of XAI in the power system domain, reviews XAI techniques for energy and power system applications in smart buildings, and helps in understanding the associated challenges and potential research directions in this field. In [13], the authors propose a modular architecture for self-explanatory smart homes, addressing the challenges of heterogeneous devices, runtime changes, and varying contexts.