Distributed computing and reliable communication in sensor networks using multi-agent systems