Adaptive microfoundations for emergent macroeconomics