In this paper, we propose a general methodology to characterize (i.e. develop the recursive equation systems for) the dynamic stochastic general equilibrium asset pricing problems (DSGE) with arbitrary numbers of agents and financial assets in a Lucas economy and propose a convergent numerical method to solve the equation systems. Potentially, we can introduce arbitrary market structures, frictions or other exotic settings in agents' optimization problems, such as incomplete market, portfolio constraint, transaction cost, price impact, heterogeneous beliefs, habit formation, generalized recursive preferences, long run risks, idiosyncratic risk, rare disasters, ambiguity aversion, Knightian uncertainty, information asymmetry or some behavioral finance features, such as non-concave utility functions or probability distortions. In particular, we apply our method to three related theoretical asset pricing problems in the DSGE framework: asset pricing with complete market, or incomplete market, heterogeneous beliefs and external habits or generalized recursive preferences and portfolio constraints. A novel convergent numerical technique is proposed, which is based on convergent function approximation (e.g., machine learning function approximation via artificial neural networks). The numerical method introduced is powerful and can be applied to problems of high dimensions and extended to all types of the backward stochastic differential equations or partial differential equations in the literature. With the help of machine learning function approximation, we are able to accurately find the numerical solution of a DSGE or a partial equilibrium asset pricing problem in a future time-space grid. Machine learning technique is also combined with traditional stochastic differential equations with jumps to model the underlying asset prices, which opens the door to a completely new modeling field and therefore gives classical stochastic finance theory a new life. In the end, some forward-looking thoughts in financial modeling are provided. Numerical experiments are carried out and the solutions are analyzed.