: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
# MCP tool definitions. Tools are opt-in: an operation is exposed only when it has an entry here.
# List operations without an entry: pnpm --filter=@posthog/mcp run scaffold-yaml -- --candidates --product autoresearch
# Add one: pnpm --filter=@posthog/mcp run scaffold-yaml -- --add <operationId> --product autoresearch
# To keep an operation off on purpose, set enabled: false and give a disabled_reason.
category: Autoresearch
feature: autoresearch
url_prefix: /autoresearch
ui_apps: {}
tools:
autoresearch-agent-models-retrieve:
operation: autoresearch_agent_models_retrieve
enabled: false
disabled_reason: Feeds the Setup tab model picker. Agents set agent_model on autoresearch-create or
autoresearch-partial-update, and an invalid value returns the valid choices, which keeps the family under
its tool cap
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: List training agent models
description: >
List the models a pipeline's training agent may run on, with the reasoning efforts each supports, its
relative token cost, and the default a pipeline with blank settings uses.
feature_flag: autoresearch
autoresearch-archive-create:
operation: autoresearch_archive_create
enabled: false
disabled_reason: Pipeline lifecycle stays in the UI; see products/autoresearch/mcp/AGENTS.md
scopes:
- autoresearch:write
annotations:
readOnly: false
destructive: true
idempotent: true
title: Archive pipeline
description: >
Soft-delete a pipeline. Stops daily scoring and training. Prediction history and model artifacts are
preserved. Archived pipelines are excluded from autoresearch-list. Refused while a training run is in
progress. There is no unarchive, so use autoresearch-pause-create to stop a pipeline temporarily.
feature_flag: autoresearch
autoresearch-create:
operation: autoresearch_create
enabled: true
scopes:
- autoresearch:write
annotations:
readOnly: false
destructive: false
idempotent: false
enrich_url: '{id}'
title: Create a pipeline
description: >
Create a new autoresearch prediction pipeline. Always call autoresearch-validate-create first — this
endpoint does not block on validation errors. The prediction target is either an event (pass target_event,
e.g. '$pageview') or a PostHog action (pass target_definition = {"type": "action", "action_id": N} to
predict a multi-step / property / autocapture matcher; target_event is then optional; it is the display
label and the source of the derived output property name). An action target needs the action:read scope.
horizon_days defaults to 7. The output person property (e.g. 'predicted_p_pageview') is auto-derived from
target_event, or from the action name when target_event is omitted, if you do not set it. It must be unique
among the project's non-archived pipelines. Scores are written to that person property only when
write_person_property is true (default false); prediction events, validation and segments work without it.
iterations_per_run (default 5) sets the experiments in each training run. research_interval_days (7, 14, 30,
60 or 90, default 7; null means only when asked) sets how often scheduled research runs once the first burst
of daily runs ends. agent_model and agent_reasoning_effort choose the model and effort the training agent
runs on; leave them out to use the autoresearch default (Claude Opus 5.5 at medium effort). A larger model
or higher effort costs more per training run, and an unknown model or an effort the model does not support
returns 400 with the valid choices. After creating, call autoresearch-train-create to start an asynchronous
agent training run.
exclude_params:
- id
- created_by
- created_at
- updated_at
- last_scored_at
- status
- iteration_budget_remaining
feature_flag: autoresearch
autoresearch-limits-retrieve:
operation: autoresearch_limits_retrieve
enabled: false
disabled_reason:
Feeds the Setup tab. The refusals from autoresearch-train-create already name the limit and when the
next run can start, which keeps the family under its tool cap
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: Read project limits
description: >
Read the project's autoresearch limits and current usage: training runs in the last 24 hours against the
daily limit and when the next can start, the most experiments per run, and live pipelines against the live
pipeline limit.
feature_flag: autoresearch
autoresearch-list:
operation: autoresearch_list
enabled: true
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
list: true
title: List pipelines
description: >
List autoresearch prediction pipelines for the current project. Archived pipelines are excluded. Each
pipeline entry includes its status (draft, bootstrapping, running, converged, paused), target event,
horizon, and timestamps. Use autoresearch-retrieve to get full details including population definitions.
feature_flag: autoresearch
response:
include:
- id
- name
- description
- target_event
- horizon_days
- status
- iterations_per_run
- research_interval_days
- effective_agent_model
- effective_agent_reasoning_effort
- training_phase
- next_research_at
- last_scored_at
- created_at
- updated_at
autoresearch-materialize-features:
operation: autoresearch_training_runs_materialize_features_create
enabled: true
scopes:
- autoresearch:write
- query:read
annotations:
readOnly: false
destructive: false
idempotent: false
title: Materialize training features to the sandbox
description: >
Run your features.sql server-side against the labeled training population and write the train/holdout
feature and label parquet files directly into your sandbox. Returns the local paths (train_features_path,
train_labels_path, holdout_features_path, holdout_labels_path), row counts, and the feature column list —
the feature rows never pass through your context and there is NO 500-row cap. Then pd.read_parquet the
returned paths and iterate in Python. Use this to pull training data instead of execute-sql, and re-call it
whenever you change features.sql. Also returns what the feature query cost (elapsed_s and rows_read) and
hints about features.sql shapes that scale badly. A promoted model must score its inference population under
batch limits before it serves, so a slow or heavy query here is a warning. Works only for a run that
autoresearch-train-create opened in a PostHog sandbox; an agent training outside PostHog pulls its data with
execute-sql instead.
feature_flag: autoresearch
autoresearch-models-list:
operation: autoresearch_models_list
enabled: true
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
list: true
title: List models for a pipeline
description: >
List champion, challenger, and archived model versions for a pipeline. Each model includes its
holdout_score, role, recipe_hash, is_preliminary flag, and agent_description. The active scoring model has
role='champion'. Use the recipe_hash to detect when the champion has changed across training runs.
feature_flag: autoresearch
response:
include:
- id
- pipeline
- role
- recipe_hash
- holdout_score
- realized_score
- is_preliminary
- agent_description
- trained_on_start
- trained_on_end
- promoted_at
- created_at
autoresearch-models-retrieve:
operation: autoresearch_models_retrieve
enabled: true
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: Get model
description: >
Get full details for a specific model version, including the portable model recipe (feature SQL, transforms,
model class, params) and feature importance explanation.
feature_flag: autoresearch
autoresearch-online-performance-retrieve:
operation: autoresearch_online_performance_retrieve
enabled: true
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: Read realized performance history
description: >
Read how a pipeline's models performed against real outcomes, one row per model per validated prediction
date, newest date first. Each row has realized AUC with a 95% interval, Brier score, calibration error,
quantile calibration bins, mean_p_y against base_rate (mean_p_y above base_rate means the model
over-predicts), lift at 10% and 20%, the ISO weekday, and the model's role when it emitted and now. Use it
to see trends across dates and to judge a champion right after a promotion: the archived former champion
keeps its rows, while the new champion has none until its first horizon elapses. A wide AUC interval means
the date had few positives. Rows exist only after a prediction horizon has elapsed and online validation has
run. Use limit to bound the number of dates (default 60).
feature_flag: autoresearch
autoresearch-partial-update:
operation: autoresearch_partial_update
enabled: true
scopes:
- autoresearch:write
- person:write
annotations:
readOnly: false
destructive: true
idempotent: true
enrich_url: '{id}'
title: Update a pipeline
description: >
Change fields of an existing pipeline. Send only the fields to change. Use write_person_property to turn
person profile writes on or off. When it is on, each live scoring run writes the champion's score to
output_person_property on the people it scores, so feature flags, cohorts, workflows and insights can target
people by score. Scores fill in over the next few scoring runs, not all at once. Turning it off starts a
cleanup run that removes the property from the people this pipeline scored (see autoresearch-runs-list).
Changing write_person_property needs the person:write scope. Prediction events, online validation and
segments work with it off. Use iterations_per_run and research_interval_days to change the training
schedule; null research_interval_days stops scheduled research. Use agent_model and agent_reasoning_effort
to change the model the training agent runs on; null returns a field to the autoresearch default, and
effective_agent_model in the response shows what the next run uses. target_event, target_definition,
horizon_days, training_lookback_days and the two populations cannot change once a model has been trained.
exclude_params:
- id
- created_by
- created_at
- updated_at
- last_scored_at
- status
- iteration_budget_remaining
feature_flag: autoresearch
autoresearch-pause-create:
operation: autoresearch_pause_create
enabled: false
disabled_reason: Pipeline lifecycle stays in the UI; see products/autoresearch/mcp/AGENTS.md
scopes:
- autoresearch:write
annotations:
readOnly: false
destructive: false
idempotent: true
title: Pause pipeline
description: >
Pause a running pipeline. Daily scoring and training stop until the pipeline is resumed. A training run
already in progress finishes and can promote a new champion, but the pipeline scores nobody until it is
resumed. Use autoresearch-resume-create to restart.
feature_flag: autoresearch
autoresearch-resolve-template-create:
operation: autoresearch_resolve_template_create
enabled: true
scopes:
- autoresearch:read
- query:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: Resolve a template
description: >
Start here to create a pipeline from a template. Resolve a template key and optional overrides into a
ready-to-use pipeline config. An unknown key returns 400. For activity-based templates
('likely_active_soon', 'at_risk_of_inactivity', 'return_after_first_use'), the target_event is auto-resolved
from your event schema — review resolved_activity_event and activity_event_alternatives, then re-resolve
with a target_event override if the chosen event is wrong. For 'feature_adoption' and 'repeat_key_behavior',
supply target_event (required). After resolving: (1) call autoresearch-validate-create with the resolved
target_event, horizon_days, training_lookback_days, training_population and inference_population, so
validation counts the same window the pipeline will use; (2) if can_proceed is true, call
autoresearch-create with name set to suggested_name and the same five fields plus output_person_property.
For an action target, pass the same target_definition to both calls; target_event then only labels it, and
both calls need the action:read scope.
exclude_params:
- resolved_activity_event
- activity_event_alternatives
- display_name
- description
- notes
feature_flag: autoresearch
autoresearch-resume-create:
operation: autoresearch_resume_create
enabled: false
disabled_reason: Pipeline lifecycle stays in the UI; see products/autoresearch/mcp/AGENTS.md
scopes:
- autoresearch:write
annotations:
readOnly: false
destructive: false
idempotent: true
title: Resume pipeline
description: |
Resume a paused pipeline. Returns 400 if the pipeline is not currently paused.
feature_flag: autoresearch
autoresearch-retrieve:
operation: autoresearch_retrieve
enabled: true
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
enrich_url: '{id}'
title: Get pipeline
description: >
Get full details for a specific autoresearch pipeline by ID, including population definitions, training
configuration, and current status.
feature_flag: autoresearch
response:
exclude:
- created_by
autoresearch-runs-list:
operation: autoresearch_runs_list
enabled: true
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
list: true
title: List inference runs
description: >
List inference and validation runs for a pipeline, ordered most recent first. Check rows_scored and status
to understand scoring history. run_type is 'inference' for daily scoring runs. An inference run whose
metrics.rows_eligible is above rows_scored scored a rolling part of a population larger than one run allows.
feature_flag: autoresearch
response:
include:
- id
- pipeline
- model
- run_type
- status
- rows_scored
- error
- started_at
- completed_at
- created_at
autoresearch-score-create:
operation: autoresearch_score_create
enabled: true
scopes:
- autoresearch:write
- query:read
- person:write
annotations:
readOnly: false
destructive: true
idempotent: false
title: Run inference (score users)
description: >
Score today's prediction date with the champion model instead of waiting for the daily scoring run. Use
autoresearch-train-create first if the pipeline has no champion. Scoring runs in the background and returns
an inference run with status 'running'. If one is already running, returns that run without starting
another. Poll autoresearch-runs-list for this run's ID until its status is 'completed' (rows_scored is then
set) or 'failed' (error is then set). A manual score counts as today's scoring; the daily run skips the
pipeline until its next cadence date. Do not start another run for the same prediction date: it can
duplicate predictions. The pipeline must not be paused; an action target also needs the action:read scope.
Each scored user gets an 'autoresearch_prediction' event with '$autoresearch_p_y' and a person property
update. After the run completes, query predictions with execute-sql: SELECT distinct_id,
properties.$autoresearch_p_y FROM events WHERE event = 'autoresearch_prediction' AND
properties.$autoresearch_pipeline_id = '<pipeline_id>' ORDER BY properties.$autoresearch_p_y DESC LIMIT 50.
feature_flag: autoresearch
autoresearch-suggestions-create:
operation: autoresearch_suggestions_create
enabled: true
scopes:
- autoresearch:write
annotations:
readOnly: false
destructive: false
idempotent: false
title: Submit a suggestion
description: >
Inject a free-text hypothesis or direction into a running pipeline for the sandbox agent to consider. The
agent reads queued suggestions at the start of each training batch and decides whether to translate the
suggestion into a concrete iteration ('acted_on'), apply it as a search constraint ('picked_up'), or reject
it with rationale ('dismissed'). Use priority='try_next' to instruct the agent to act on this before
autonomous iterations; 'consider' (default) is advisory. Check 'agent_response' after the next training run
to see how the suggestion was interpreted. Examples: 'try a gradient boosting model', 'remove recency
features — I suspect leakage', 'the target event has a 7-day spike on Mondays, account for day-of-week'.
Suggestions survive pipeline pauses and are included in the next training batch when the pipeline resumes.
exclude_params:
- source
- status
- agent_response
- created_by
- linked_iteration_ids
feature_flag: autoresearch
autoresearch-suggestions-list:
operation: autoresearch_suggestions_list
enabled: true
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
list: true
title: List suggestions
description: >
List steering suggestions for a pipeline, ordered most recent first. Each entry shows the prompt, priority,
status (queued/picked_up/acted_on/dismissed), and the agent's response when available. Use
'linked_iteration_ids' to trace which iterations were spawned from a suggestion.
feature_flag: autoresearch
response:
include:
- id
- pipeline
- prompt
- priority
- status
- source
- agent_response
- linked_iteration_ids
- created_at
autoresearch-suggestions-respond:
operation: autoresearch_suggestions_respond_create
enabled: true
scopes:
- autoresearch:write
annotations:
readOnly: false
destructive: false
idempotent: true
title: Respond to a suggestion
description: >
Record how you handled a steering suggestion so the human who submitted it sees the outcome (it stays
'queued' in the UI until you do). Set status to 'picked_up' (applied as a search constraint across
iterations), 'acted_on' (spawned one or more iterations from it), or 'dismissed' (rejected — explain why in
agent_response), and write a one-line agent_response. Recording an iteration with parent_suggestion set
already advances a suggestion to 'acted_on'; use this tool to add the narrative or to mark a suggestion
picked_up/dismissed without a dedicated iteration.
feature_flag: autoresearch
response:
include:
- id
- pipeline
- status
- agent_response
- linked_iteration_ids
autoresearch-suggestions-retrieve:
operation: autoresearch_suggestions_retrieve
enabled: false
disabled_reason: Duplicates autoresearch-suggestions-list; the family stays at or below 25 tools
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: Get suggestion
description: |
Get full details for a specific suggestion including its status and agent_response.
feature_flag: autoresearch
autoresearch-templates-list:
operation: autoresearch_templates_list
enabled: false
disabled_reason: Replaced by autoresearch-resolve-template-create, which names every template key
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: List available templates
description: >
List all built-in autoresearch prediction templates. Each entry includes the template key, display name,
description, default horizon, prediction mode, and whether you need to supply a target_event. Templates:
'likely_active_soon' (best universal starter — predicts next-7d activity), 'at_risk_of_inactivity' (predicts
14d inactivity risk), 'return_after_first_use' (predicts new-user return within 7d), 'feature_adoption'
(predicts first use of your chosen event within 14d — requires target_event), 'repeat_key_behavior'
(predicts repeat use of your chosen event within 7d — requires target_event). After picking a template, call
autoresearch-resolve-template-create to get a resolved pipeline config.
feature_flag: autoresearch
autoresearch-train-create:
operation: autoresearch_train_create
enabled: true
scopes:
- autoresearch:write
- query:read
- insight:read
annotations:
readOnly: false
destructive: false
idempotent: false
title: Start training
description: >
Start an asynchronous training run for a pipeline. Launches the autoresearch agent in a sandbox and returns
the training run immediately with status 'running'. Poll autoresearch-training-runs-list until the run
reaches 'completed' or 'failed'. A pipeline's first run has no champion until it completes and server-side
promotion runs; on a retrain the existing champion keeps scoring until a new one is promoted. Returns 400 if
a training run is already in progress, the pipeline is paused, or its creator or target is no longer valid
(recreate the pipeline). Also returns 400 on a draft pipeline when the project already has its limit of live
pipelines (bootstrapping, running or converged): tell the user to pause or delete one first, and do not
retry. Returns 403 from inside a sandbox, such as a PostHog AI cloud task: do not retry, and ask the user to
start training from the pipeline's page in PostHog. Needs PostHog Desktop access, because the run is a cloud
sandbox. After a run promotes a champion, the daily 02:00 UTC scoring job scores the inference population
and emits autoresearch_prediction events. To score now instead, call autoresearch-score-create once. The run
uses the pipeline's iterations_per_run unless you override iteration_budget for this run, and the project's
iteration limit per run can lower either. Returns 429 when the project has started its limit of training
runs in the last 24 hours, across all its pipelines: do not retry before next_slot_at in the response, and
tell the user when the next run can start. A manual run resets the clock for the next scheduled research
run. A pipeline with an action target also needs the action:read scope.
feature_flag: autoresearch
autoresearch-training-runs-artifacts-delete-create:
operation: autoresearch_training_runs_artifacts_delete_create
enabled: false
disabled_reason: Duplicative for the training agent; the family stays at or below 25 tools
scopes:
- autoresearch:write
annotations:
readOnly: false
destructive: true
idempotent: true
title: Delete an artifact bundle file
description: >
Remove one file from a training run's artifact bundle. Idempotent — deleting a missing file is a no-op. Only
allowed while the run is still running; the bundle is frozen once the run completes or fails.
feature_flag: autoresearch
autoresearch-training-runs-artifacts-get-create:
operation: autoresearch_training_runs_artifacts_get_create
enabled: true
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: Get an artifact bundle file
description: >
Fetch one file from a training run's artifact bundle, base64-encoded. Use this to read the prior champion's
train.py / features.sql as a starting point before iterating (look up the champion's source_training_run via
autoresearch-models-retrieve).
feature_flag: autoresearch
autoresearch-training-runs-artifacts-retrieve:
operation: autoresearch_training_runs_artifacts_retrieve
enabled: true
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: List artifact bundle files
description: >
List the files uploaded for a training run's artifact bundle (train.py, predict.py, features.sql, and any
eda/ notebooks). Use to confirm a complete bundle is present before finalizing the run.
feature_flag: autoresearch
autoresearch-training-runs-artifacts-upload-create:
operation: autoresearch_training_runs_artifacts_upload_create
enabled: true
scopes:
- autoresearch:write
annotations:
readOnly: false
destructive: false
idempotent: true
title: Upload an artifact bundle file
description: >
Upload one file of a training run's runnable model bundle. Send the file contents base64-encoded in
content_base64; path is the relative path within the bundle (train.py, predict.py, features.sql, or an eda/
notebook). Re-uploading the same path overwrites it. Keep each file under about 700 KB: the base64 body must
fit the MCP server's 1 MiB request limit. A bundle holds at most 32 files. This is how you author the model
— author train.py and predict.py (standalone sklearn scripts; the framework runs `python train.py
<train_features.parquet> <train_labels.parquet> <model.pkl> <output.json> <holdout_features.parquet>
<holdout_labels.parquet> --random-state N`, which pickles {"model", "feature_cols"} and writes
{"holdout_auc", "n_train", "n_features"} to output.json, and `python predict.py <score_features.parquet>
<model.pkl> <scores.parquet>`, which writes distinct_id,p_y; features parquet is distinct_id plus numeric
columns, labels parquet is distinct_id,__label) and features.sql (HogQL with the {anchors}/{lookback_days}
contract), then upload each here. Do NOT use set_output or curl — the bundle you upload is what inference
runs in a sandbox. Only allowed while the run is still running; the bundle is frozen once the run completes
or fails.
feature_flag: autoresearch
autoresearch-training-runs-complete-create:
operation: autoresearch_training_runs_complete_create
enabled: true
scopes:
- autoresearch:write
annotations:
readOnly: false
destructive: false
idempotent: true
title: Complete a training run
description: >
Finalize a training run. The backend selects the kept iteration with the highest holdout_score.
best_iteration_id only breaks a tie at that top score and never overrides the ranking, so upload the bundle
of the highest-scoring iteration. The backend then decides champion vs challenger via the promotion ladder
(cold-start preliminary, anti-thrash margin for an existing champion), and persists the model. Agents cannot
set the champion directly — promotion is server-only. Call autoresearch-models-list afterwards to see the
resulting champion/challenger. Optionally pass model_explanation (top features and directionality) for the
model card. Also pass distillation (1–2 sentences on what this run learned) and recommended_next (what a
future run should try next) — these are stored in the run summary and read back by the next run during
orientation; the backend derives the rest of the summary (kept ladder, dead-ends) from your recorded
iterations. Pass headline (a run title of at most 60 characters), reader_summary (one or two plain
sentences) and next_steps (at most 5 short items) for people who read the run; keep column names, SQL and
AUC numbers out of them. If you built a report notebook for this run, pass its short_id as
report_notebook_short_id.
feature_flag: autoresearch
response:
include:
- id
- pipeline
- status
- iteration_count
- best_holdout_score
- summary
- error
- completed_at
autoresearch-training-runs-create:
operation: autoresearch_training_runs_create
enabled: true
scopes:
- autoresearch:write
annotations:
readOnly: false
destructive: false
idempotent: false
title: Open a training run
description: >
Open a new training run for a pipeline and return its id, for a bring-your-own agent that trains outside
PostHog. The agent then records iterations against this run with
autoresearch-training-runs-iterations-create and finalizes it with
autoresearch-training-runs-complete-create. The run starts in 'running'. Optionally override the
iteration_budget for this run. Refused from inside a sandbox: the in-house training agent works in the run
that autoresearch-train-create opened for it. A pipeline with an action target also needs the action:read
scope.
feature_flag: autoresearch
autoresearch-training-runs-history:
operation: autoresearch_training_runs_history_retrieve
enabled: true
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: Read prior training-run history
description: >
Cross-run learning memory. Returns recent completed training runs — this pipeline first, then same-target
sibling pipelines on the team. Each run has a distilled `summary` (read this first: distillation,
recommended_next, the kept_ladder of winning approaches, and dead_ends to avoid) plus the full `iterations`
trail (every recipe tried, its agent_description rationale, holdout_score, kept/discarded status,
model_spec) to drill into when a summary points somewhere worth it. Call this before iterating to reuse the
features and transforms that won and avoid repeating approaches already discarded. Optional `limit` (default
5, max 20) caps how many prior runs are returned.
feature_flag: autoresearch
autoresearch-training-runs-iterations-create:
operation: autoresearch_training_runs_iterations_create
enabled: true
scopes:
- autoresearch:write
annotations:
readOnly: false
destructive: false
idempotent: true
title: Record a training iteration
description: >
Record one iteration of an open training run. Idempotent on iteration_number — re-sending the same number
updates that iteration in place. The recipe is validated server-side: feature_sql in recipe_snapshot must be
a read-only SELECT that outputs the anchor key exactly once as a.person_id AS distinct_id, and every events
join must be bounded by e.timestamp < fromUnixTimestamp(a.cutoff_ts) and exclude NOT startsWith(e.event,
'autoresearch_'), the model's own prediction events. The validator cannot prove either rule, and without
them the features see the outcome window or the model's own past scores, and the holdout AUC is leaked.
model_class in model_spec is informational when you upload your own train.py and predict.py bundle; it must
be in the sklearn/xgboost allowlist only when the run completes without a bundle. Use status='kept' if the
iteration beats the best AUC so far in this run (the first scored iteration is always kept, whatever the
current champion scores), 'discarded' otherwise, 'crashed' on failure. Iterations are picked up at
completion time to choose the champion. If this iteration was spawned from a pending steering suggestion,
pass parent_suggestion = the suggestion's ID — that links the iteration to the suggestion for attribution
and marks the suggestion 'acted_on'. Pass summary, one plain sentence for people on what the experiment
tried and what happened, and headline, a title of at most 60 characters in the same plain words;
agent_description stays your own notes.
feature_flag: autoresearch
response:
include:
- id
- training_run
- iteration_number
- recipe_hash
- train_score
- holdout_score
- status
- parent_suggestion
autoresearch-training-runs-list:
operation: autoresearch_training_runs_list
enabled: true
scopes:
- autoresearch:read
annotations:
readOnly: true
destructive: false
idempotent: true
list: true
title: List training runs
description: >
List training runs for a pipeline, ordered most recent first. Check status (completed/failed),
iteration_count, and best_holdout_score to understand training history.
feature_flag: autoresearch
response:
include:
- id
- pipeline
- status
- kickoff_reason
- agent_model
- agent_reasoning_effort
- iteration_budget
- iteration_count
- best_holdout_score
- error
- started_at
- completed_at
- created_at
autoresearch-validate-create:
operation: autoresearch_validate_create
enabled: true
scopes:
- autoresearch:read
- query:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: Validate a pipeline definition
description: >
Validate a proposed autoresearch pipeline before creating it. The target is either an event (pass
target_event) or a PostHog action (pass target_definition = {"type": "action", "action_id": N}); base-rate
and volume estimates are computed against whichever you provide. Returns volume estimates, base rate,
positive and negative example counts, and a list of warnings. Check 'can_proceed' before calling
autoresearch-create: if false, resolve errors first. 'requires_acknowledgement' means there are non-blocking
warnings worth noting. Errors (can_proceed is false): low_volume (fewer than 100 users), low_positives or
low_negatives (fewer than 20 examples), horizon_exceeds_lookback (raise training_lookback_days above
horizon_days), and population_too_large with severity error (narrow the training population). Non-blocking
warnings include extreme_imbalance (base rate below 1%) and near_universal (above 95%). population_too_large
with severity info means the inference population is above the cap, so each scoring run scores users never
scored first, then those scored longest ago. The warning message gives how many scoring runs it takes to
rescore everyone (ceil(eligible / 45000)), which in days is that many times the pipeline's cadence_days. An
action target needs the action:read scope. Always validate before creating.
feature_flag: autoresearch
autoresearch-validate-online-create:
operation: autoresearch_validate_online_create
enabled: false
disabled_reason: The daily validation workflow runs it; autoresearch-online-performance-retrieve reads results
scopes:
- autoresearch:write
- query:read
annotations:
readOnly: false
destructive: false
idempotent: false
title: Run online validation
description: >
Validate predictions against realized outcomes for all matured prediction dates. A prediction date is
matured when today >= prediction_date + horizon_days — meaning the outcome window has closed and
ground-truth labels can be fetched. Computes per-model realized AUC, Brier score, expected calibration error
(ECE), and lift@10/20. Updates the model's realized_score and calibration_error in Postgres, and clears the
is_preliminary flag after the first successful validation cycle. Already-validated dates are skipped
automatically. Returns one run object per prediction date processed; an empty list means no dates have
matured yet. In production this is triggered by the daily Temporal validation workflow after inference runs.
Call autoresearch-models-list after this to see updated realized_score values on champion/challenger models.
feature_flag: autoresearch