Referencia de la API

Tests y simulaciones

Tests guionados y simulaciones de un asistente, y el control antes de publicar.

GET /v1/assistants/{assistant_id}/tests

List the test cases of an assistant

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. Each case carries `last_run`, its newest run on any target, or `null` when it never ran. 401 when the token is missing, expired or invalid; 404 when the assistant is not in the tenant; 503 when tests are not available.

Parámetros

NombreEnTipoRequeridoDescripción
assistant_idpathstring (uuid)sí

Respuestas

  • 200 Successful Response · TestCaseList
    NombreTipoRequeridoDescripción
    itemsTestCaseResponse[]sí
    items[].assertionsCriterion | ToolCalled | ToolNotCalled | ReachedStep | EndedWith | Said | NotSaid[]
    items[].assistant_idstring (uuid)sí
    items[].created_atstring (date-time)sí
    items[].idstring (uuid)sí
    items[].last_runRunSummary | null
    items[].last_run.created_atstring (date-time)sí
    items[].last_run.finished_atstring (date-time) | nullsí
    items[].last_run.idstring (uuid)sí
    items[].last_run.statusstringsí (queued, running, passed, failed, error)
    items[].max_turnsinteger
    items[].namestringsí
    items[].personastringsí
    items[].tool_mocksToolMock[]
    items[].tool_mocks[].argumentsobject
    items[].tool_mocks[].errorboolean
    items[].tool_mocks[].responsestring
    items[].tool_mocks[].toolstringsí
    items[].tool_mode"mock" | "live" (mock, live)
    items[].updated_atstring (date-time)sí
    items[].variablesobject
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role 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). · ErrorResponse
  • 404 No such assistant, test or run. · ErrorResponse
  • 503 Tests are not available. · ErrorResponse
  • default Default Response · ErrorResponse

POST /v1/assistants/{assistant_id}/tests

Create a test case for an assistant

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. A test case plays the assistant against a simulated caller: `persona` says who the caller is, what they want and how they behave (for example "cannot pay, gets angry, asks for a person"); `variables` are the values of the `{{name}}` the prompts use; `max_turns` (1 to 40, default 12) bounds the conversation. `assertions` are checked after the conversation: `criterion` (`text`, a success criterion in plain language judged by an LLM, with a rationale), `tool_called` (`name`, optional `arguments` that must match, `match` `equals`, `contains` or `regex`), `tool_not_called`, `reached_step` (a step of the conversation tree), `ended_with` (`completed`, `transferred`, `caller_hangup` or `max_turns`), `said` and `not_said` (a phrase the assistant said, ignoring case). `tool_mocks` give a tool a canned `response` (or an error) so no real API is called: a mock names the `tool` and may require `arguments` to match; with `tool_mode` `mock` (default) a tool without a mock answers a stub, with `live` the real tool is called. A knowledge search is mocked by the name `search_kb_<first 8 hex of the base id>`. An assistant has up to 100 cases. Audited as `assistant_test.create`. 401 when the token is missing, expired or invalid; 403 below `editor`; 404 when the assistant is not in the tenant; 409 when it has the most cases; 422 when the body is invalid; 503 when tests are not available.

Parámetros

NombreEnTipoRequeridoDescripción
assistant_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
assertionsCriterion | ToolCalled | ToolNotCalled | ReachedStep | EndedWith | Said | NotSaid[]
max_turnsinteger
namestringsí
personastringsí
tool_mocksToolMock[]
tool_mocks[].argumentsobject
tool_mocks[].errorboolean
tool_mocks[].responsestring
tool_mocks[].toolstringsí
tool_mode"mock" | "live" (mock, live)
variablesobject

Respuestas

  • 201 Successful Response · TestCaseResponse
    NombreTipoRequeridoDescripción
    assertionsCriterion | ToolCalled | ToolNotCalled | ReachedStep | EndedWith | Said | NotSaid[]
    assistant_idstring (uuid)sí
    created_atstring (date-time)sí
    idstring (uuid)sí
    last_runRunSummary | null
    last_run.created_atstring (date-time)sí
    last_run.finished_atstring (date-time) | nullsí
    last_run.idstring (uuid)sí
    last_run.statusstringsí (queued, running, passed, failed, error)
    max_turnsinteger
    namestringsí
    personastringsí
    tool_mocksToolMock[]
    tool_mocks[].argumentsobject
    tool_mocks[].errorboolean
    tool_mocks[].responsestring
    tool_mocks[].toolstringsí
    tool_mode"mock" | "live" (mock, live)
    updated_atstring (date-time)sí
    variablesobject
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this needs. · ErrorResponse
  • 404 No such assistant, test or run. · ErrorResponse
  • 503 Tests are not available. · ErrorResponse
  • default Default Response · ErrorResponse

GET /v1/assistants/{assistant_id}/tests/runs

The runs of an assistant's tests, 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. Filter by `test_id`, `batch_id` (the runs of one "run all"), `status` (`queued`, `running`, `passed`, `failed` or `error`) or `config_hash`. `limit` is at most 200 (default 50). 401 when the token is missing, expired or invalid; 404 when the assistant is not in the tenant; 503 when tests are not available.

Parámetros

NombreEnTipoRequeridoDescripción
assistant_idpathstring (uuid)sí
test_idquerystring (uuid) | null
batch_idquerystring (uuid) | null
statusquerystring | null
config_hashquerystring | null
limitqueryinteger

Respuestas

  • 200 Successful Response · RunList
    NombreTipoRequeridoDescripción
    itemsRunResponse[]sí
    items[].batch_idstring (uuid)sí
    items[].config_hashstringsí
    items[].created_atstring (date-time)sí
    items[].finished_atstring (date-time) | nullsí
    items[].idstring (uuid)sí
    items[].resultRunResult | nullsíWhat the simulation runner reports: the conversation and each verdict.
    items[].result.assertionsAssertionResult[]
    items[].result.duration_msinteger
    items[].result.end_reasonstring | null
    items[].result.errorstring | null
    items[].result.stepsstring[]
    items[].result.tokensTokenUsage
    items[].result.tool_callsToolCallRecord[]
    items[].result.transcriptTranscriptTurn[]
    items[].result.usageModelUsage[]
    items[].started_atstring (date-time) | nullsí
    items[].statusstringsí (queued, running, passed, failed, error)
    items[].target"draft" | "published"sí (draft, published)
    items[].test_idstring (uuid)sí
    items[].test_namestringsí
    items[].version_numberinteger | nullsí
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role 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). · ErrorResponse
  • 404 No such assistant, test or run. · ErrorResponse
  • 503 Tests are not available. · ErrorResponse
  • default Default Response · ErrorResponse

POST /v1/assistants/{assistant_id}/tests/runs

Run the tests of an assistant

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. Queues one run for each case in `test_ids`, or for every case of the assistant when it is left out. `target` `draft` (default) plays the current draft, which is what a publish would ship; `published` plays the live version (`409` when it was never published). The runs share a `batch_id` and are played asynchronously by the simulation runner: poll `GET .../tests/runs?batch_id=` until no run is `queued` or `running`. Each run keeps the config it ran against (`config_hash`), the transcript, the verdict of each assertion, the tool calls, the tree steps, the tokens and the duration. The assistant, the simulated caller and the judge all use the assistant's own provider. 401 when the token is missing, expired or invalid; 403 below `editor`; 404 when the assistant or a case is not in the tenant; 409 when `published` is asked and there is no published version; 429 when too many runs of the assistant are waiting; 503 when tests are not available.

Parámetros

NombreEnTipoRequeridoDescripción
assistant_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
target"draft" | "published" (draft, published)
test_idsstring (uuid)[] | null

Respuestas

  • 202 Successful Response · RunsStarted
    NombreTipoRequeridoDescripción
    batch_idstring (uuid) | nullsí
    itemsRunResponse[]sí
    items[].batch_idstring (uuid)sí
    items[].config_hashstringsí
    items[].created_atstring (date-time)sí
    items[].finished_atstring (date-time) | nullsí
    items[].idstring (uuid)sí
    items[].resultRunResult | nullsíWhat the simulation runner reports: the conversation and each verdict.
    items[].result.assertionsAssertionResult[]
    items[].result.duration_msinteger
    items[].result.end_reasonstring | null
    items[].result.errorstring | null
    items[].result.stepsstring[]
    items[].result.tokensTokenUsage
    items[].result.tool_callsToolCallRecord[]
    items[].result.transcriptTranscriptTurn[]
    items[].result.usageModelUsage[]
    items[].started_atstring (date-time) | nullsí
    items[].statusstringsí (queued, running, passed, failed, error)
    items[].target"draft" | "published"sí (draft, published)
    items[].test_idstring (uuid)sí
    items[].test_namestringsí
    items[].version_numberinteger | nullsí
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this needs. · ErrorResponse
  • 404 No such assistant, test or run. · ErrorResponse
  • 503 Tests are not available. · ErrorResponse
  • default Default Response · ErrorResponse

GET /v1/assistants/{assistant_id}/tests/runs/{run_id}

One run with its transcript and verdicts

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. `result` is `null` until the run is finished. 401 when the token is missing, expired or invalid; 404 when the assistant or the run is not in the tenant; 503 when tests are not available.

Parámetros

NombreEnTipoRequeridoDescripción
assistant_idpathstring (uuid)sí
run_idpathstring (uuid)sí

Respuestas

  • 200 Successful Response · RunResponse
    NombreTipoRequeridoDescripción
    batch_idstring (uuid)sí
    config_hashstringsí
    created_atstring (date-time)sí
    finished_atstring (date-time) | nullsí
    idstring (uuid)sí
    resultRunResult | nullsíWhat the simulation runner reports: the conversation and each verdict.
    result.assertionsAssertionResult[]
    result.assertions[].indexintegersí
    result.assertions[].labelstringsí
    result.assertions[].passedbooleansí
    result.assertions[].rationalestring
    result.assertions[].typestringsí
    result.duration_msinteger
    result.end_reasonstring | null
    result.errorstring | null
    result.stepsstring[]
    result.tokensTokenUsage
    result.tokens.assistant_completioninteger
    result.tokens.assistant_promptinteger
    result.tokens.caller_completioninteger
    result.tokens.caller_promptinteger
    result.tokens.judge_completioninteger
    result.tokens.judge_promptinteger
    result.tool_callsToolCallRecord[]
    result.tool_calls[].argumentsobject
    result.tool_calls[].is_errorboolean
    result.tool_calls[].mockedboolean
    result.tool_calls[].namestringsí
    result.tool_calls[].outputstring | null
    result.transcriptTranscriptTurn[]
    result.transcript[].role"caller" | "assistant"sí (caller, assistant)
    result.transcript[].stepstring | null
    result.transcript[].textstringsí
    result.usageModelUsage[]
    result.usage[].input_tokensinteger
    result.usage[].modelstringsí
    result.usage[].output_tokensinteger
    result.usage[].providerstringsí
    result.usage[].role"assistant" | "caller" | "judge"sí (assistant, caller, judge)
    started_atstring (date-time) | nullsí
    statusstringsí (queued, running, passed, failed, error)
    target"draft" | "published"sí (draft, published)
    test_idstring (uuid)sí
    test_namestringsí
    version_numberinteger | nullsí
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role 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). · ErrorResponse
  • 404 No such assistant, test or run. · ErrorResponse
  • 503 Tests are not available. · ErrorResponse
  • default Default Response · ErrorResponse

GET /v1/assistants/{assistant_id}/tests/settings

Whether publishing needs the tests to pass

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 tests are not available.

Parámetros

NombreEnTipoRequeridoDescripción
assistant_idpathstring (uuid)sí

Respuestas

  • 200 Successful Response · TestSettingsResponse
    NombreTipoRequeridoDescripción
    require_pass_before_publishbooleansí
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role 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). · ErrorResponse
  • 404 No such assistant, test or run. · ErrorResponse
  • 503 Tests are not available. · ErrorResponse
  • default Default Response · ErrorResponse

PUT /v1/assistants/{assistant_id}/tests/settings

Require the tests to pass before publishing

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. With `require_pass_before_publish` `true`, `POST /v1/assistants/{id}/publish` answers `409` with code `tests_failing` unless every case has a run that passed on the current draft; the message links the runs to look at. An assistant without cases publishes freely. Audited as `assistant_test.require`. 401 when the token is missing, expired or invalid; 403 below `editor`; 404 when the assistant is not in the tenant; 503 when tests are not available.

Parámetros

NombreEnTipoRequeridoDescripción
assistant_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
require_pass_before_publishbooleansí

Respuestas

  • 200 Successful Response · TestSettingsResponse
    NombreTipoRequeridoDescripción
    require_pass_before_publishbooleansí
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this needs. · ErrorResponse
  • 404 No such assistant, test or run. · ErrorResponse
  • 503 Tests are not available. · ErrorResponse
  • default Default Response · ErrorResponse

GET /v1/assistants/{assistant_id}/tests/{test_id}

One test case

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 or the case is not in the tenant; 503 when tests are not available.

Parámetros

NombreEnTipoRequeridoDescripción
assistant_idpathstring (uuid)sí
test_idpathstring (uuid)sí

Respuestas

  • 200 Successful Response · TestCaseResponse
    NombreTipoRequeridoDescripción
    assertionsCriterion | ToolCalled | ToolNotCalled | ReachedStep | EndedWith | Said | NotSaid[]
    assistant_idstring (uuid)sí
    created_atstring (date-time)sí
    idstring (uuid)sí
    last_runRunSummary | null
    last_run.created_atstring (date-time)sí
    last_run.finished_atstring (date-time) | nullsí
    last_run.idstring (uuid)sí
    last_run.statusstringsí (queued, running, passed, failed, error)
    max_turnsinteger
    namestringsí
    personastringsí
    tool_mocksToolMock[]
    tool_mocks[].argumentsobject
    tool_mocks[].errorboolean
    tool_mocks[].responsestring
    tool_mocks[].toolstringsí
    tool_mode"mock" | "live" (mock, live)
    updated_atstring (date-time)sí
    variablesobject
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role 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). · ErrorResponse
  • 404 No such assistant, test or run. · ErrorResponse
  • 503 Tests are not available. · ErrorResponse
  • default Default Response · ErrorResponse

PUT /v1/assistants/{assistant_id}/tests/{test_id}

Replace a test case

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 replaces the whole case (same body as create). Runs already made keep the case as it was when they ran. Audited as `assistant_test.update`. 401 when the token is missing, expired or invalid; 403 below `editor`; 404 when the assistant or the case is not in the tenant; 422 when the body is invalid; 503 when tests are not available.

Parámetros

NombreEnTipoRequeridoDescripción
assistant_idpathstring (uuid)sí
test_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
assertionsCriterion | ToolCalled | ToolNotCalled | ReachedStep | EndedWith | Said | NotSaid[]
max_turnsinteger
namestringsí
personastringsí
tool_mocksToolMock[]
tool_mocks[].argumentsobject
tool_mocks[].errorboolean
tool_mocks[].responsestring
tool_mocks[].toolstringsí
tool_mode"mock" | "live" (mock, live)
variablesobject

Respuestas

  • 200 Successful Response · TestCaseResponse
    NombreTipoRequeridoDescripción
    assertionsCriterion | ToolCalled | ToolNotCalled | ReachedStep | EndedWith | Said | NotSaid[]
    assistant_idstring (uuid)sí
    created_atstring (date-time)sí
    idstring (uuid)sí
    last_runRunSummary | null
    last_run.created_atstring (date-time)sí
    last_run.finished_atstring (date-time) | nullsí
    last_run.idstring (uuid)sí
    last_run.statusstringsí (queued, running, passed, failed, error)
    max_turnsinteger
    namestringsí
    personastringsí
    tool_mocksToolMock[]
    tool_mocks[].argumentsobject
    tool_mocks[].errorboolean
    tool_mocks[].responsestring
    tool_mocks[].toolstringsí
    tool_mode"mock" | "live" (mock, live)
    updated_atstring (date-time)sí
    variablesobject
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this needs. · ErrorResponse
  • 404 No such assistant, test or run. · ErrorResponse
  • 503 Tests are not available. · ErrorResponse
  • default Default Response · ErrorResponse

DELETE /v1/assistants/{assistant_id}/tests/{test_id}

Delete a test case and its runs

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. Audited as `assistant_test.delete`. 401 when the token is missing, expired or invalid; 403 below `editor`; 404 when the assistant or the case is not in the tenant; 503 when tests are not available.

Parámetros

NombreEnTipoRequeridoDescripción
assistant_idpathstring (uuid)sí
test_idpathstring (uuid)sí

Respuestas

  • 204 Successful Response
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this needs. · ErrorResponse
  • 404 No such assistant, test or run. · ErrorResponse
  • 503 Tests are not available. · ErrorResponse
  • default Default Response · ErrorResponse

POST /v1/assistants/{assistant_id}/tests/{test_id}/runs

Run one test case

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. Queues a run of the case against `target` (`draft` by default, or `published`); see `runAssistantTests` for how runs are played and read. 401 when the token is missing, expired or invalid; 403 below `editor`; 404 when the assistant or the case is not in the tenant; 409 when `published` is asked and there is no published version; 429 when too many runs are waiting; 503 when tests are not available.

Parámetros

NombreEnTipoRequeridoDescripción
assistant_idpathstring (uuid)sí
test_idpathstring (uuid)sí

Cuerpo de la solicitud

NombreTipoRequeridoDescripción
target"draft" | "published" (draft, published)

Respuestas

  • 202 Successful Response · RunResponse
    NombreTipoRequeridoDescripción
    batch_idstring (uuid)sí
    config_hashstringsí
    created_atstring (date-time)sí
    finished_atstring (date-time) | nullsí
    idstring (uuid)sí
    resultRunResult | nullsíWhat the simulation runner reports: the conversation and each verdict.
    result.assertionsAssertionResult[]
    result.assertions[].indexintegersí
    result.assertions[].labelstringsí
    result.assertions[].passedbooleansí
    result.assertions[].rationalestring
    result.assertions[].typestringsí
    result.duration_msinteger
    result.end_reasonstring | null
    result.errorstring | null
    result.stepsstring[]
    result.tokensTokenUsage
    result.tokens.assistant_completioninteger
    result.tokens.assistant_promptinteger
    result.tokens.caller_completioninteger
    result.tokens.caller_promptinteger
    result.tokens.judge_completioninteger
    result.tokens.judge_promptinteger
    result.tool_callsToolCallRecord[]
    result.tool_calls[].argumentsobject
    result.tool_calls[].is_errorboolean
    result.tool_calls[].mockedboolean
    result.tool_calls[].namestringsí
    result.tool_calls[].outputstring | null
    result.transcriptTranscriptTurn[]
    result.transcript[].role"caller" | "assistant"sí (caller, assistant)
    result.transcript[].stepstring | null
    result.transcript[].textstringsí
    result.usageModelUsage[]
    result.usage[].input_tokensinteger
    result.usage[].modelstringsí
    result.usage[].output_tokensinteger
    result.usage[].providerstringsí
    result.usage[].role"assistant" | "caller" | "judge"sí (assistant, caller, judge)
    started_atstring (date-time) | nullsí
    statusstringsí (queued, running, passed, failed, error)
    target"draft" | "published"sí (draft, published)
    test_idstring (uuid)sí
    test_namestringsí
    version_numberinteger | nullsí
  • 401 Missing, expired or invalid token. · ErrorResponse
  • 403 Role below the one this needs. · ErrorResponse
  • 404 No such assistant, test or run. · ErrorResponse
  • 503 Tests are not available. · ErrorResponse
  • default Default Response · ErrorResponse