Thompson Sampling
ADA uses Thompson Sampling to select the optimal agent for each phase. It is a multi-armed bandit algorithm with implicit exploration — it explores underrated agents while exploiting the best known ones.
The Beta-Bernoulli model
Each (phaseType, agentId) pair maintains two counters: α (successes) and β (failures). These parameterize a Beta distribution.
θ ~ Beta(α + 1, β + 1) — agent with highest sampled θ is selected
function selectAgent(phaseType, candidates) {
const samples = candidates.map(agent => {
const { alpha, beta } = getDistribution(phaseType, agent.id)
const theta = sampleBeta(alpha + 1, beta + 1)
return { agent, theta }
})
return samples.sort((a, b) => b.theta - a.theta)[0].agent
}
function updateDistribution(phaseType, agentId, success) {
const dist = getDistribution(phaseType, agentId)
if (success) dist.alpha++
else dist.beta++
saveDistribution(phaseType, agentId, dist)
}Convergence
After ~20 runs on a task type, distributions converge and quality gains plateau. Projects with repetitive tasks (CRUD features, migrations, specs) converge fastest.