curl --request GET \
--url https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"scenarios": [
{
"id": 123,
"agent_id": 123,
"workspace_id": 123,
"name": "<string>",
"type": "<string>",
"format": "<string>",
"origin": "<string>",
"situation": "<string>",
"goal": "<string>",
"first_line": "<string>",
"stop_condition": "<string>",
"intent_id": 123,
"target_ai_evaluation": {},
"tags": [
"<string>"
],
"source_run_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"last_run": {
"simulation_run_id": 123,
"run_created_at": "2023-11-07T05:31:56Z",
"status": "<string>",
"duration": 123,
"call_id": 123,
"analysis_stopped": true,
"target_eval_label": "<string>",
"type": "<string>",
"evals_expected": true,
"evals": [
{
"label": "<string>",
"value": "<string>",
"evidence": "<string>"
}
]
}
}
]
}{
"detail": "Not authenticated"
}{
"detail": "User does not have access to workspace 42"
}{
"detail": "Agent with ID 17 not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}List Scenarios
List an agent’s active scenarios, newest first.
Supports the scenario-library list view’s search box (q) and type filter (type);
both are optional and can be combined.
Each scenario additively carries last_run (ENG-1541): its most recent execution
across all simulation runs, or None if it has never been run. Fetched in one batched
query (ScenarioService.get_last_runs_by_ids) rather than per-row, to avoid an N+1.
curl --request GET \
--url https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/scenarios")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"scenarios": [
{
"id": 123,
"agent_id": 123,
"workspace_id": 123,
"name": "<string>",
"type": "<string>",
"format": "<string>",
"origin": "<string>",
"situation": "<string>",
"goal": "<string>",
"first_line": "<string>",
"stop_condition": "<string>",
"intent_id": 123,
"target_ai_evaluation": {},
"tags": [
"<string>"
],
"source_run_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"last_run": {
"simulation_run_id": 123,
"run_created_at": "2023-11-07T05:31:56Z",
"status": "<string>",
"duration": 123,
"call_id": 123,
"analysis_stopped": true,
"target_eval_label": "<string>",
"type": "<string>",
"evals_expected": true,
"evals": [
{
"label": "<string>",
"value": "<string>",
"evidence": "<string>"
}
]
}
}
]
}{
"detail": "Not authenticated"
}{
"detail": "User does not have access to workspace 42"
}{
"detail": "Agent with ID 17 not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Use Tuner API key (tr_api_...) or user session token. Find your API key in Workspace Settings > API Keys.
Path Parameters
Tuner's internal numeric ID for the agent.
Workspace ID. Find this in Workspace > General Settings.
Query Parameters
Case-insensitive substring match across name, situation, goal, first_line, and tags.
200Restrict to this scenario type. Omitted returns all types.
routine, pressure Response
Successful Response
Response schema for a list of library scenarios.
Show child attributes
Show child attributes