I have experienced this once - surging idle going "rrrup..rrrup..rrrup.."
For me it was "bad" air (unmetered air) getting into the system post-AFM.
Usually it means that the soft ribbed hose from the AFM is installed incorrectly.
If you don't watch it closely you may have a gap under the connection between the two hoses above the intake cam.
I assume that if you drive for a couple blocks when your engine is doing this you may have replace your engine mounts, and go to a chiropractor.