## 3 The Concept of Building the EviNS Software Framework
The implementation of the WE-FSM must necessarily define callbacks responsible for creating processes and for agent initialization based on configuator data. The functionalities of the finite state machine (FSM) ensure the operation of agents such as a user-defined FSM or an FSM with a stack. To define an agent, the FSM must be explicitly declared as a structure defining states and transitions to other states, equipped with a transition callback. Additionally, initialization and termination callbacks must be capable of returning initial and final events of the FSM, respectively. To handle events, a callback performing preliminary processing of incoming messages must be provided. Messages received from interface handlers or timers are converted into events of the specific FSM. For each state, a corresponding handler must be created, invoked upon each event occurrence. The implementation of a user-defined FSM must also include callbacks responsible for creating a process, initializing it, and terminating it. Figure 2: Process structuring model—interaction of workflows and supervisors. Each agent is explicitly defined as an FSM or an FSM with a stack and is controlled by events generated externally by interface handlers or internally by event handlers or timers. It is important that all agents are isolated from each other to protect against failures--the failure of one agent should not affect the behavior of another agent functioning properly. For this purpose, the operation of each agent is isolated within its own work environment and is supervised by a supervisor. Figure 2 demonstrates the interaction of a grouped set of work environments controlled by a supervisor. In the case of an error in the operation of one of the agents, the supervisor restarts its operation. The remaining agents continue executing their programs regardless of the failure of the \"faulty\" agent. Thanks to the isolated operation, errors in one or several agents do not affect the execution of the entire computational process. Each supervisor can be supervised by another supervisor. For greater resilience of the computational process, agents and supervisors can be duplicated. Due to the fact that each agent is defined as a finite state machine or a finite state machine with a stack, it is a standalone software component that provides strictly defined functions and has a precisely defined interface specification for messaging. As mentioned earlier, agents can act, for example, as a protocol for network data exchange, solving computational tasks (including preprocessing sensor data), or act as an intermediate agent between external sensors and the communication modem to optimize data exchange over the communication channel. Regarding the interaction between agents, they are interconnected with each other and with external processes through interface handlers, transforming raw data received from external interfaces into strictly defined messages, or vice versa, converting messages received from corresponding agents back into raw data. Interface handlers necessary for connecting to each agent are specified for each agent. Agents are independent of the message source. Determining the message source is the task of the configurator, which allows linking all agents together and with external interfaces through interface handlers defined for the corresponding agents. The agent's configuration can either be predefined in a configuration file or generated \"on the fly\" through interaction with the configuration agent observer. Together with interface processors, the agent can be viewed as a virtual device connected via customizable physical or virtual interfaces to other components of the system.