Skip to main content

Module engine

Module engine 

Source
Expand description

Evolution engine: the glue that turns primitives into a working A/B loop.

Called from cmd_record (after each session is inserted) and from cmd_roll (manual challenger generation).

Functions§

collect_scores_for_config
Load all signals tied to sessions that ran under config_id, group by session, and collapse each session’s signals into a single 0..=1 score.
evaluate_promotion
Evaluate the running experiment (if any) against the promotion threshold. Returns the experiment + decision, or None if no experiment is running.
generate_challenger
Generate a challenger from the current champion using one mutator, persist it as an AgentConfig row with role=Challenger, start a new Experiment with traffic_share=1.0 (v0.2.0 deploys the challenger full-time and compares against the historical champion’s session population), and apply the challenger config to disk via the adapter.
promote_challenger
Promote the challenger: mark experiment as Promoted, swap project’s champion pointer, and re-apply the new champion to disk via the adapter.
resolve_active_deployment
Figure out which variant + config_id a new session should be tagged with. If an experiment is running: challenger variant on the challenger config. Otherwise: champion variant on the project’s champion config.
should_evolve
Default scheduler: trigger challenger generation when enough sessions have accumulated since the last champion change. Skips if an experiment is already running.