The evolution of Information Technology (IT) and the emergence of the Ambient Intelligence paradigm have drastically affected the way users live and learn. Ambient Intelligence is a vision of the future that offers great opportunities to enrich everyday activities (e.g., on the road, at home, at work, etc.) and has been proven to play an important role in education. In smart learning environments, learning activities are enhanced with the use of pervasive and mobile computing. This paper presents an extensible software infrastructure that empowers teachers to design and program purposeful and engaging learning activities for formal and informal learning environments, by combining and orchestrating cloud-based, ambient and pervasive facilities and services.