:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(experiments): expose running_time_calculation on experiment-update (#64791)
Anders09d2697167e0
diff --git a/products/experiments/mcp/tools.yaml b/products/experiments/mcp/tools.yamlindex d4f4dfcb91e2..1ef62a982afb 100644--- a/products/experiments/mcp/tools.yaml+++ b/products/experiments/mcp/tools.yaml@@ -838,6 +838,7 @@ tools:- name- description- parameters+ - running_time_calculation- metrics- metrics_secondary- stats_config@@ -851,6 +852,14 @@ tools:param_overrides:id:cast: string-int+ running_time_calculation:+ description: >+ Persist a running-time / sample-size plan onto the experiment (the planning target shown in the+ experiment's running-time panel). Object with optional keys: minimum_detectable_effect (percentage,+ e.g. 20 for a 20% lift), recommended_sample_size (total across all variants),+ recommended_running_time (days), and exposure_estimate_config. These values are kept in sync with+ the legacy parameters.* keys during the deprecation window, so prefer this field over writing the+ calculator keys inside parameters.ui_app: experimentresponse:include:@@ -865,6 +874,7 @@ tools:- end_date- created_at- parameters+ - running_time_calculation- metrics- metrics_secondary- conclusiondiff --git a/services/mcp/src/tools/generated/experiments.ts b/services/mcp/src/tools/generated/experiments.tsindex 5955c721313c..1eae6325fc57 100644--- a/services/mcp/src/tools/generated/experiments.ts+++ b/services/mcp/src/tools/generated/experiments.ts@@ -768,7 +768,6 @@ const ExperimentUpdateSchema = ExperimentsPartialUpdateParams.omit({ project_id:start_date: true,end_date: true,feature_flag_key: true,- running_time_calculation: true,secondary_metrics: true,saved_metrics_ids: true,filters: true,@@ -781,7 +780,12 @@ const ExperimentUpdateSchema = ExperimentsPartialUpdateParams.omit({ project_id:only_count_matured_users: true,}).shape)- .extend({ id: z.preprocess(castStringToInt, ExperimentsPartialUpdateParams.shape['id']) })+ .extend({+ id: z.preprocess(castStringToInt, ExperimentsPartialUpdateParams.shape['id']),+ running_time_calculation: ExperimentsPartialUpdateBody.shape['running_time_calculation'].describe(+ "Persist a running-time / sample-size plan onto the experiment (the planning target shown in the experiment's running-time panel). Object with optional keys: minimum_detectable_effect (percentage, e.g. 20 for a 20% lift), recommended_sample_size (total across all variants), recommended_running_time (days), and exposure_estimate_config. These values are kept in sync with the legacy parameters.* keys during the deprecation window, so prefer this field over writing the calculator keys inside parameters."+ ),+ })const experimentUpdate = (): ToolBase<typeof ExperimentUpdateSchema, WithPostHogUrl<Schemas.Experiment>> =>withUiApp('experiment', {@@ -802,6 +806,9 @@ const experimentUpdate = (): ToolBase<typeof ExperimentUpdateSchema, WithPostHogif (params.parameters !== undefined) {body['parameters'] = params.parameters}+ if (params.running_time_calculation !== undefined) {+ body['running_time_calculation'] = params.running_time_calculation+ }if (params.archived !== undefined) {body['archived'] = params.archived}@@ -846,6 +853,7 @@ const experimentUpdate = (): ToolBase<typeof ExperimentUpdateSchema, WithPostHog'end_date','created_at','parameters',+ 'running_time_calculation','metrics','metrics_secondary','conclusion',diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.jsonindex 1ff538a7ae82..fd6579fa7f38 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/experiment-update.json@@ -3643,6 +3643,105 @@],"description": "Experiment parameters JSON. Supported keys include `feature_flag_variants`, `rollout_percentage`, `minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `custom_exposure_filter`, and `excluded_variants` (list of variant keys to drop from statistical analysis; the baseline variant and holdout pseudo-variants cannot be excluded). The running-time calculator keys (`minimum_detectable_effect`, `recommended_running_time`, `recommended_sample_size`, `exposure_estimate_config`) are deprecated here — prefer `running_time_calculation`."},+ "running_time_calculation": {+ "anyOf": [+ {+ "properties": {+ "exposure_estimate_config": {+ "anyOf": [+ {+ "properties": {+ "conversionRateInputType": {+ "description": "'manual' when the baseline value and exposure rate were entered by hand, 'automatic' when derived from live experiment data.",+ "enum": ["manual", "automatic"],+ "type": "string"+ },+ "manualBaselineValue": {+ "anyOf": [+ {+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "Manually entered baseline metric value (a conversion percentage for funnel metrics). Only used in manual mode."+ },+ "manualExposureRate": {+ "anyOf": [+ {+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "Manually entered estimate of users exposed to the experiment per day. Only used in manual mode."+ },+ "manualMetricType": {+ "anyOf": [+ {+ "enum": ["funnel", "mean_count", "mean_sum_or_avg"],+ "type": "string"+ },+ {+ "type": "null"+ }+ ],+ "description": "Metric type the manual baseline value refers to. Only used in manual mode."+ }+ },+ "required": ["conversionRateInputType"],+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "description": "How the exposure estimate is configured: manual user-entered values or automatic from live experiment data."+ },+ "minimum_detectable_effect": {+ "anyOf": [+ {+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "Minimum detectable effect as a percentage. Lower values need more users but catch smaller changes."+ },+ "recommended_running_time": {+ "anyOf": [+ {+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "Estimated number of days needed to reach the recommended sample size."+ },+ "recommended_sample_size": {+ "anyOf": [+ {+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "Recommended number of exposed users needed for statistical significance."+ }+ },+ "type": "object"+ },+ {+ "type": "null"+ }+ ],+ "description": "Persist a running-time / sample-size plan onto the experiment (the planning target shown in the experiment's running-time panel). Object with optional keys: minimum_detectable_effect (percentage, e.g. 20 for a 20% lift), recommended_sample_size (total across all variants), recommended_running_time (days), and exposure_estimate_config. These values are kept in sync with the legacy parameters.* keys during the deprecation window, so prefer this field over writing the calculator keys inside parameters."+ },"stats_config": {},"update_feature_flag_params": {"description": "When true, sync feature flag configuration from parameters to the linked feature flag. Draft experiments always sync regardless of update_feature_flag_params, so only required for non-drafts.",