Abstract
Stochastic processes underpin dynamics across biology, physics, epidemiology, and finance, yet accurately simulating them remains a major challenge. Classical approaches such as the Gillespie algorithm are exact for Markovian, time-independent systems, where propensities depend only on the current state and agents of a given type are statistically identical. While efficient, this framework misses a defining feature of many real systems: heterogeneity and memory at the level of individual agents. Cells may divide or differentiate on distinct intrinsic timescales, individuals may preferentially interact with specific partners, and inter-event-time distributions can deviate strongly from the exponential. We introduce MOSAIC (Modeling of Stochastic Agents with Individual Complexity), a general and scalable framework that embeds agent-specific properties directly into the dynamics. MOSAIC unifies heterogeneous rates, dynamic interaction preferences, and both Markovian and non-Markovian waiting-time distributions within a single stochastic formalism, while retaining Gillespie-like computational cost. Applications to delayed biochemical reactions, competitive immune-cell dynamics, and temporal social networks show that MOSAIC reproduces empirical features that existing methods either miss or capture only at prohibitive computational cost, establishing it as a practical tool for simulating heterogeneous stochastic systems.