Wireless Sensor Networks are becoming one of the most successful choices for the development and deployment of a wide range of applications, from intelligent homes to environment monitoring. Nowadays, there is a growing demand for fast development of WSN applications that adapt at run-time to changes in the context, in the available resources, and also in user requirements. In this paper we present a model-driven approach that permits to model and automatically generate Agilla Agents. We decide to target Agilla since it is an agent based platform that allows to manage adaptation without service interruptions by means of agents substitution. The proposed approach considers UML (Unified Modeling Language) as modeling language, and consists of a UML Profile to model Agilla agents and of a Model-to-Code transformation that generates Agilla code from the presented UML modeling framework.