Skip to main content
POST
Save Scenarios To Library

Authorizations

Authorization
string
header
required

Use Tuner API key (tr_api_...) or user session token. Find your API key in Workspace Settings > API Keys.

Path Parameters

simulation_run_id
integer
required

ID of the simulation run

agent_id
integer
required

Tuner's internal numeric ID for the agent.

workspace_id
integer
required

Workspace ID. Find this in Workspace > General Settings.

Body

application/json

Request to bulk-save selected AI-generated scenarios from a completed run into the library (ENG-1540).

One ScenarioSaveSelection per checked row in the run card's multi-select; tags is a single shared list applied identically to every scenario created by this request.

selections
ScenarioSaveSelection · object[]
required
Required array length: 1 - 100 elements
tags
string[] | null
Maximum array length: 20
Maximum string length: 50

Response

Successful Response

id
integer
required
agent_id
integer
required
workspace_id
integer
required
name
string
required
type
string
required
format
string
required
origin
string
required
situation
string
required
goal
string | null
required
first_line
string | null
required
stop_condition
string | null
required
intent_id
integer | null
required
target_ai_evaluation
Target Ai Evaluation · object | null
required
tags
string[] | null
required
source_run_id
integer | null
required
created_at
string<date-time>
required
updated_at
string<date-time>
required
last_run
ScenarioExecutionItem · object | null

One past execution of a library scenario, within one simulation run.

Deliberately its own class rather than a reuse of SimulationCallDetailResponse (app/schemas/simulation_run.py): that model already has a field called scenario_id meaning "the id of the simulation_run_scenarios row" (the execution record itself), which is a different concept from the library scenario.id this endpoint is scoped by. Reusing that model here would silently collide the two meanings under the same field name.

Carries the same raw ingredients as SimulationCallDetailResponse (status, call_id, duration, analysis_stopped, evals, type, target_eval_label) that the web's getScenarioVerdict() helper (voice-ray-web/src/lib/simulation/displayHelpers.ts) already consumes to compute pass/fail client-side -- no server-side verdict is computed here, by design.

Reused as-is (ENG-1541) for ScenarioResponse.last_run, the scenario list's additive "most recent execution" field -- same raw ingredients, one execution either way.