The paper presents a programming model for a new pervasive computing middleware. The middleware, called ROVERS, targets an environment composed of tiny, resource-constrained, wirelessly communicating nodes embedded into everyday objects. The environment is heterogeneous in that each node is equipped with a unique set of sensors and actuators. The nodes establish an ad-hoc network and contribute their specific resources. The ROVERS layer transforms the network into a distributed pervasive computing platform. The ROVERS application is an evolving tree of cooperating, mobile micro-agents. The tree adapts to available resources and the current context. It is largely decoupled from the concept of the physical node. ROVERS provides the programmer with implicit resource discovery, inter-agent communications with logical addressing, minimization of applicationgenerated traffic, ontology-driven representation of sensor and actuator resources, as well as support for component-based programming. The programming model lends itself to an implementation for a miniature operating system, like TinyOS.