update agent delete function