Cyber-Physical systems interact with their environment in complex ways. In addition to exchanging information with other systems, they affect and are affected by their physical/natural environment. Their components run concurrently and may be physically distributed, participating in both synchronous and asynchronous interactions. Existing formal models typically model closed systems, or limited interactions among system components. In this paper we introduce the Concurrent Rules Machine (CRM), a formal model of system behavior that makes explicit interaction with the environment. We define an algebra of operations for CRM composition and decomposition along with equational properties. We illustrate our ideas with a simple cyber-physical system example.