I think it's too late to change the batch size after some agents have already entered the batch block. So you can try keep track of the number of leftovers before they enter batch block, maybe in the queue block, and changing batch size from there.