A system including a learning module and an algorithmic module for learning a physiological aspect of a patient body and regulating the delivery of a physiological agent to the body. An embodiment of the invention is an adaptive CRT device performing biventricular pacing in which the AV delay and VV interval parameters are changed dynamically according to the information supplied by the IEGM, hemodynamic sensor and online processed data, in order to achieve optimal hemodynamic performance.