I am aware of the mechanism of Spike Timing Dependent Plasticity (STDP) and its ability to cause Long Term Potentiation (LTP) and Long Term Depression (LTD). So far, I've been viewing neurons as input-output devices. However, there seems to be a problem with approximating neurons this way. If all they do is sum the inputs and produce an output, then it seems as if LTP and LTD as caused by STDP would be purely a function of the inputs from the environment. This would leave animals without any meaningful agency.
I would be much more comfortable with the idea that neurons actively try to optimize some parameters by competing with each other, perhaps by varying the timing of their spikes. Is this picture consistent with neuro-scientific findings?