# binomial confidence including run to run variation for overdispersion

I'm trying to determine the model to correct a confidence interval (binomial proportion for example) but to also include overdispersion effects that arise from a Run-to-Run variation.

Example,

case 1: 1 batch, where we are measuring pass and fail rates from 100 individual results. In this case, if I see 50% pass, then a simple CI for a binomial proportion model would be

$$\text{ci} = \pm z*\sqrt{p \cdot (1-p) / n}$$ in this case, $$n=100$$

case 2: 10 batches are measured, each with 100 individual results. Average is 50% for all 10 runs, but with run-to-run std deviation of 5%.

In this case, I could use the same model as above with n=1000 (100 x 10 batches). But if there is an uncontrolled run to run variation that contributes to overdispersion that is ignored, then the CI would likely be too small.

What model should I use to include the effects of the run to run variation, in addition to the binomial model CI in this case?