Abstract. The development of and accessibility to rich virtual environments, both for recreation and training activities leads to the use of intelligent agents to control avatars (and other entities) in these environments. There is a fundamental tension in such systems between tight integration, for performance and low coupling, for generality, flexibility and extensibility. This paper addresses the engineering issues in connecting agent platforms and other software entities with virtual environments, driven by the following informal requirements: (i) accessibility: we would like (easily) to be able to connect any (legacy) software component with the virtual environment (ii) performance: we want the benefits of decoupling, but not at a high price in performance (iii) distribution: we would like to be able to locate functionality where needed, when necessary, but also be location agnostic otherwise (iv) scalability: we would like to support large-scale and geographically dispersed virtual environments. We start from the position that the basic currency unit of such systems can be events. We describe the Bath Sensor Framework, which is a middleware that attempts to satisfy the above goals and to provide a low-latency linking mechanism between event producers and event consumers, while minimising the effect of coupling of components. We illustrate the framework in two complementary case studies using the Jason agent platform, Second Life and AGAVE (a 3D VE for vehicles). Through these examples, we are able to carry out a preliminary evaluation of the approach against the factors above, against alternative systems and demonstrate effective distributed execution.