The overall research goal of this proposal is to design, develop, evaluate and deploy Pragma, the next generation adaptive runtime infrastructure capable of reactively and proactively managing and optimizing application execution using current system and application state, predictive models for system behavior and application performance, and an agent based control network. The overarching motivation for this research is to enable very large-scale, dynamically adaptive scientific and engineering simulations on widely distributed and highly heterogeneous and dynamic execution environments such as the computational "grid". The design, development and evaluation of the proposed Pragma framework will be conducted in collaboration with the Astronomy Department at the University of Arizona in the context of a real-world astrophysical hydrodynamics simulation using adaptive mesh refinement and including multigroup flux-limited diffusion, self gravity, nuclear burning, and a complex equation of state.