You'll have to remove the existing resource and then add the new object to the resources
Resources.Remove("AgentsList");
Resources.Add("AgentsList", agents);
I don't understand why you would want to do this, but no matter what you're trying to achieve I'm sure you could do it in a much better way.
Also remember if you refer to the resource with
StaticResource
then what you do will have no effect, using
DynamicResource
might but not necessarily have the effect you're trying to achieve.