loop to init ai tasks