AGC questions

Sorry if I’m writing to the wrong direction, it’s the first time I’m
doing this. I was interested in making a AGC (automatic gain control),
however, the one that’s supplied doesn’t help at all. I wanted to
change the usrp.set_gain every time the input power is or too hi or
too low. For example, if I’m working at -10 dBm at the input, and want
to lower the usrp.set_gain from 10 to 20, how can I do that with the
agc that comes with the gnu radio library? Thanks a lot! Any help will
we really appreciated.