In this article we report the formalism and first implementation of the ab initio multiconfigurational Ehrenfest (AI-MCE) method for simulation of ultrafast nonadiabatic dynamics, which uses the MOLPRO electronic structure program to calculate the potential energy surfaces on the fly. The approach is tested on the benchmark of the excited ππ∗ state dynamics of ethylene producing the dynamics which agree with previous simulations by ab initio multiple spawning technique. The AI-MCE seems to be robust, stable and efficient.