ax experiment
Create, run, and analyze experiments.
| Command | Use |
|---|---|
experiment create | Scaffold a new experiment YAML. |
experiment validate | Check a YAML against the schema. |
experiment run | Run on the platform, or locally with --local. |
experiment query | Summarize results with filters and grouping, or raw SQL. |
experiment list | List experiments in the active org. |
experiment view | Inspect one registered experiment. |
experiment push | Register a YAML without running it. |
experiment pull | Download registered YAML. |
experiment versions | List stored versions. |
experiment variants | Resolve the variant matrix without running. |
experiment schema | Print the schema document. |
Platform-backed commands also accept --org <org-id> (target another org for
one command) and --json (machine-readable output); they are not repeated in
the tables below. Arguments marked required must be supplied; everything
else is optional, and flags combine freely unless a row says otherwise.
experiment create
Scaffold a new experiment YAML.
ax experiment create <NAME>| Argument / flag | What it does |
|---|---|
<NAME> | Required. Experiment name; writes <NAME>.yaml. |
--dir <dir> | Directory to write into (default .). |
--schema-version <n> | Schema version to scaffold (default: latest). |
--template cli-install | Scaffold the CLI-install starter experiment. |
--cli <name> | Target CLI or product name. Required with the template. |
--target-description <text> | What the target is, for the shared install task. Required with the template. |
--install-docs <url> | Install docs URL for the documented variant. Required with the template. |
--install-command <cmd> | Exact install command for the explicit variant. Required with the template. |
--smoke-command <cmd> | Hidden smoke command the harness reruns after the agent finishes. Required with the template. |
--smoke-output-contains <text> | Text the smoke command's output must contain (template only). |
--force | Overwrite an existing <NAME>.yaml (template only). |
Examples:
# Blank scaffold
ax experiment create my-experiment
# Starter experiment: can agents install your CLI?
ax experiment create my-first-experiment --template cli-install \
--cli mycli_name \
--target-description 'a CLI for managing OLAP databases' \
--install-docs https://example.com/install \
--install-command 'npm install mycli_name' \
--smoke-command 'mycli_name --version' \
--smoke-output-contains 'mycli_name version'experiment validate
Check an experiment YAML against the schema; exits non-zero on schema errors.
ax experiment validate <EXPERIMENT.yaml>| Argument / flag | What it does |
|---|---|
<EXPERIMENT.yaml> | Required. Path to the experiment file. |
--no-ai | Skip the AI review; run only the static schema checks. |
When signed in, validation also prints an advisory AI review of the
experiment design to stderr. It never changes the exit code, so a suggestion is
not a failure. Skip it with --no-ai or AX_NO_AI_LINT=1; pick a different
review model with AX_AI_LINT_MODEL.
experiment run
Run an experiment: submit to the platform (default) or run locally in Docker
with --local.
ax experiment run <EXPERIMENT.yaml | EXPERIMENT_ID>| Argument / flag | What it does |
|---|---|
<EXPERIMENT.yaml | EXPERIMENT_ID> | Required. A local YAML path, or a registered experiment id for platform runs. |
--repeat <n>, -n | Run each variant N times (default 1). |
--detach | Submit and exit instead of polling. Platform runs only (not with --local). |
--version <fingerprint> | Run a specific registered version. Only with an experiment-id target; not with --local. |
--flag <name> | Enable a named run-request flag (repeatable). |
--file <spec>, --file-sha256 <spec> | Bind or add staged files. Only with a YAML path target. |
--mock | Deterministic mock driver; no model spend. |
Target a subset of variants with selectors, all repeatable or comma-separated:
--variant, --prompt, --agent, --model, --product, --environment.
Same flag ORs; different flags AND (--agent cursor --model X runs only
variants using agent cursor and model X). Exact --variant ids are
additive on top. Each selected variant is included once.
Local-only flags:
| Argument / flag | What it does |
|---|---|
--local | Run in Docker on this machine instead of the platform. |
--watch / --watch-raw | Live-tail agent events (pretty / raw JSONL). |
--jobs <n>, -j | Concurrency across the local matrix (default 1). |
--resolve-variants | Print the resolved matrix and exit. |
--env <NAME[=VALUE]> / --env-file <path> | Extra local secret sources (repeatable). |
--output-root <dir> | Where to put .axp/runs/<id>/ (default .). |
--local-model-keys | Use host provider keys instead of managed model access (default local runs are managed; sign-in / AX_API_KEY required). |
--api-base-url <url> | Platform URL for managed model access (default local or remote). |
Examples:
# Platform run, polling until done
ax experiment run my-experiment.yaml
# Local run with live agent events
ax experiment run my-experiment.yaml --local --watch
# Two prompts only, three repeats each
ax experiment run my-experiment.yaml --prompt baseline,explicit --repeat 3
# A specific registered version
ax experiment run my-experiment --version <fingerprint>experiment query
Query an experiment's results with SQL scoped to the experiment, and save queries as insights.
ax experiment query <EXPERIMENT_ID>| Argument / flag | What it does |
|---|---|
<EXPERIMENT_ID> | Required. Experiment id, as shown on the platform Results page. |
--sql <SQL|@file|-> | ClickHouse SQL in experiment scope. |
--experiment-version <v> | latest (default) or a version fingerprint. |
--limit <n> | Max rows (default 100). |
--dry-run | Validate and print the compiled SQL without executing. |
--save <heading> | Save the query as an insight. --slug, --description, --label, and --force only apply together with it. |
Experimental flag-based modeled queries (metrics with filters and grouping, no SQL) also work; the surface may change:
| Flag (experimental) | What it does |
|---|---|
--metric <name> | Metrics per group (repeatable): testPassRate, testsPassed, testsFailed, cost, wallClockTime, tokens, toolCalls, toolFailures. Default: testPassRate, cost, wallClockTime, tokens, toolFailures. |
--group-by <dimension> | Group by variant, agent, model, product, environment, prompt, or test. List the observed values of each with --dimensions. |
--stat <stat> | Aggregate statistic per group. Only mean is supported today (the default). |
--filter <dimension=value> | Filter on agent, product, environment, or prompt, e.g. --filter agent=claude or --filter prompt=baseline. |
--agent / --product / --environment / --prompt | Shorthand dimension filters (repeatable). |
--dimensions [<dimension>] | Discover dimension values and metric names. |
For SQL scoped to one composite run id, use run query.
Examples:
# Ad-hoc SQL in experiment scope
ax experiment query my-experiment --sql @query.sql
# Save the query as an insight
ax experiment query my-experiment --sql @query.sql --save "Failing tests"
# Experimental: pass rate by variant, no SQL
ax experiment query my-experiment --metric testPassRate --group-by variant
# Experimental: cost and tokens per prompt, claude runs only
ax experiment query my-experiment --metric cost,tokens --group-by prompt \
--filter agent=claude
# Experimental: which test fails most?
ax experiment query my-experiment --metric testPassRate --group-by test
# Experimental: what dimensions and metrics exist?
ax experiment query my-experiment --dimensionsexperiment list
List experiments in the active org, most recently updated first.
ax experiment list| Argument / flag | What it does |
|---|---|
--search <text> | Case-insensitive match on experiment name or id. |
--owner <email-or-id> | Only experiments created by this owner. |
--agent / --model / --product / --environment | Dimension filters (repeatable). Same flag ORs; different dimensions AND. |
--since <when> | Updated at or after this time (RFC 3339 or YYYY-MM-DD). |
--limit <n> | Max experiments (default 50, platform cap 500). |
experiment view
Show a metadata summary of one registered experiment: ownership, timestamps, run tally, resolved axes, and latest version.
ax experiment view <EXPERIMENT_ID>| Argument / flag | What it does |
|---|---|
<EXPERIMENT_ID> | Required. Experiment id (the YAML's id field). |
experiment push
Register an experiment on the platform without running it. Pushing unchanged YAML is idempotent; each push stores a content-addressed version.
ax experiment push <EXPERIMENT.yaml>experiment pull
Download a registered experiment's YAML (latest version by default).
ax experiment pull <EXPERIMENT_ID>| Argument / flag | What it does |
|---|---|
<EXPERIMENT_ID> | Required. Experiment id (the YAML's id field). |
--output <path>, -o | Write here (default <experiment-id>.yaml). |
--version <fingerprint> | Pull a specific stored version instead of the latest. |
--force | Overwrite the destination file if it exists. |
experiment versions
List stored versions of a registered experiment, newest push first.
ax experiment versions <EXPERIMENT_ID>The VERSION column is the friendly first-created ordinal (v1, v2, ...);
re-pushing an older definition can move it to the top without changing its
ordinal.
experiment variants
Preview what a YAML resolves to before running it: how many variants the cross
product yields, which incompatible agent and model pairs were pruned, and the
exact variant ids to use with ax experiment run --variant.
ax experiment variants <EXPERIMENT.yaml>| Argument / flag | What it does |
|---|---|
<EXPERIMENT.yaml> | Required. Path to the experiment file. |
--json | Emit the resolve-response JSON the platform client parses. |
--runtime | Tolerant re-resolution of an already-submitted run (accepts the legacy nested agents[].model shape). |
experiment schema
Print the experiment schema document.
ax experiment schema [--schema-version <n>]