Create an evaluator scenario
Creates an evaluator scenario in your organization.
POST
/
ai
/
tests
/
test_framework
/
v1
/
scenarios
Create an evaluator scenario
curl --request POST \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Refund escalation flow",
"agent": 1259,
"personality": 4643,
"instructions": "Call the support line and demand a refund for a damaged product.",
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"metrics": [
266881
],
"tags": [
"support"
],
"first_message": "Hi, I want a refund."
}
'import requests
url = "https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios"
payload = {
"name": "Refund escalation flow",
"agent": 1259,
"personality": 4643,
"instructions": "Call the support line and demand a refund for a damaged product.",
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"metrics": [266881],
"tags": ["support"],
"first_message": "Hi, I want a refund."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Refund escalation flow',
agent: 1259,
personality: 4643,
instructions: 'Call the support line and demand a refund for a damaged product.',
expected_outcome_prompt: 'The assistant explains the refund policy and offers escalation.',
metrics: [266881],
tags: ['support'],
first_message: 'Hi, I want a refund.'
})
};
fetch('https://api.telnyx.com/v2/ai/tests/test_framework/v1/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.telnyx.com/v2/ai/tests/test_framework/v1/scenarios",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Refund escalation flow',
'agent' => 1259,
'personality' => 4643,
'instructions' => 'Call the support line and demand a refund for a damaged product.',
'expected_outcome_prompt' => 'The assistant explains the refund policy and offers escalation.',
'metrics' => [
266881
],
'tags' => [
'support'
],
'first_message' => 'Hi, I want a refund.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios"
payload := strings.NewReader("{\n \"name\": \"Refund escalation flow\",\n \"agent\": 1259,\n \"personality\": 4643,\n \"instructions\": \"Call the support line and demand a refund for a damaged product.\",\n \"expected_outcome_prompt\": \"The assistant explains the refund policy and offers escalation.\",\n \"metrics\": [\n 266881\n ],\n \"tags\": [\n \"support\"\n ],\n \"first_message\": \"Hi, I want a refund.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Refund escalation flow\",\n \"agent\": 1259,\n \"personality\": 4643,\n \"instructions\": \"Call the support line and demand a refund for a damaged product.\",\n \"expected_outcome_prompt\": \"The assistant explains the refund policy and offers escalation.\",\n \"metrics\": [\n 266881\n ],\n \"tags\": [\n \"support\"\n ],\n \"first_message\": \"Hi, I want a refund.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Refund escalation flow\",\n \"agent\": 1259,\n \"personality\": 4643,\n \"instructions\": \"Call the support line and demand a refund for a damaged product.\",\n \"expected_outcome_prompt\": \"The assistant explains the refund policy and offers escalation.\",\n \"metrics\": [\n 266881\n ],\n \"tags\": [\n \"support\"\n ],\n \"first_message\": \"Hi, I want a refund.\"\n}"
response = http.request(request)
puts response.read_body{
"id": 9512,
"name": "Refund escalation flow",
"agent": 1259,
"project": null,
"personality": 4643,
"personality_name": "Interruptive (High)",
"tags": [
"support",
"regression"
],
"tool_ids": [],
"runs": [],
"metrics": [
266881,
266882
],
"metric_names": [
"AI interrupting user",
"Average Pitch (in Hz)"
],
"phone_number": "+13125550188",
"outbound_phone_number_data": null,
"first_message": "Hi, I want a refund.",
"inbound_phone_number": null,
"inbound_phone_number_data": null,
"instructions": "Call the support line and demand a refund for a damaged product.",
"simulation_description": "Simulates an impatient customer demanding a refund.",
"information_fields": null,
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"scenario_language": "en",
"scenario_type": "workflow",
"suite_type": "predefined",
"is_predefined": false,
"test_profile": null,
"test_profile_data": null,
"dynamic_variable_values": null,
"folder_path": null,
"max_duration": null
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The AI Tests service rejected the request."
}
]
}{
"errors": [
{
"code": "10003",
"title": "Unauthorized",
"detail": "The API key is missing or invalid."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Not Found",
"detail": "The requested resource or URL could not be found."
}
]
}{
"errors": [
{
"code": "10018",
"title": "Unprocessable Entity",
"detail": "Validation failed for the request payload."
}
]
}{
"errors": [
{
"code": "10029",
"title": "Too Many Requests",
"detail": "Too many requests; retry later."
}
]
}{
"errors": [
{
"code": "10063",
"title": "Service Unavailable",
"detail": "The test framework service is temporarily unavailable."
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
Evaluator scenario created.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?
Create an evaluator scenario
curl --request POST \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Refund escalation flow",
"agent": 1259,
"personality": 4643,
"instructions": "Call the support line and demand a refund for a damaged product.",
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"metrics": [
266881
],
"tags": [
"support"
],
"first_message": "Hi, I want a refund."
}
'import requests
url = "https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios"
payload = {
"name": "Refund escalation flow",
"agent": 1259,
"personality": 4643,
"instructions": "Call the support line and demand a refund for a damaged product.",
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"metrics": [266881],
"tags": ["support"],
"first_message": "Hi, I want a refund."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Refund escalation flow',
agent: 1259,
personality: 4643,
instructions: 'Call the support line and demand a refund for a damaged product.',
expected_outcome_prompt: 'The assistant explains the refund policy and offers escalation.',
metrics: [266881],
tags: ['support'],
first_message: 'Hi, I want a refund.'
})
};
fetch('https://api.telnyx.com/v2/ai/tests/test_framework/v1/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.telnyx.com/v2/ai/tests/test_framework/v1/scenarios",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Refund escalation flow',
'agent' => 1259,
'personality' => 4643,
'instructions' => 'Call the support line and demand a refund for a damaged product.',
'expected_outcome_prompt' => 'The assistant explains the refund policy and offers escalation.',
'metrics' => [
266881
],
'tags' => [
'support'
],
'first_message' => 'Hi, I want a refund.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios"
payload := strings.NewReader("{\n \"name\": \"Refund escalation flow\",\n \"agent\": 1259,\n \"personality\": 4643,\n \"instructions\": \"Call the support line and demand a refund for a damaged product.\",\n \"expected_outcome_prompt\": \"The assistant explains the refund policy and offers escalation.\",\n \"metrics\": [\n 266881\n ],\n \"tags\": [\n \"support\"\n ],\n \"first_message\": \"Hi, I want a refund.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Refund escalation flow\",\n \"agent\": 1259,\n \"personality\": 4643,\n \"instructions\": \"Call the support line and demand a refund for a damaged product.\",\n \"expected_outcome_prompt\": \"The assistant explains the refund policy and offers escalation.\",\n \"metrics\": [\n 266881\n ],\n \"tags\": [\n \"support\"\n ],\n \"first_message\": \"Hi, I want a refund.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Refund escalation flow\",\n \"agent\": 1259,\n \"personality\": 4643,\n \"instructions\": \"Call the support line and demand a refund for a damaged product.\",\n \"expected_outcome_prompt\": \"The assistant explains the refund policy and offers escalation.\",\n \"metrics\": [\n 266881\n ],\n \"tags\": [\n \"support\"\n ],\n \"first_message\": \"Hi, I want a refund.\"\n}"
response = http.request(request)
puts response.read_body{
"id": 9512,
"name": "Refund escalation flow",
"agent": 1259,
"project": null,
"personality": 4643,
"personality_name": "Interruptive (High)",
"tags": [
"support",
"regression"
],
"tool_ids": [],
"runs": [],
"metrics": [
266881,
266882
],
"metric_names": [
"AI interrupting user",
"Average Pitch (in Hz)"
],
"phone_number": "+13125550188",
"outbound_phone_number_data": null,
"first_message": "Hi, I want a refund.",
"inbound_phone_number": null,
"inbound_phone_number_data": null,
"instructions": "Call the support line and demand a refund for a damaged product.",
"simulation_description": "Simulates an impatient customer demanding a refund.",
"information_fields": null,
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"scenario_language": "en",
"scenario_type": "workflow",
"suite_type": "predefined",
"is_predefined": false,
"test_profile": null,
"test_profile_data": null,
"dynamic_variable_values": null,
"folder_path": null,
"max_duration": null
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The AI Tests service rejected the request."
}
]
}{
"errors": [
{
"code": "10003",
"title": "Unauthorized",
"detail": "The API key is missing or invalid."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Not Found",
"detail": "The requested resource or URL could not be found."
}
]
}{
"errors": [
{
"code": "10018",
"title": "Unprocessable Entity",
"detail": "Validation failed for the request payload."
}
]
}{
"errors": [
{
"code": "10029",
"title": "Too Many Requests",
"detail": "Too many requests; retry later."
}
]
}{
"errors": [
{
"code": "10063",
"title": "Service Unavailable",
"detail": "The test framework service is temporarily unavailable."
}
]
}