This is the section of an AGC circuit I'm working on for audio frequencies.
The stages are:
(1) Voltage divider w/ an n-channel MOSFET as a variable resistor
(2) Buffer amplifier (output green)
(3) Peak Detector (output red)
(4) Comparator of peak voltage vs reference voltage. Provides feedback to the MOSFET.
The reference voltage is controlled at the orange node.
The AGC speed is controlled with the potentiometer in the feedback line. If the speed is too fast there will be a bit rebound when equalizing.
The primary output is at the green node.