Roles
A user must be assigned of the following application roles to execute any of the procedures described on this page:admineditor
Resource Kinds
All references tokind below must be one of:
labsubjecttypeexperiment
List Resources
Each of the following “list” commands returns a table with the following columns:| Column | Description | Data Type |
|---|---|---|
kind | The resource kind. | VARCHAR |
id | ID of the resource. | VARCHAR |
name | Name of the resource. | VARCHAR |
status | Resource status | VARCHAR |
description | Resource description | VARCHAR |
resource_version | Current resource version | INT |
status must be one of ResourceStatus.
Examples
Get YAML for a single resource
| Column | Description | Data Type |
|---|---|---|
kind | The resource kind. | VARCHAR |
id | ID of the resource. | VARCHAR |
yaml | The full configuration (YAML) for a single resource. | VARCHAR |
Examples
Create or update resource
id specified exists, it gets updated, otherwise it will be created.
Examples
Experimentation Convenience Methods
In addition to the above methods using raw YAML, you may also create/manage experiments with the following purpose-built convenience methods. All methods also have a*_preview variant is available that returns the YAML that would be applied without actually creating the experiment:
Create Experiment
Creates a new experiment with the following inputs. The experiment is created indraft status.
| Parameter | Description | Data Type | Example |
|---|---|---|---|
id | Unique identifier for the experiment. Alphanumeric, hyphens, underscores, dots only. | VARCHAR | 'homepage-cta-test' |
name | Human-readable name for the experiment. | VARCHAR | 'Homepage CTA Test' |
description | Optional description of the experiment. Pass NULL to omit. | VARCHAR | 'Testing button color on homepage' |
parent_lab | Optional ID of the parent lab. Pass NULL to use the DEFAULT lab. Must exist if provided. | VARCHAR | 'growth-lab' |
hypothesis | Optional hypothesis for the experiment. Pass NULL to omit. | VARCHAR | 'A green CTA will increase conversions by 10%' |
subject_type | ID of the subject type. Must already exist. | VARCHAR | 'USER' |
variants | JSON array of variant objects. Each must have id, name, and isControl. Optional description. At most 1 control. | VARCHAR (JSON) | '[{"id":"control","name":"Blue Button","isControl":true},{"id":"green","name":"Green Button","isControl":false}]' |
initial_cohort | JSON array of cohort variant entries with variant and split. Splits must sum to 1.0. Requires variants. Pass NULL to omit. | VARCHAR (JSON) | '[{"variant":"control","split":0.5},{"variant":"green","split":0.5}]' |
operation, kind, id, name, status, description.
Add Variants
Adds one or more new variants to an existing experiment. Variant IDs must not conflict with existing variants. At most 1 control variant is allowed across all variants on the experiment.| Parameter | Description | Data Type | Example |
|---|---|---|---|
experiment_id | ID of the experiment to add variants to. Must exist. | VARCHAR | 'homepage-cta-test' |
variants | JSON array of variant objects. Each must have id, name, and isControl. Optional description. | VARCHAR (JSON) | '[{"id":"red","name":"Red Button","isControl":false,"description":"Red variant"}]' |
operation, kind, id, name, status, description.
Add Cohort
Adds a new cohort to an existing experiment. The cohort index is automatically assigned as the next sequential value. The experiment must already have variants defined.| Parameter | Description | Data Type | Example |
|---|---|---|---|
experiment_id | ID of the experiment. Must exist and have variants defined. | VARCHAR | 'homepage-cta-test' |
cohort_variants | JSON array of cohort entries. Each must have variant (must be an existing variant on the experiment) and split (0.001–1.0). Splits must sum to 1.0. At most 1 control variant. | VARCHAR (JSON) | '[{"variant":"control","split":0.34},{"variant":"green","split":0.33},{"variant":"red","split":0.33}]' |
operation, kind, id, name, status, description.
Set Experiment Status
Sets the status of an existing experiment.| Parameter | Description | Data Type | Example |
|---|---|---|---|
experiment_id | ID of the experiment. Must exist. | VARCHAR | 'homepage-cta-test' |
status | New status. Must be one of: active, archived, draft, ended, winner_declared. | VARCHAR | 'active' |
operation, kind, id, name, status, description.
Update Experiment
Updates one or more properties of an existing experiment. PassNULL for any field that should not change. At least one field must be provided.
| Parameter | Description | Data Type | Example |
|---|---|---|---|
experiment_id | ID of the experiment. Must exist. | VARCHAR | 'homepage-cta-test' |
name | New name. Pass NULL to keep current. | VARCHAR | 'Updated CTA Test' |
description | New description. Pass NULL to keep current. | VARCHAR | 'Revised experiment description' |
status | New status. Must be one of: active, archived, draft, ended, winner_declared. Pass NULL to keep current. | VARCHAR | 'ended' |
hypothesis | New hypothesis. Pass NULL to keep current. | VARCHAR | 'Updated hypothesis' |
ended_reason | Reason the experiment ended. Only valid when status is ended. Must be one of: no_longer_needed, no_stat_sig, other_reason, success, tech_issue. | VARCHAR | 'success' |
winning_variant | ID of the winning variant. Only valid when status is winner_declared. Must be a variant on the experiment. | VARCHAR | 'green' |
operation, kind, id, name, status, description.
Get Current Cohort
Returns the current (highest-indexed) cohort for an experiment, with variant details.| Parameter | Description | Data Type | Example |
|---|---|---|---|
experiment_id | ID of the experiment. Must exist and have at least one cohort. | VARCHAR | 'homepage-cta-test' |
cohort_index (NUMBER), variant (VARCHAR), name (VARCHAR), description (VARCHAR), is_control (BOOLEAN), split (FLOAT).
Describe Experiment YAML
Given experiment YAML, returns a markdown-formatted description of the experiment including metadata, variants, and cohort details.| Parameter | Description | Data Type | Example |
|---|---|---|---|
yaml | Full experiment YAML string. | VARCHAR | (output from get_resource_yaml) |
markdown column containing the formatted description.