This article present a mobile agent (MA) middleware, i.e., multiagent system for distributed sensor networks (MASDSN) that generates an intelligent framework for deploying applications in distributed sensor network (DSNs). It provides high level middleware services such as object tracking, security, fault-tolerance, power management, and so on. It uses group aware conditions by varying either from service-to-service or according to system conditions (e.g., power level, connectivity, and bandwidth).