create_experiment
Creates an experiment comparing a candidate pipeline version against a baseline, scored by one Metric Group over Dataset test cases; preview shows reuses, replays, and cells before running.
Instructions
Creates an Experiment that compares a candidate pipeline version against a baseline.
Both sides are scored by the same Metric Group over the test cases of one Dataset. The baseline
is either another pipeline version (give baseline_pipeline_name and
baseline_pipeline_version_id together) or Recorded (leave both unset): a Recorded baseline
reuses the Sessions each test case recorded, with nothing replayed. The candidate is always a
pipeline version that will be replayed on each test case.
Creating costs money: it replays the pipeline on the customer's models, and then every Session
is judged by the Metric Group's Evaluators, which are billed when they use an LLM. Call it first
with preview=True: that starts nothing and returns, per side, how many Sessions are
reused_sessions and how many replays_needed, plus cells (Sessions times Evaluators)
against max_cells. Show that to the user and get a yes before creating for real.
sessions_per_test_case sets how many Sessions each side scores per test case
(1..50); existing Sessions on that version are reused and only the shortfall is replayed.
Set reuse_sessions=False to replay every Session instead of reusing any, for example after a
change outside the pipeline's configuration such as a secret; it costs more replays, so preview
it. A Recorded baseline still scores the Dataset's own Sessions. Find
ids with list_metric_groups (metric groups) and list_experiments (an existing
Experiment's dataset_id). Read the running or finished Experiment with
get_experiment_results; follow its progress with get_experiment.
:param name: Human-readable name for the Experiment.
:param dataset_id: The Dataset's id (the UI's Dataset dropdown).
:param metric_group_id: The Metric Group id to score both sides with.
:param candidate_pipeline_name: Name of the candidate pipeline.
:param candidate_pipeline_version_id: The candidate pipeline version to replay.
:param baseline_pipeline_name: Baseline pipeline name; omit for a Recorded baseline.
:param baseline_pipeline_version_id: Baseline version id; required when baseline_pipeline_name is given.
:param sessions_per_test_case: Repetitions per test case (1..50, default 1).
:param replay_mode: FIRST_USER_MESSAGE replays the first turn only; ALL_USER_MESSAGES replays every turn.
:param reuse_sessions: False replays every Session each side scores and reuses none (default True).
:param preview: True returns the plan (what would be reused and replayed) and creates nothing.
:returns: The created Experiment, or with preview the plan, or an error message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| preview | No | ||
| dataset_id | Yes | ||
| replay_mode | No | FIRST_USER_MESSAGE | |
| reuse_sessions | No | ||
| metric_group_id | Yes | ||
| baseline_pipeline_name | No | ||
| sessions_per_test_case | No | ||
| candidate_pipeline_name | Yes | ||
| baseline_pipeline_version_id | No | ||
| candidate_pipeline_version_id | Yes |