In this paper, we develop a multi-agent language that enables us to easily define sensor network behavior. A sensor network usually consists of many autonomous sensors equipped with wireless communication capabilities, and it is constructed to be autonomous using an ad-hoc network protocol. These sensor nodes make it possible to monitor the actual state of a real environment as well as track various activities of a person equipped with a sensor node. When the only purpose of the system is to collect environmental data, all the nodes merely need to be capable of sending data to the receiving station. However, if directions are arbitrarily sent to each node to control actuators also equipped with nodes, a ubiquitous computing environment is formed. These circumstances require bidirectional communication between nodes, autonomous control by each sensor node to determine the intercommunication suitable for its situation, and recognition and cooperation between unspecified numbers of sensor nodes in the heterogeneous network to provide the various system services. To solve these problems, we developed a multi-agent system capable of execution in a sensor node with limited computer resources. We then demonstrate the applicability of our system through the experimental results.