## 1 Introduction  
Many recent studies have focused on various aspects of wireless sensor networks (WSNs) [1]. These networks are composed of the following: A significant number of sensor nodes, which consist of a processing unit with limited computational capability and memory; sensors, a wireless communication device; and a limited power source. Although sensor nodes have strong constraints on their energy resources and computational capacity, they can be used for continuous sensing, event detection, event identification, location sensing, and local control of actuators [2]. As a result, the range of applications of WSNs is very wide, and includes environmental monitoring systems, intelligent agriculture, surveillance, health monitoring, traffic monitoring, and industrial control and monitoring.  
In spite of the fact that sensor nodes have highly constrained resources (microcontroller, memory, battery, communications), numerous new functionalities have been proposed for WSNs. An example of an application adapted to WSNs is the integration of soft computing (SC) technologies, such as fuzzy logic, neuronal networks, and fuzzy rule-based systems (FRBSs) in sensor nodes [3]. FRBSs are considered to be knowledge-based systems in which the knowledge of the system is represented by a set of \"IF-THEN\" rules whose antecedents and consequents are composed of fuzzy logic statements (fuzzy rules). One of the main characteristics of these systems is the capacity to incorporate human knowledge by accounting for its lack of accuracy and uncertainty or imprecision.  
On the other hand, WSNs represent an ideal scenario for distributed applications in which several application layer protocols have been proposed, such as sensor management protocols, task assignment and data advertisement protocols, and sensor query and data dissemination protocols.  
Although considerable research has been devoted to different WSN applications, less attention has been paid to knowledge-based distributed applications for WSNs. In this sense, it is necessary to design an application layer protocol that allows the distribution of knowledge bases (KBs) among the sensor nodes, the collection of inferred data, the management of the sensor nodes, and the integration with other measurement applications.  
Following our previous research on FRBS WSNs [4-6], this work proposes a new distributed system composed of multi-agent knowledge-based sensor nodes. The contributions of this work are as follows:  
1. We propose a distributed system in which every sensor node can execute a set of applications (FRBS, Collaborative FRBS, measurements, actions, _etc._).
2. We present a multi-agent structure, defined for the sensor nodes, that is composed of three agents: management, application control, and communication.
3. We define and implement, in a real WSN, an application protocol that allows the proposed system, among other features, to distribute KBs to sensor nodes and collaborate among sensors to achieve a global network objective.
4. We examine the performance of the application layer protocol in a real WSN.
5. As real world applications, we present a FRBS application and a distributed WSN application for environmental noise pollution monitoring in an urban area.  
The rest of the paper is structured as follows: the next section deals with related work and motivation. Section 3 describes the methodology that was used, including the multi-agent structure of the sensor nodes and a description of the application protocol. Section 4 shows the experimental results related to the application protocol performance, as well as two real-world applications of the proposed system. Finally, conclusions are presented in Section 5.