Getting started¶
Install¶
pip install experimentation-toolkit # the statistics, Python 3.12+
pip install "experimentation-toolkit[agent]" # plus the MCP server experimentation-toolkit-mcp
In Claude Code, install the four skills and the MCP server as one plugin:
/plugin marketplace add datenwissenschaften/experimentation-toolkit
/plugin install experimentation-toolkit@experimentation-toolkit
Any other MCP client starts the server over stdio with uvx --from "experimentation-toolkit[agent]" experimentation-toolkit-mcp.
Run one experiment¶
1. Assign units¶
A unit, such as a visit, always lands in the same arm, without storing anything:
from experimentation_toolkit import hashed_variant
arm = hashed_variant(
experiment="arcade_button_r1", variants=["current", "play_now"], unit="visit-1234"
)
For surfaces you cannot split by user, such as a live stream, switchback_block and switchback_variant assign whole time blocks instead.
2. Size the test before it starts¶
from experimentation_toolkit import proportion_sample_size
size = proportion_sample_size(
baseline_rate=0.20,
minimum_detectable_effect=0.10,
mde_type="relative",
alpha=0.05,
power=0.8,
allocation_ratio=1.0,
alternative="two-sided",
)
print(size.control_sample_size, size.treatment_sample_size)
With several tests competing for the same traffic, plan_portfolio decides which run together and which wait (see Concepts).
3. Judge and explain¶
judge_experiment turns the analysed metrics and a sample ratio check into one verdict, and explain_verdict writes it up for stakeholders. The README shows the complete example with its output.
4. Watch a deploy for harm¶
Changes that cannot be randomized, such as a deploy, are compared before and after, with one look per new observation:
from experimentation_toolkit import Direction, detect_harm
harm = detect_harm(
before=[152, 148, 155, 149, 151, 147, 153, 150],
after=[96, 88, 92, 90],
maximum_after=24,
better=Direction.HIGHER,
alpha=0.05,
spending="obrien-fleming",
metric_name="frames_saved_per_hour",
)
print(harm.harmed, harm.detected_after) # True 3: harm showed after three hours
Let an agent run the loop¶
With the plugin installed, ask Claude Code for the next step, for example "draft a challenger for the arcade button" or "has the music test a winner?". The skills call the MCP tools size_experiment, plan_experiments, judge_experiment and explain_result, and never declare a winner the verdict does not name.