Experimentos A/B
Reparto de tráfico entre versiones publicadas de un asistente.
GET /v1/assistants/{assistant_id}/experiments
The experiments of an assistant, newest first
Solo para usuarios con sesión iniciada (sin API key) · Rol: viewer o superior
Signed-in users only (an API key cannot call it yet). Any signed-in member. 401 when the token is missing, expired or invalid; 404 when the assistant is not in the tenant; 503 when experiments are not available.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
assistant_id | path | string (uuid) | sí |
Respuestas
200Successful Response · ExperimentListNombre Tipo Requerido Descripción itemsExperimentResponse[]sí items[].assistant_idstring (uuid)sí items[].ended_atstring (date-time) | nullsí items[].idstring (uuid)sí items[].namestringsí items[].promoted_versioninteger | nullsí items[].started_atstring (date-time)sí items[].statusstringsí (running, stopped, promoted) items[].variantsVariantResponse[]sí items[].variants[].versionintegersí items[].variants[].weightintegersí items[].winner_versioninteger | nullsí 401Missing, expired or invalid token. · ErrorResponse403Role below the one in `x-min-role`, a suspended organization, or an API key without the operation's `x-api-key-scope` (any key, if the operation has none). · ErrorResponse404No such assistant or experiment. · ErrorResponse503Experiments are not available. · ErrorResponsedefaultDefault Response · ErrorResponse
POST /v1/assistants/{assistant_id}/experiments
Split the traffic of an assistant between published versions
Solo para usuarios con sesión iniciada (sin API key) · Rol: editor o superior
Signed-in users only (an API key cannot call it yet). An `editor` or above starts an A/B experiment: `variants` are 2 to 5 published versions of the assistant by `version` number, each with a `weight` (a whole number from 1 to 100); the weights add up to 100. From now on each campaign attempt and each Talk session of the assistant gets one of them by weight, instead of the latest published version. The pick is a hash of the experiment and the contact, so a contact keeps the same version for the whole experiment and retries do not switch it; a Talk session is picked by its own id. The first variant is the control of the comparison. The version each call got is recorded on it (`assistant_version`). Only versions published after experiments were introduced can be named; the one published when they were introduced is included. One experiment runs at a time per assistant. Audited as `experiment.start`. 401 when the token is missing, expired or invalid; 403 below `editor`; 404 when the assistant is not in the tenant; 409 when it already has a running experiment; 422 when the weights do not add up to 100, a version is repeated or not published, or the number of variants is wrong; 503 when experiments are not available.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
assistant_id | path | string (uuid) | sí |
Cuerpo de la solicitud
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
name | string | sí | |
variants | VariantInput[] | sí | |
variants[].version | integer | sí | |
variants[].weight | integer | sí |
Respuestas
201Successful Response · ExperimentResponseNombre Tipo Requerido Descripción assistant_idstring (uuid)sí ended_atstring (date-time) | nullsí idstring (uuid)sí namestringsí promoted_versioninteger | nullsí started_atstring (date-time)sí statusstringsí (running, stopped, promoted) variantsVariantResponse[]sí variants[].versionintegersí variants[].weightintegersí winner_versioninteger | nullsí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this needs. · ErrorResponse404No such assistant or experiment. · ErrorResponse409The experiment is in another state. · ErrorResponse503Experiments are not available. · ErrorResponsedefaultDefault Response · ErrorResponse
GET /v1/assistants/{assistant_id}/experiments/{experiment_id}
One experiment with its results
Solo para usuarios con sesión iniciada (sin API key) · Rol: viewer o superior
Signed-in users only (an API key cannot call it yet). Any signed-in member. Per version, over the calls made while the experiment ran (real calls and the completed attempts of simulated campaigns; Talk test sessions are left out): `calls`, `answered`, `answer_rate`, `avg_duration_seconds`, `outcomes` (the distribution by outcome) and `avg_cost_usd` when calls report a cost. `success_rate` is `null` until post-call analysis is available. `significance` compares each version against the first one on the answered rate with a two-proportion z-test (`z`, `p_value`, `significant`, `enough_data`); it is indicative, see its `note`. The numbers are live while the experiment runs. 401 when the token is missing, expired or invalid; 404 when the assistant or the experiment is not in the tenant; 503 when experiments are not available.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
assistant_id | path | string (uuid) | sí | |
experiment_id | path | string (uuid) | sí |
Respuestas
200Successful Response · ExperimentResultsResponseNombre Tipo Requerido Descripción experimentExperimentResponsesí experiment.assistant_idstring (uuid)sí experiment.ended_atstring (date-time) | nullsí experiment.idstring (uuid)sí experiment.namestringsí experiment.promoted_versioninteger | nullsí experiment.started_atstring (date-time)sí experiment.statusstringsí (running, stopped, promoted) experiment.variantsVariantResponse[]sí experiment.variants[].versionintegersí experiment.variants[].weightintegersí experiment.winner_versioninteger | nullsí significanceSignificancesí significance.comparisonsComparison[]sí significance.comparisons[].enough_databooleansí significance.comparisons[].p_valuenumber | nullsí significance.comparisons[].significantbooleansí significance.comparisons[].versionintegersí significance.comparisons[].znumber | nullsí significance.control_versionintegersí significance.metricstringsí significance.notestringsí versionsVersionResult[]sí versions[].answer_ratenumber | nullsí versions[].answeredintegersí versions[].avg_cost_usdnumber | nullsí versions[].avg_duration_secondsnumber | nullsí versions[].callsintegersí versions[].outcomesobjectsí versions[].success_ratenumber | nullversions[].versionintegersí versions[].weightintegersí 401Missing, expired or invalid token. · ErrorResponse403Role below the one in `x-min-role`, a suspended organization, or an API key without the operation's `x-api-key-scope` (any key, if the operation has none). · ErrorResponse404No such assistant or experiment. · ErrorResponse503Experiments are not available. · ErrorResponsedefaultDefault Response · ErrorResponse
POST /v1/assistants/{assistant_id}/experiments/{experiment_id}/promote
Make the winning version the assistant's published version
Solo para usuarios con sesión iniciada (sin API key) · Rol: editor o superior
Signed-in users only (an API key cannot call it yet). An `editor` or above ends the experiment (running or stopped) and publishes a copy of the winner's config as the assistant's newest version, so every contact gets it from now on. `version` must be one of the experiment's variants. The new version number is `promoted_version` of the answer. The draft is not touched: if it differs from the winner the assistant shows as having unpublished changes. Audited as `experiment.promote` and `assistant.publish`. 401 when the token is missing, expired or invalid; 403 below `editor`; 404 when the assistant or the experiment is not in the tenant; 409 when it was already promoted; 422 when `version` is not a variant; 503 when experiments are not available.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
assistant_id | path | string (uuid) | sí | |
experiment_id | path | string (uuid) | sí |
Cuerpo de la solicitud
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
version | integer | sí |
Respuestas
200Successful Response · ExperimentResponseNombre Tipo Requerido Descripción assistant_idstring (uuid)sí ended_atstring (date-time) | nullsí idstring (uuid)sí namestringsí promoted_versioninteger | nullsí started_atstring (date-time)sí statusstringsí (running, stopped, promoted) variantsVariantResponse[]sí variants[].versionintegersí variants[].weightintegersí winner_versioninteger | nullsí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this needs. · ErrorResponse404No such assistant or experiment. · ErrorResponse409The experiment is in another state. · ErrorResponse503Experiments are not available. · ErrorResponsedefaultDefault Response · ErrorResponse
POST /v1/assistants/{assistant_id}/experiments/{experiment_id}/stop
Stop an experiment
Solo para usuarios con sesión iniciada (sin API key) · Rol: editor o superior
Signed-in users only (an API key cannot call it yet). An `editor` or above ends a running experiment without choosing a winner: new attempts and sessions get the latest published version again. Its results stay. Audited as `experiment.stop`. 401 when the token is missing, expired or invalid; 403 below `editor`; 404 when the assistant or the experiment is not in the tenant; 409 when it already ended; 503 when experiments are not available.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
assistant_id | path | string (uuid) | sí | |
experiment_id | path | string (uuid) | sí |
Respuestas
200Successful Response · ExperimentResponseNombre Tipo Requerido Descripción assistant_idstring (uuid)sí ended_atstring (date-time) | nullsí idstring (uuid)sí namestringsí promoted_versioninteger | nullsí started_atstring (date-time)sí statusstringsí (running, stopped, promoted) variantsVariantResponse[]sí variants[].versionintegersí variants[].weightintegersí winner_versioninteger | nullsí 401Missing, expired or invalid token. · ErrorResponse403Role below the one this needs. · ErrorResponse404No such assistant or experiment. · ErrorResponse409The experiment is in another state. · ErrorResponse503Experiments are not available. · ErrorResponsedefaultDefault Response · ErrorResponse