We are interested in situations where multiple uncoordinated non-professional programmer end-users want to exploit the Ambient Intelligence (AmI) infrastructure on their own, without calling in embedded systems programmers, in order to support their daily activities. Our goal is allowing them to achieve this objective through on-the-fly creation and execution of high-level programs that we call uQueries (for user-defined or ubiquitous queries). The key challenge then is to support the cost-effective and stepwise development of uQuery engines – systems for end-user programming and execution of uQueries. We present a meta-level architecture that addresses this issue by leveraging Artificial Intelligence methods that make possible the separation of uQuery representation and reasoning concerns from those of their effective execution through model-to-code transformation. We show that (1) interconnections between ambient devices may be dynamically specified as control flows between high-level descriptions of their primitive functionality, (2) specifications may be elaborated by concurrent, uncoordinated end-users through a Web interface, and (3) they may be automatically distributed and concurrently executed on ambient devices as a system of mobile agents. We have created a prototype of this architecture, the Ambiance Platform, which has allowed experimental validation of the approach using an application scenario proposed in the state-of-the-art of relevant research areas. This experience led us to identify important issues to be explored, including dynamic and seamless integration of sensor and actuator nodes into the system. Furthermore, opportunities exist for significant performance and resource use optimization, for instance by integrating learning mechanisms into uQuery specification, transformation and execution.