G4NSJ - Receiver RF gain control. What is it for? AGC slow fast off for AM or SSB?

What is the RF gain control for on your HF receiver? What is AGC? Should it be set for slow, fast or off for AM or SSB transmissions? Should you leave the RF gain at maximum?