Arize Experiment Skill
SPACE — All --space flags and the ARIZE_SPACE env var accept a space name (e.g., my-workspace) or a base64 space ID (e.g., U3BhY2U6...). Find yours with ax spaces list.
Concepts
- Experiment = a named evaluation run against a specific dataset version, containing one run per example
- Experiment Run = the result of processing one dataset example -- includes the model output, optional evaluations, and optional metadata
- Dataset = a versioned collection of examples; every experiment is tied to a dataset and a specific dataset version
- Evaluation = a named metric attached to a run (e.g.,
correctness, relevance), with optional label, score, and explanation
The typical flow: export a dataset → process each example → collect outputs and evaluations → create an experiment with the runs.
Prerequisites
Proceed directly with the task — run the ax command you need. Do NOT check versions, env vars, or profiles upfront.
If an ax command fails, troubleshoot based on the error:
command not found or version error → see references/ax-setup.md
401 Unauthorized / missing API key → run ax profiles show to inspect the current profile. If the profile is missing or the API key is wrong, follow references/ax-profiles.md to create/update it. If the user doesn't have their key, direct them to https://app.arize.com/admin > API Keys
- Space unknown → run
ax spaces list to pick by name, or ask the user
- Project unclear → ask the user, or run
ax projects list -o json --limit 100 and present as selectable options
- Security: Never read
.env files or search the filesystem for credentials. Use ax profiles for Arize credentials and ax ai-integrations for LLM provider keys. Never ask the user to paste secrets into chat. For missing credentials, see references/ax-profiles.md.
- CRITICAL — Never fabricate outputs: When running an experiment, you MUST call the real model API specified by the user for every dataset example. Never fabricate, simulate, or hardcode model outputs, latencies, or evaluation scores. If you cannot call the API (missing SDK, missing credentials, network error), stop and tell the user what is needed before proceeding.
List Experiments: ax experiments list
Browse experiments, optionally filtered by dataset. Output goes to stdout.
ax experiments list
ax experiments list --dataset DATASET_NAME --space SPACE --limit 20 # DATASET_NAME: name or ID (name preferred)
ax experiments list --cursor CURSOR_TOKEN
ax experiments list -o json
Flags
| Flag |
Type |
Default |
Description |
--dataset |
string |
none |
Filter by dataset |
--name, -n |
string |
none |
Substring filter on experiment name |
--limit, -l |
int |
15 |
Max results (1-100) |
--cursor |
string |
none |
Pagination cursor from previous response |
-o, --output |
string |
table |
Output format: table, json, csv, parquet, or file path |
Get Experiment: ax experiments get
Quick metadata lookup -- returns experiment name, linked dataset/version, and timestamps.
ax experiments get NAME_OR_ID
ax experiments get NAME_OR_ID -o json
ax experiments get NAME_OR_ID --dataset DATASET_NAME --space SPACE # required when using experiment name instead of ID
Flags
| Flag |
Type |
Default |
Description |
NAME_OR_ID |
string |
required |
Experiment name or ID (positional) |
--dataset |
string |
none |
Dataset name or ID (required if using experiment name instead of ID) |
--space |
string |
none |
Space name or ID (required if using dataset name instead of ID) |
-o, --output |
string |
table |
Output format |
Response fields
| Field |
Type |
Description |
id |
string |
Experiment ID |
name |
string |
Experiment name |
dataset_id |
string |
Linked dataset ID |
dataset_version_id |
string |
Specific dataset version used |
experiment_traces_project_id |
string |
Project where experiment traces are stored |
created_at |
datetime |
When the experiment was created |
updated_at |
datetime |
Last modification time |
Export Experiment: ax experiments export
Download all runs to a file. By default uses the REST API; pass --all to use Arrow Flight for bulk transfer.
# EXPERIMENT_NAME, DATASET_NAME: name or ID (name preferred)
ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE
# -> experiment_abc123_20260305_141500/runs.json
ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --all
ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --output-dir ./results
ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout
ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout | jq '.[0]'
Flags
| Flag |
Type |
Default |
Description |
NAME_OR_ID |
string |
required |
Experiment name or ID (positional) |
--dataset |
string |
none |
Dataset name or ID (required if using experiment name instead of ID) |
--space |
string |
none |
Space name or ID (required if using dataset name instead of ID) |
--all |
bool |
false |
Use Arrow Flight for bulk export (see below) |
--output-dir |
string |
. |
Output directory |
--stdout |
bool |
false |
Print JSON to stdout instead of file |
REST vs Flight (--all)
- REST (default): Lower friction -- no Arrow/Flight dependency, standard HTTPS ports, works through any corporate proxy or firewall. Limited to 500 runs per page.
- Flight (
--all): Required for experiments with more than 500 runs. Uses gRPC+TLS on a separate host/port (flight.arize.com:443) which some corporate networks may block.
Agent auto-escalation rule: If a REST export returns exactly 500 runs, the result is likely truncated. Re-run with --all to get the full dataset.
Output is a JSON array of run objects:
[
{
"id": "run_001",
"example_id": "ex_001",
"output": "The answer is 4.",
"evaluations": {
"correctness": { "label": "correct", "score": 1.0 },
"relevance": { "score": 0.95, "explanation": "Directly answers the question" }
},
"metadata": { "model": "gpt-4o", "latency_ms": 1234 }
}
]
Create Experiment: ax experiments create
Create a new experiment with runs from a data file.
ax experiments create --name "gpt-4o-baseline" --dataset DATASET_NAME --space SPACE --file runs.json
ax experiments create --name "claude-test" --dataset DATASET_NAME --space SPACE --file runs.csv
Flags
| Flag |
Type |
Required |
Description |
--name, -n |
string |
yes |
Experiment name |
--dataset |
string |
yes |
Dataset to run the experiment against |
--space, -s |
string |
no |
Space name or ID (required if using dataset name instead of ID) |
--file, -f |
path |
yes |
Data file with runs: CSV, JSON, JSONL, or Parquet |
-o, --output |
string |
no |
Output format |
Passing data via stdin
Use --file - to pipe data directly — no temp file needed:
echo '[{"example_id": "ex_001", "output": "Paris"}]' | ax experiments create --name "my-experiment" --dataset DATASET_NAME --space SPACE --file -
# Or with a heredoc
ax experiments create --name "my-experiment" --dataset DATASET_NAME --space SPACE --file - << 'EOF'
[{"example_id": "ex_001", "output": "Paris"}]
EOF
Required columns in the runs file
| Column |
Type |
Required |
Description |
example_id |
string |
yes |
The dataset example's top-level id from ax datasets export |
output |
string |
yes |
The model/system output for this example |
Additional columns are passed through as additionalProperties on the run.
example_id must be the Arize row id — the top-level id field on each exported dataset example (ex["id"]). Do not use a value nested inside the example's input fields or additional_properties; a wrong value fails silently or attaches the run to the wrong example. Export the dataset and inspect the top-level id field before creating runs.
⚠️ Inline evaluations in the create file do NOT attach as scores. create only reads example_id and output; every other column — including an evaluations object — is stored as a passthrough additional field, not as an experiment evaluation, and will not appear as a score in the UI. This fails silently (no error). To attach scores/labels, create the experiment first, then run ax experiments annotate-runs. The evaluations object in the schemas below is the export (read) shape returned once annotations exist — it is not an input to create.
Delete Experiment: ax experiments delete
ax experiments delete NAME_OR_ID
ax experiments delete NAME_OR_ID --dataset DATASET_NAME --space SPACE # required when using experiment name instead of ID
ax experiments delete NAME_OR_ID --force # skip confirmation prompt
Flags
| Flag |
Type |
Default |
Description |
NAME_OR_ID |
string |
required |
Experiment name or ID (positional) |
--dataset |
string |
none |
Dataset name or ID (required if using experiment name instead of ID) |
--space |
string |
none |
Space name or ID (required if using dataset name instead of ID) |
--force, -f |
bool |
false |
Skip confirmation prompt |
Annotate Runs: ax experiments annotate-runs
This is the required step to attach evaluation scores/labels to an experiment and make them show up in the UI. Evaluations cannot be attached through create; see the warning under Create Experiment. You write them here, after the experiment exists. Upsert semantics — resubmitting the same annotation name for the same run overwrites the previous value. Up to 1000 runs per request; unmatched record IDs are silently ignored.
ax experiments annotate-runs NAME_OR_ID --file annotations.json --dataset DATASET_NAME --space SPACE
ax experiments annotate-runs NAME_OR_ID --file annotations.csv --dataset DATASET_NAME --space SPACE
Annotation file schema
A JSON array; each item annotates one run:
[
{
"record_id": "run_001",
"values": [
{ "name": "correctness", "label": "correct", "score": 1.0 },
{ "name": "relevance", "score": 0.95, "text": "Directly answers the question" }
]
}
]
| Field |
Type |
Required |
Description |
record_id |
string |
yes |
The experiment run ID (the run's id from ax experiments export) — not the example_id |
values |
array |
yes |
One or more annotation dicts, each with a name plus at least one of score, label, or text |
values[].name |
string |
yes |
Annotation/evaluation name (e.g., correctness) — becomes the score column in the UI |
values[].score |
number |
no |
Numeric score (e.g., 0.0–1.0) |
values[].label |
string |
no |
Categorical label (e.g., correct, incorrect) |
values[].text |
string |
no |
Freeform explanation |
record_id keys on the run id, which only exists after create. So the order is always: create → export (to read each run's id) → build annotations → annotate-runs.
Flags
| Flag |
Type |
Required |
Description |
NAME_OR_ID |
string |
yes |
Experiment name or ID (positional) |
--file, -f |
path |
yes |
Annotation file: JSON, JSONL, CSV, or Parquet (use - for stdin) |
--dataset |
string |
yes |
Dataset name or ID (required when using experiment name instead of ID) |
--space |
string |
no |
Space name or ID |
Experiment Run Schema
Each run corresponds to one dataset example. On create, only example_id and output are consumed — evaluations shown here is the shape export returns after you attach scores via annotate-runs; it is not an input to create.
{
"example_id": "required on create -- the dataset example's top-level id",
"output": "required on create -- the model/system output for this example",
"evaluations": {
"metric_name": {
"label": "optional string label (e.g., 'correct', 'incorrect')",
"score": "optional numeric score (e.g., 0.95)",
"explanation": "optional freeform text"
}
},
"metadata": {
"model": "gpt-4o",
"temperature": 0.7,
"latency_ms": 1234
}
}
Evaluation fields
| Field |
Type |
Required |
Description |
label |
string |
no |
Categorical classification (e.g., correct, incorrect, partial) |
score |
number |
no |
Numeric quality score (e.g., 0.0 - 1.0) |
explanation |
string |
no |
Freeform reasoning for the evaluation |
At least one of label, score, or explanation should be present per evaluation.
Workflows
Run an experiment against a dataset
Find or create a dataset:
ax datasets list --space SPACE
ax datasets export DATASET_NAME --space SPACE --stdout | jq 'length'
Export the dataset examples:
ax datasets export DATASET_NAME --space SPACE
Call the real model API for each example and collect outputs. Use ax datasets export --stdout to pipe examples directly into an inference script:
ax datasets export DATASET_NAME --space SPACE --stdout | python3 infer.py > runs.json
Write infer.py to read examples from stdin, call the target model, and write runs JSON to stdout. The script below is a template — first inspect the exported dataset JSON to find the correct input field name, then uncomment the provider block the user wants:
import json, sys, time
examples = json.load(sys.stdin)
runs = []
for ex in examples:
# Inspect the exported JSON to find the right field (e.g. "input", "question", "prompt")
user_input = ex.get("input") or ex.get("question") or ex.get("prompt") or str(ex)
start = time.time()
# === CALL THE REAL MODEL API HERE — never fabricate or simulate ===
# Uncomment and adapt the provider block the user requested:
#
# OpenAI (pip install openai — uses OPENAI_API_KEY env var):
# from openai import OpenAI
# resp = OpenAI().chat.completions.create(
# model="gpt-4o",
# messages=[{"role": "user", "content": user_input}]
# )
# output_text = resp.choices[0].message.content
#
# Anthropic (pip install anthropic — uses ANTHROPIC_API_KEY env var):
# import anthropic
# resp = anthropic.Anthropic().messages.create(
# model="claude-sonnet-4-6", max_tokens=1024,
# messages=[{"role": "user", "content": user_input}]
# )
# output_text = resp.content[0].text
#
# Google Gemini (pip install google-genai — uses GOOGLE_API_KEY env var):
# from google import genai
# resp = genai.Client().models.generate_content(
# model="gemini-2.5-pro", contents=user_input
# )
# output_text = resp.text
#
# Custom / OpenAI-compatible proxy (pip install openai — uses CUSTOM_BASE_URL + CUSTOM_API_KEY env vars):
# Use this for Azure OpenAI, NVIDIA NIM, local Ollama, or any OpenAI-compatible endpoint,
# including a test integration proxy. Matches the `custom` provider in `ax ai-integrations create`.
# import os
# from openai import OpenAI
# resp = OpenAI(
# base_url=os.environ["CUSTOM_BASE_URL"], # e.g. https://my-proxy.example.com/v1
# api_key=os.environ.get("CUSTOM_API_KEY", "none"),
# ).chat.completions.create(
# model=os.environ.get("CUSTOM_MODEL", "default"),
# messages=[{"role": "user", "content": user_input}]
# )
# output_text = resp.choices[0].message.content
latency_ms = round((time.time() - start) * 1000)
runs.append({
"example_id": ex["id"],
"output": output_text,
"metadata": {"model": "MODEL_NAME", "latency_ms": latency_ms}
})
print(f" {ex['id']}: {latency_ms}ms", file=sys.stderr)
json.dump(runs, sys.stdout, indent=2)
Before running: install the provider SDK (pip install openai / anthropic / google-genai) and ensure the API key is set as an environment variable in your shell. If you cannot access the API, stop and tell the user what is needed.
Verify the runs file:
python3 -c "import json; runs=json.load(open('runs.json')); print(f'{len(runs)} runs'); print(json.dumps(runs[0], indent=2))"
Each run must have example_id (the dataset row's top-level id) and output. metadata is optional. Do not put evaluations here — create ignores them; scores are attached in steps 7–9 below.
Create the experiment:
ax experiments create --name "gpt-4o-baseline" --dataset DATASET_NAME --space SPACE --file runs.json
Verify: ax experiments get "gpt-4o-baseline" --dataset DATASET_NAME --space SPACE
Attach evaluation scores (required for scores to show in the UI). Evaluations do not come from the create file — you attach them with annotate-runs, which keys on each run's id (assigned at create time), so you must export first to learn those IDs.
Export the experiment to structured data so you can read each run's id alongside its example_id. Confirm that the exported run records include both fields.
Build the annotation file with structured JSON handling, keyed by record_id (the run id). Score/label each run via an LLM-as-judge, a code check, or human review; never fabricate scores. Emit this shape:
[
{
"record_id": "RUN_ID_FROM_EXPERIMENT_EXPORT",
"values": [
{ "name": "correctness", "score": 1.0, "label": "correct" }
]
}
]
Attach the scores with ax experiments annotate-runs ... --file annotations.json, then export or inspect the experiment to confirm the evaluations are attached.
The scores now render in the experiment view in the Arize UI.
Compare two experiments
- Export both experiments:
ax experiments export "experiment-a" --dataset DATASET_NAME --space SPACE --stdout > a.json
ax experiments export "experiment-b" --dataset DATASET_NAME --space SPACE --stdout > b.json
- Compare evaluation scores by
example_id:# Average correctness score for experiment A
jq '[.[] | .evaluations.correctness.score] | add / length' a.json
# Same for experiment B
jq '[.[] | .evaluations.correctness.score] | add / length' b.json
- Find examples where results differ:
jq -s '.[0] as $a | .[1][] | . as $run |
{
example_id: $run.example_id,
b_score: $run.evaluations.correctness.score,
a_score: ($a[] | select(.example_id == $run.example_id) | .evaluations.correctness.score)
}' a.json b.json
- Score distribution per evaluator (pass/fail/partial counts):
# Count by label for experiment A
jq '[.[] | .evaluations.correctness.label] | group_by(.) | map({label: .[0], count: length})' a.json
- Find regressions (examples that passed in A but fail in B):
jq -s '
[.[0][] | select(.evaluations.correctness.label == "correct")] as $passed_a |
[.[1][] | select(.evaluations.correctness.label != "correct") |
select(.example_id as $id | $passed_a | any(.example_id == $id))
]
' a.json b.json
Statistical significance note: Score comparisons are most reliable with ≥ 30 examples per evaluator. With fewer examples, treat the delta as directional only — a 5% difference on n=10 may be noise. Report sample size alongside scores: jq 'length' a.json.
Download experiment results for analysis
ax experiments list --dataset DATASET_NAME --space SPACE -- find experiments
ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE -- download to file
- Parse:
jq '.[] | {example_id, score: .evaluations.correctness.score}' experiment_*/runs.json
Pipe export to other tools
# Count runs
ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout | jq 'length'
# Extract all outputs
ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout | jq '.[].output'
# Get runs with low scores
ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout | jq '[.[] | select(.evaluations.correctness.score < 0.5)]'
# Convert to CSV
ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout | jq -r '.[] | [.example_id, .output, .evaluations.correctness.score] | @csv'
Related Skills
- arize-dataset: Create or export the dataset this experiment runs against → use
arize-dataset first
- arize-prompts: Store and version the prompt template in Prompt Hub (
ax prompts) before or after experiments
- arize-prompt-optimization: Use experiment results to improve prompts → next step is
arize-prompt-optimization
- arize-trace: Inspect individual span traces for failing experiment runs → use
arize-trace
- arize-link: Generate clickable UI links to traces from experiment runs → use
arize-link
Troubleshooting
| Problem |
Solution |
ax: command not found |
See references/ax-setup.md |
401 Unauthorized |
API key is wrong, expired, or doesn't have access to this space. Fix the profile using references/ax-profiles.md. |
No profile found |
No profile is configured. See references/ax-profiles.md to create one. |
Experiment not found |
Verify experiment name with ax experiments list --space SPACE |
Invalid runs file |
Each run must have example_id and output fields |
example_id mismatch |
example_id must be the dataset row's top-level id from ax datasets export — not a value nested in the example's fields or additional_properties. Export the dataset and inspect the top-level id field. |
| Runs created but no scores / evals in the UI |
Evaluations in the create file are silently ignored. Attach them with ax experiments annotate-runs (keyed by run id) after creating the experiment — see the workflow steps 7–9. |
annotate-runs reports success but nothing changes |
record_id must be the run id (from ax experiments export), not the example_id. Unmatched record IDs are silently ignored. |
No runs found |
Export returned empty -- verify experiment has runs via ax experiments get |
Dataset not found |
The linked dataset may have been deleted; check with ax datasets list |
Save Credentials for Future Use
See references/ax-profiles.md § Save Credentials for Future Use.
1---2name: arize-experiment3description: Creates, runs, and analyzes Arize experiments for evaluating and comparing model performance. Covers experiment CRUD, exporting runs, comparing results, and evaluation workflows using the ax CLI. Use when the user mentions create experiment, run experiment, compare models, model performance, evaluate AI, experiment results, benchmark, A/B test models, or measure accuracy.4---56# Arize Experiment Skill78> **`SPACE`** — All `--space` flags and the `ARIZE_SPACE` env var accept a space **name** (e.g., `my-workspace`) or a base64 space **ID** (e.g., `U3BhY2U6...`). Find yours with `ax spaces list`.910## Concepts1112- **Experiment** = a named evaluation run against a specific dataset version, containing one run per example13- **Experiment Run** = the result of processing one dataset example -- includes the model output, optional evaluations, and optional metadata14- **Dataset** = a versioned collection of examples; every experiment is tied to a dataset and a specific dataset version15- **Evaluation** = a named metric attached to a run (e.g., `correctness`, `relevance`), with optional label, score, and explanation1617The typical flow: export a dataset → process each example → collect outputs and evaluations → create an experiment with the runs.1819## Prerequisites2021Proceed directly with the task — run the `ax` command you need. Do NOT check versions, env vars, or profiles upfront.2223If an `ax` command fails, troubleshoot based on the error:24- `command not found` or version error → see [references/ax-setup.md](references/ax-setup.md)25- `401 Unauthorized` / missing API key → run `ax profiles show` to inspect the current profile. If the profile is missing or the API key is wrong, follow [references/ax-profiles.md](references/ax-profiles.md) to create/update it. If the user doesn't have their key, direct them to https://app.arize.com/admin > API Keys26- Space unknown → run `ax spaces list` to pick by name, or ask the user27- Project unclear → ask the user, or run `ax projects list -o json --limit 100` and present as selectable options28- **Security:** Never read `.env` files or search the filesystem for credentials. Use `ax profiles` for Arize credentials and `ax ai-integrations` for LLM provider keys. Never ask the user to paste secrets into chat. For missing credentials, see references/ax-profiles.md.29- **CRITICAL — Never fabricate outputs:** When running an experiment, you MUST call the real model API specified by the user for every dataset example. Never fabricate, simulate, or hardcode model outputs, latencies, or evaluation scores. If you cannot call the API (missing SDK, missing credentials, network error), stop and tell the user what is needed before proceeding.3031## List Experiments: `ax experiments list`3233Browse experiments, optionally filtered by dataset. Output goes to stdout.3435```bash36ax experiments list37ax experiments list --dataset DATASET_NAME --space SPACE --limit 20 # DATASET_NAME: name or ID (name preferred)38ax experiments list --cursor CURSOR_TOKEN39ax experiments list -o json40```4142### Flags4344| Flag | Type | Default | Description |45|------|------|---------|-------------|46| `--dataset` | string | none | Filter by dataset |47| `--name, -n` | string | none | Substring filter on experiment name |48| `--limit, -l` | int | 15 | Max results (1-100) |49| `--cursor` | string | none | Pagination cursor from previous response |50| `-o, --output` | string | table | Output format: table, json, csv, parquet, or file path |5152## Get Experiment: `ax experiments get`5354Quick metadata lookup -- returns experiment name, linked dataset/version, and timestamps.5556```bash57ax experiments get NAME_OR_ID58ax experiments get NAME_OR_ID -o json59ax experiments get NAME_OR_ID --dataset DATASET_NAME --space SPACE # required when using experiment name instead of ID60```6162### Flags6364| Flag | Type | Default | Description |65|------|------|---------|-------------|66| `NAME_OR_ID` | string | required | Experiment name or ID (positional) |67| `--dataset` | string | none | Dataset name or ID (required if using experiment name instead of ID) |68| `--space` | string | none | Space name or ID (required if using dataset name instead of ID) |69| `-o, --output` | string | table | Output format |7071### Response fields7273| Field | Type | Description |74|-------|------|-------------|75| `id` | string | Experiment ID |76| `name` | string | Experiment name |77| `dataset_id` | string | Linked dataset ID |78| `dataset_version_id` | string | Specific dataset version used |79| `experiment_traces_project_id` | string | Project where experiment traces are stored |80| `created_at` | datetime | When the experiment was created |81| `updated_at` | datetime | Last modification time |8283## Export Experiment: `ax experiments export`8485Download all runs to a file. By default uses the REST API; pass `--all` to use Arrow Flight for bulk transfer.8687```bash88# EXPERIMENT_NAME, DATASET_NAME: name or ID (name preferred)89ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE90# -> experiment_abc123_20260305_141500/runs.json9192ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --all93ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --output-dir ./results94ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout95ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout | jq '.[0]'96```9798### Flags99100| Flag | Type | Default | Description |101|------|------|---------|-------------|102| `NAME_OR_ID` | string | required | Experiment name or ID (positional) |103| `--dataset` | string | none | Dataset name or ID (required if using experiment name instead of ID) |104| `--space` | string | none | Space name or ID (required if using dataset name instead of ID) |105| `--all` | bool | false | Use Arrow Flight for bulk export (see below) |106| `--output-dir` | string | `.` | Output directory |107| `--stdout` | bool | false | Print JSON to stdout instead of file |108109### REST vs Flight (`--all`)110111- **REST** (default): Lower friction -- no Arrow/Flight dependency, standard HTTPS ports, works through any corporate proxy or firewall. Limited to 500 runs per page.112- **Flight** (`--all`): Required for experiments with more than 500 runs. Uses gRPC+TLS on a separate host/port (`flight.arize.com:443`) which some corporate networks may block.113114**Agent auto-escalation rule:** If a REST export returns exactly 500 runs, the result is likely truncated. Re-run with `--all` to get the full dataset.115116Output is a JSON array of run objects:117118```json119[120 {121 "id": "run_001",122 "example_id": "ex_001",123 "output": "The answer is 4.",124 "evaluations": {125 "correctness": { "label": "correct", "score": 1.0 },126 "relevance": { "score": 0.95, "explanation": "Directly answers the question" }127 },128 "metadata": { "model": "gpt-4o", "latency_ms": 1234 }129 }130]131```132133## Create Experiment: `ax experiments create`134135Create a new experiment with runs from a data file.136137```bash138ax experiments create --name "gpt-4o-baseline" --dataset DATASET_NAME --space SPACE --file runs.json139ax experiments create --name "claude-test" --dataset DATASET_NAME --space SPACE --file runs.csv140```141142### Flags143144| Flag | Type | Required | Description |145|------|------|----------|-------------|146| `--name, -n` | string | yes | Experiment name |147| `--dataset` | string | yes | Dataset to run the experiment against |148| `--space, -s` | string | no | Space name or ID (required if using dataset name instead of ID) |149| `--file, -f` | path | yes | Data file with runs: CSV, JSON, JSONL, or Parquet |150| `-o, --output` | string | no | Output format |151152### Passing data via stdin153154Use `--file -` to pipe data directly — no temp file needed:155156```bash157echo '[{"example_id": "ex_001", "output": "Paris"}]' | ax experiments create --name "my-experiment" --dataset DATASET_NAME --space SPACE --file -158159# Or with a heredoc160ax experiments create --name "my-experiment" --dataset DATASET_NAME --space SPACE --file - << 'EOF'161[{"example_id": "ex_001", "output": "Paris"}]162EOF163```164165### Required columns in the runs file166167| Column | Type | Required | Description |168|--------|------|----------|-------------|169| `example_id` | string | yes | The dataset example's **top-level `id`** from `ax datasets export` |170| `output` | string | yes | The model/system output for this example |171172Additional columns are passed through as `additionalProperties` on the run.173174> **`example_id` must be the Arize row id** — the top-level `id` field on each exported dataset example (`ex["id"]`). Do **not** use a value nested inside the example's input fields or `additional_properties`; a wrong value fails silently or attaches the run to the wrong example. Export the dataset and inspect the top-level `id` field before creating runs.175176> **⚠️ Inline evaluations in the create file do NOT attach as scores.** `create` only reads `example_id` and `output`; every other column — including an `evaluations` object — is stored as a passthrough additional field, **not** as an experiment evaluation, and will **not** appear as a score in the UI. This fails silently (no error). To attach scores/labels, create the experiment first, then run `ax experiments annotate-runs`. The `evaluations` object in the schemas below is the **export (read)** shape returned once annotations exist — it is not an input to `create`.177178## Delete Experiment: `ax experiments delete`179180```bash181ax experiments delete NAME_OR_ID182ax experiments delete NAME_OR_ID --dataset DATASET_NAME --space SPACE # required when using experiment name instead of ID183ax experiments delete NAME_OR_ID --force # skip confirmation prompt184```185186### Flags187188| Flag | Type | Default | Description |189|------|------|---------|-------------|190| `NAME_OR_ID` | string | required | Experiment name or ID (positional) |191| `--dataset` | string | none | Dataset name or ID (required if using experiment name instead of ID) |192| `--space` | string | none | Space name or ID (required if using dataset name instead of ID) |193| `--force, -f` | bool | false | Skip confirmation prompt |194195## Annotate Runs: `ax experiments annotate-runs`196197**This is the required step to attach evaluation scores/labels to an experiment and make them show up in the UI.** Evaluations cannot be attached through `create`; see the warning under Create Experiment. You write them here, after the experiment exists. Upsert semantics — resubmitting the same annotation `name` for the same run overwrites the previous value. Up to 1000 runs per request; unmatched record IDs are silently ignored.198199```bash200ax experiments annotate-runs NAME_OR_ID --file annotations.json --dataset DATASET_NAME --space SPACE201ax experiments annotate-runs NAME_OR_ID --file annotations.csv --dataset DATASET_NAME --space SPACE202```203204### Annotation file schema205206A JSON array; each item annotates one run:207208```json209[210 {211 "record_id": "run_001",212 "values": [213 { "name": "correctness", "label": "correct", "score": 1.0 },214 { "name": "relevance", "score": 0.95, "text": "Directly answers the question" }215 ]216 }217]218```219220| Field | Type | Required | Description |221|-------|------|----------|-------------|222| `record_id` | string | yes | The **experiment run ID** (the run's `id` from `ax experiments export`) — **not** the `example_id` |223| `values` | array | yes | One or more annotation dicts, each with a `name` plus at least one of `score`, `label`, or `text` |224| `values[].name` | string | yes | Annotation/evaluation name (e.g., `correctness`) — becomes the score column in the UI |225| `values[].score` | number | no | Numeric score (e.g., `0.0`–`1.0`) |226| `values[].label` | string | no | Categorical label (e.g., `correct`, `incorrect`) |227| `values[].text` | string | no | Freeform explanation |228229> `record_id` keys on the **run** id, which only exists after `create`. So the order is always: `create` → `export` (to read each run's `id`) → build annotations → `annotate-runs`.230231### Flags232233| Flag | Type | Required | Description |234|------|------|----------|-------------|235| `NAME_OR_ID` | string | yes | Experiment name or ID (positional) |236| `--file, -f` | path | yes | Annotation file: JSON, JSONL, CSV, or Parquet (use `-` for stdin) |237| `--dataset` | string | yes | Dataset name or ID (required when using experiment name instead of ID) |238| `--space` | string | no | Space name or ID |239240## Experiment Run Schema241242Each run corresponds to one dataset example. **On `create`, only `example_id` and `output` are consumed** — `evaluations` shown here is the shape `export` returns *after* you attach scores via `annotate-runs`; it is not an input to `create`.243244```json245{246 "example_id": "required on create -- the dataset example's top-level id",247 "output": "required on create -- the model/system output for this example",248 "evaluations": {249 "metric_name": {250 "label": "optional string label (e.g., 'correct', 'incorrect')",251 "score": "optional numeric score (e.g., 0.95)",252 "explanation": "optional freeform text"253 }254 },255 "metadata": {256 "model": "gpt-4o",257 "temperature": 0.7,258 "latency_ms": 1234259 }260}261```262263### Evaluation fields264265| Field | Type | Required | Description |266|-------|------|----------|-------------|267| `label` | string | no | Categorical classification (e.g., `correct`, `incorrect`, `partial`) |268| `score` | number | no | Numeric quality score (e.g., 0.0 - 1.0) |269| `explanation` | string | no | Freeform reasoning for the evaluation |270271At least one of `label`, `score`, or `explanation` should be present per evaluation.272273## Workflows274275### Run an experiment against a dataset2762771. Find or create a dataset:278 ```bash279 ax datasets list --space SPACE280 ax datasets export DATASET_NAME --space SPACE --stdout | jq 'length'281 ```2822. Export the dataset examples:283 ```bash284 ax datasets export DATASET_NAME --space SPACE285 ```2863. Call the real model API for each example and collect outputs. Use `ax datasets export --stdout` to pipe examples directly into an inference script:287288 ```bash289 ax datasets export DATASET_NAME --space SPACE --stdout | python3 infer.py > runs.json290 ```291292 Write `infer.py` to read examples from stdin, call the target model, and write runs JSON to stdout. The script below is a template — first inspect the exported dataset JSON to find the correct input field name, then uncomment the provider block the user wants:293294 ```python295 import json, sys, time296297 examples = json.load(sys.stdin)298 runs = []299300 for ex in examples:301 # Inspect the exported JSON to find the right field (e.g. "input", "question", "prompt")302 user_input = ex.get("input") or ex.get("question") or ex.get("prompt") or str(ex)303304 start = time.time()305306 # === CALL THE REAL MODEL API HERE — never fabricate or simulate ===307 # Uncomment and adapt the provider block the user requested:308 #309 # OpenAI (pip install openai — uses OPENAI_API_KEY env var):310 # from openai import OpenAI311 # resp = OpenAI().chat.completions.create(312 # model="gpt-4o",313 # messages=[{"role": "user", "content": user_input}]314 # )315 # output_text = resp.choices[0].message.content316 #317 # Anthropic (pip install anthropic — uses ANTHROPIC_API_KEY env var):318 # import anthropic319 # resp = anthropic.Anthropic().messages.create(320 # model="claude-sonnet-4-6", max_tokens=1024,321 # messages=[{"role": "user", "content": user_input}]322 # )323 # output_text = resp.content[0].text324 #325 # Google Gemini (pip install google-genai — uses GOOGLE_API_KEY env var):326 # from google import genai327 # resp = genai.Client().models.generate_content(328 # model="gemini-2.5-pro", contents=user_input329 # )330 # output_text = resp.text331 #332 # Custom / OpenAI-compatible proxy (pip install openai — uses CUSTOM_BASE_URL + CUSTOM_API_KEY env vars):333 # Use this for Azure OpenAI, NVIDIA NIM, local Ollama, or any OpenAI-compatible endpoint,334 # including a test integration proxy. Matches the `custom` provider in `ax ai-integrations create`.335 # import os336 # from openai import OpenAI337 # resp = OpenAI(338 # base_url=os.environ["CUSTOM_BASE_URL"], # e.g. https://my-proxy.example.com/v1339 # api_key=os.environ.get("CUSTOM_API_KEY", "none"),340 # ).chat.completions.create(341 # model=os.environ.get("CUSTOM_MODEL", "default"),342 # messages=[{"role": "user", "content": user_input}]343 # )344 # output_text = resp.choices[0].message.content345346 latency_ms = round((time.time() - start) * 1000)347 runs.append({348 "example_id": ex["id"],349 "output": output_text,350 "metadata": {"model": "MODEL_NAME", "latency_ms": latency_ms}351 })352 print(f" {ex['id']}: {latency_ms}ms", file=sys.stderr)353354 json.dump(runs, sys.stdout, indent=2)355 ```356357 **Before running:** install the provider SDK (`pip install openai` / `anthropic` / `google-genai`) and ensure the API key is set as an environment variable in your shell. If you cannot access the API, stop and tell the user what is needed.3583594. Verify the runs file:360 ```bash361 python3 -c "import json; runs=json.load(open('runs.json')); print(f'{len(runs)} runs'); print(json.dumps(runs[0], indent=2))"362 ```363 Each run must have `example_id` (the dataset row's top-level `id`) and `output`. `metadata` is optional. **Do not put `evaluations` here** — `create` ignores them; scores are attached in steps 7–9 below.3645. Create the experiment:365 ```bash366 ax experiments create --name "gpt-4o-baseline" --dataset DATASET_NAME --space SPACE --file runs.json367 ```3686. Verify: `ax experiments get "gpt-4o-baseline" --dataset DATASET_NAME --space SPACE`369370 **Attach evaluation scores (required for scores to show in the UI).** Evaluations do **not** come from the create file — you attach them with `annotate-runs`, which keys on each run's `id` (assigned at create time), so you must export first to learn those IDs.3713727. Export the experiment to structured data so you can read each run's `id` alongside its `example_id`. Confirm that the exported run records include both fields.3738. Build the annotation file with structured JSON handling, keyed by `record_id` (the run `id`). Score/label each run via an LLM-as-judge, a code check, or human review; never fabricate scores. Emit this shape:374 ```json375 [376 {377 "record_id": "RUN_ID_FROM_EXPERIMENT_EXPORT",378 "values": [379 { "name": "correctness", "score": 1.0, "label": "correct" }380 ]381 }382 ]383 ```3849. Attach the scores with `ax experiments annotate-runs ... --file annotations.json`, then export or inspect the experiment to confirm the evaluations are attached.385 The scores now render in the experiment view in the Arize UI.386387### Compare two experiments3883891. Export both experiments:390 ```bash391 ax experiments export "experiment-a" --dataset DATASET_NAME --space SPACE --stdout > a.json392 ax experiments export "experiment-b" --dataset DATASET_NAME --space SPACE --stdout > b.json393 ```3942. Compare evaluation scores by `example_id`:395 ```bash396 # Average correctness score for experiment A397 jq '[.[] | .evaluations.correctness.score] | add / length' a.json398399 # Same for experiment B400 jq '[.[] | .evaluations.correctness.score] | add / length' b.json401 ```4023. Find examples where results differ:403 ```bash404 jq -s '.[0] as $a | .[1][] | . as $run |405 {406 example_id: $run.example_id,407 b_score: $run.evaluations.correctness.score,408 a_score: ($a[] | select(.example_id == $run.example_id) | .evaluations.correctness.score)409 }' a.json b.json410 ```4114. Score distribution per evaluator (pass/fail/partial counts):412 ```bash413 # Count by label for experiment A414 jq '[.[] | .evaluations.correctness.label] | group_by(.) | map({label: .[0], count: length})' a.json415 ```4165. Find regressions (examples that passed in A but fail in B):417 ```bash418 jq -s '419 [.[0][] | select(.evaluations.correctness.label == "correct")] as $passed_a |420 [.[1][] | select(.evaluations.correctness.label != "correct") |421 select(.example_id as $id | $passed_a | any(.example_id == $id))422 ]423 ' a.json b.json424 ```425426**Statistical significance note:** Score comparisons are most reliable with ≥ 30 examples per evaluator. With fewer examples, treat the delta as directional only — a 5% difference on n=10 may be noise. Report sample size alongside scores: `jq 'length' a.json`.427428### Download experiment results for analysis4294301. `ax experiments list --dataset DATASET_NAME --space SPACE` -- find experiments4312. `ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE` -- download to file4323. Parse: `jq '.[] | {example_id, score: .evaluations.correctness.score}' experiment_*/runs.json`433434### Pipe export to other tools435436```bash437# Count runs438ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout | jq 'length'439440# Extract all outputs441ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout | jq '.[].output'442443# Get runs with low scores444ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout | jq '[.[] | select(.evaluations.correctness.score < 0.5)]'445446# Convert to CSV447ax experiments export EXPERIMENT_NAME --dataset DATASET_NAME --space SPACE --stdout | jq -r '.[] | [.example_id, .output, .evaluations.correctness.score] | @csv'448```449450## Related Skills451452- **arize-dataset**: Create or export the dataset this experiment runs against → use `arize-dataset` first453- **arize-prompts**: Store and version the prompt template in Prompt Hub (`ax prompts`) before or after experiments454- **arize-prompt-optimization**: Use experiment results to improve prompts → next step is `arize-prompt-optimization`455- **arize-trace**: Inspect individual span traces for failing experiment runs → use `arize-trace`456- **arize-link**: Generate clickable UI links to traces from experiment runs → use `arize-link`457458## Troubleshooting459460| Problem | Solution |461|---------|----------|462| `ax: command not found` | See [references/ax-setup.md](references/ax-setup.md) |463| `401 Unauthorized` | API key is wrong, expired, or doesn't have access to this space. Fix the profile using [references/ax-profiles.md](references/ax-profiles.md). |464| `No profile found` | No profile is configured. See [references/ax-profiles.md](references/ax-profiles.md) to create one. |465| `Experiment not found` | Verify experiment name with `ax experiments list --space SPACE` |466| `Invalid runs file` | Each run must have `example_id` and `output` fields |467| `example_id mismatch` | `example_id` must be the dataset row's **top-level `id`** from `ax datasets export` — not a value nested in the example's fields or `additional_properties`. Export the dataset and inspect the top-level `id` field. |468| Runs created but no scores / evals in the UI | Evaluations in the create file are silently ignored. Attach them with `ax experiments annotate-runs` (keyed by run `id`) after creating the experiment — see the workflow steps 7–9. |469| `annotate-runs` reports success but nothing changes | `record_id` must be the **run `id`** (from `ax experiments export`), not the `example_id`. Unmatched record IDs are silently ignored. |470| `No runs found` | Export returned empty -- verify experiment has runs via `ax experiments get` |471| `Dataset not found` | The linked dataset may have been deleted; check with `ax datasets list` |472473## Save Credentials for Future Use474475See [references/ax-profiles.md](references/ax-profiles.md) § Save Credentials for Future Use.