Wireless Sensor and Actuator Networks (WSANs) will increasingly require support for managed software evolution: i.e., systematic, ongoing, efficient and non-disruptive means of updating the software running on the nodes of a WSAN. While aspects of this requirement have been examined in the literature, the big picture remains largely untouched, resulting in the generally static WSAN deployments we see today. In this paper we propose a comprehensive approach to managed software evolution. Our approach has the following key features: (i) it supports divergent evolution of the WSAN’s software, such that different nodes can evolve along different lines (e.g. to meet the needs of different stakeholders, or to address localised adaptations) and (ii) it supports both instructed and autonomous evolution such that nodes can be instructed to change their software configuration or can evolve their own configuration (e.g. to manage rapidly-changing environmental conditions where remote micro-management would be infeasible due to the high latency of the WSAN environment). We present the four intra-WSAN protocols that comprise our solution, along with an accompanying server-side infrastructure, and evaluate our approach at scale.