Open in
Split Testing
A/B test agent variants on live traffic and compare per-variant outcomes.
Split testing routes an agent's live calls across variants —
weighted configurations that override specific fields (prompt, voice,
product, …) while inheriting everything else from the agent's deployed
config. Each call records which variant served it
(agent_variant_id / agent_variant_label on the
Call object), and the stats
endpoint compares outcomes per variant.
The control variant (is_control: true) represents the agent's
deployed config unchanged. Enabling split testing auto-creates a
control if none exists.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /v1/agents/{agent_id}/variants | List variants |
POST | /v1/agents/{agent_id}/variants | Create a variant |
PATCH | /v1/agents/{agent_id}/variants/{variant_id} | Update a variant |
DELETE | /v1/agents/{agent_id}/variants/{variant_id} | Delete a variant |
POST | /v1/agents/{agent_id}/split-testing | Enable / disable split testing (staged as a draft) |
GET | /v1/agents/{agent_id}/variant-stats | Per-variant call stats |
Variant object
{
"id": 41,
"label": "Warmer greeting",
"weight": 50,
"is_control": false,
"prompt": "You are a warm, upbeat support agent…",
"voice": null,
"product": null,
"background_track": null,
"thinking_level": null,
"acknowledgement_prompt_mode": null,
"acknowledgement_prompt": null,
"inbound_speak_order": null,
"outbound_speak_order": null,
"silence_interval_seconds": null,
"silence_max_checkins": null,
"created_at": "2026-04-20T18:24:10.113Z",
"updated_at": "2026-04-20T18:24:10.113Z"
}| Field | Type | Description |
|---|---|---|
id | integer | Variant id |
label | string | ≤ 100 chars |
weight | integer | 0–100, default 50. Traffic is distributed proportionally to weights |
is_control | boolean | At most one control per agent |
prompt, voice, product, background_track, thinking_level, acknowledgement_prompt_mode, acknowledgement_prompt, inbound_speak_order, outbound_speak_order, silence_interval_seconds, silence_max_checkins | field type | null | Overrides. null = inherit the agent's deployed value; set a value to change just that field for this variant |
POST requires label (everything else optional) and returns 201.
PATCH accepts any subset; DELETE returns 204.
Enable / disable split testing
curl -X POST https://api.thunderphone.com/v1/agents/12/split-testing \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"enabled": true}'| Field | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true |
{
"split_testing_enabled": false,
"draft_split_testing_enabled": true
}The toggle is staged as a draft on the agent — live traffic starts
(or stops) splitting only after you
deploy. Enabling with no
control variant auto-creates one (label: "Control", weight: 100).
Variant stats
curl https://api.thunderphone.com/v1/agents/12/variant-stats \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"[
{
"variant_id": 40,
"label": "Control",
"is_control": true,
"calls": 132,
"success_rate": 84.1,
"avg_duration_seconds": 163
},
{
"variant_id": 41,
"label": "Warmer greeting",
"is_control": false,
"calls": 129,
"success_rate": 88.4,
"avg_duration_seconds": 171
}
]| Field | Type | Description |
|---|---|---|
calls | integer | Total calls served by the variant |
success_rate | number | null | % of graded, completed calls with call_outcome="success" (ungraded calls excluded); null when nothing graded yet |
avg_duration_seconds | integer | null | Mean duration of completed calls |
Experiments
An experiment is a weighted split over some of an agent's variants and
the control (the agent with no changes), run on the phone numbers you
point at it. While it runs, each call to such a number takes one arm by
weight, on top of the version the number runs (Latest or its pinned
version). Once it ends, those numbers answer as if they had no experiment.
Start an experiment first, then point numbers at it with inbound_experiment_id on
PATCH /v1/phone-numbers/{id}:
a draft or ended experiment is refused there. A number pinned to a version can
run an experiment only when that version includes every variant arm, so each
arm runs as that version recorded it, as the control does. Publishing records
the agent's variants as they are, so publish after making the variants, then
pin the number to that version.
Experiments don't use the agent-wide split-testing switch above.
| Method | Path | Description |
|---|---|---|
GET | /v1/agents/{agent_id}/experiments | List experiments, newest first |
POST | /v1/agents/{agent_id}/experiments | Create a draft experiment |
GET | /v1/agents/{agent_id}/experiments/{experiment_id} | Get an experiment |
PATCH | /v1/agents/{agent_id}/experiments/{experiment_id} | Edit a draft: label, call_limit, arms |
POST | /v1/agents/{agent_id}/experiments/{experiment_id}/start | Start a draft (admins) |
POST | /v1/agents/{agent_id}/experiments/{experiment_id}/stop | End it (admins) |
POST | /v1/agents/{agent_id}/experiments/{experiment_id}/winner | Pick the winning arm (admins) |
GET | /v1/agents/{agent_id}/experiments/{experiment_id}/results | Per-arm call stats |
curl -X POST https://api.thunderphone.com/v1/agents/12/experiments \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"label": "Opening test", "arms": [{"variant_id": null, "weight": 34}, {"variant_id": 41, "weight": 33}, {"variant_id": 42, "weight": 33}]}'{
"id": 7,
"agent_id": 12,
"label": "Opening test",
"status": "draft",
"arms": [
{"id": 20, "variant_id": null, "label": "Control", "is_control": true, "weight": 34},
{"id": 21, "variant_id": 41, "label": "Warmer greeting", "is_control": false, "weight": 33},
{"id": 22, "variant_id": 42, "label": "Shorter questions", "is_control": false, "weight": 33}
],
"call_limit": null,
"calls_seen": 0,
"started_at": null,
"ended_at": null,
"ended_reason": null,
"winner_arm_id": null,
"number_ids": [],
"created_at": "2026-11-10T18:24:10.113Z",
"updated_at": "2026-11-10T18:24:10.113Z"
}| Field | Type | Description |
|---|---|---|
label | string | ≤ 100 chars. Required on create |
arms | array | Required on create. Each arm is variant_id (a variant of this agent, or null for the control) and weight (0–100). Exactly one control arm and at least one variant; each variant once; weights must add up to more than 0. A trial, the agent's own control variant, or a variant that sets a language can't be an arm: a caller's language is not random, so point a number at a language variant instead. On PATCH, arms replaces the whole set |
call_limit | integer | null | Optional. The experiment ends by itself after this many calls went through it |
status | string | draft, running or ended. Read-only |
calls_seen | integer | Calls routed through the experiment so far. Read-only |
ended_reason | string | null | stopped, call_limit or winner. Read-only |
winner_arm_id | integer | null | The arm picked as the winner. Read-only |
number_ids | integer[] | The phone numbers pointed at it. Read-only |
Only a draft can be edited: PATCH on a running or ended experiment returns
409 with code: "experiment_not_draft". start moves a draft to
running and checks the arms again (400 if a variant was deleted or given a
language since, or a number already pointed at it is pinned to a version that
doesn't include an arm). When an arm costs more a minute than the agent, start
returns 409 with code: "price_change_needs_confirmation" and the price before
and after; send {"confirm_price_change": true} to start at that price. Starting
anything else, or stopping one that has already ended, returns 409.
While an experiment runs, its arms are live: a variant that is one of its arms
can't be deleted (409, code: "variant_in_running_experiment"; stop the
experiment first), and an edit that makes one cost more a minute asks for
confirm_price_change as a variant on a number does. Numbers on Latest run
an arm as it is now; numbers pinned to a version run it as that version
recorded it.
Pick a winner
curl -X POST https://api.thunderphone.com/v1/agents/12/experiments/7/winner \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"arm_id": 21}'{
"experiment": {"id": 7, "status": "ended", "ended_reason": "winner", "winner_arm_id": 21, "...": "..."},
"winner": {
"arm_id": 21,
"variant_id": 41,
"label": "Warmer greeting",
"is_control": false,
"changes": {"prompt": "You are a warm, upbeat support agent…"}
}
}Picking a winner ends a running experiment (an ended one keeps its end) and
returns what the winning arm changes about the agent: the variant's fields
that are set. It publishes nothing and moves no number. To keep the change,
put it in the agent's draft and deploy;
to take numbers off the experiment, PATCH each number. A draft returns 409
(experiment_not_started), and so does a second pick (winner_already_picked).
Experiment results
curl https://api.thunderphone.com/v1/agents/12/experiments/7/results \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"[
{"arm_id": 20, "variant_id": null, "label": "Control", "is_control": true, "weight": 34, "calls": 58, "success_rate": 81.0, "avg_duration_seconds": 160},
{"arm_id": 21, "variant_id": 41, "label": "Warmer greeting", "is_control": false, "weight": 33, "calls": 55, "success_rate": 87.5, "avg_duration_seconds": 168}
]Each call records the arm it took, so results count only calls this
experiment routed, even when the same variant also serves another number.
Test calls and simulations are left out. Test calls from the agent editor
also don't count toward call_limit. success_rate and
avg_duration_seconds are computed as in variant stats.