change agent instances to unique_ptr
use unique_ptr in clietlocal worker