Skip to content

Concepts

Agents propose, statistics decide

The loop has five steps. Agents do the creative work; the toolkit does every calculation and every decision.

Step Who How
Draft challengers from the winner and the facts Agent skill write-challengers, with a critic pass
Size each test and plan which run together Statistics proportion_sample_size, plan_portfolio
Judge running tests Statistics check_sample_ratio_mismatch, judge_experiment
Ship the winner, delete the loser Agent skill ship-and-clean-up, one pull request
Explain the result Statistics explain_verdict

Every input and result is an immutable Pydantic model that serializes to JSON, so an agent reads and writes the same objects as your code. Invalid input raises with a reason instead of being guessed at; the MCP server returns that reason to the agent.

Assign

hashed_variant maps an experiment and a unit to an arm through an 8-byte BLAKE2b hash: stable, uniform and stateless. in_holdout keeps a fixed share of units on the static behaviour. Where units cannot be split, such as viewers of one live stream, switchback_block and switchback_variant assign whole time blocks.

Plan

plan_portfolio treats each surface, such as a page or a stream, as one budget of traffic and alpha. Undecided experiments join the running set from the most trafficked down, as long as every running one still decides within the horizon at its Bonferroni share of alpha. The rest queue, with the weeks they would need. The primary metric is the one that decides soonest, and choose_primary_metric keeps it until another is switch_speedup times faster, so the decision metric does not flip with noise.

Decide

judge_experiment reaches one verdict for a two-arm test:

  1. Sample ratio gate. If the arms' counts fail the chi-square check, every analysed metric becomes a sample ratio mismatch: the arms are no longer comparable.
  2. One corrected family. The p-values of the primary metric and the guardrails are corrected together with Bonferroni, Holm or Benjamini-Hochberg.
  3. Better or worse only with evidence. A metric moves only when its adjusted p-value is at most alpha and its confidence interval excludes zero. An arm below its minimum sample is not enough data yet.
  4. Primary names the winner, guardrails veto. A treatment win on the primary metric is vetoed by any guardrail that got worse.

Rates use a pooled score test with a Newcombe interval, means use Welch's t-test.

Monitor

Looking at a running test every day inflates false alarms. The sequential functions spend alpha over the looks with Lan-DeMets O'Brien-Fleming or Pocock type boundaries, computed exactly. detect_harm applies this to changes that cannot be randomized, such as a deploy: the data before is the control, every new observation after is a look, and the one-sided test points in the harmful direction.

Allocate

When the goal is to earn while learning rather than to decide, thompson_allocation gives each arm a minimum share plus its posterior probability of the best reward rate, and apportion turns the shares into whole units such as workers.

Explain

explain_verdict writes what was tested, what happened, how sure we are and what comes next, from the numbers alone. Given the plan, it also says how long a test still needs.

Methods and limits

The formulas, assumptions and references are in Statistical methods. The analyses assume independent units, randomized or exchangeable arms and metrics fixed before looking at results. The toolkit covers two-arm tests; it does not adjust for covariates, cluster standard errors or estimate effects after an early sequential stop.