Create a test agent
Creates a test agent in your organization. The agent wraps a Telnyx AI assistant so simulated callers can be sent against it.
curl --request POST \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/aiagents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_name": "Support Bot Under Test",
"assistant_id": "e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6",
"description": "Evaluates the support assistant against generated callers.",
"language": "en",
"llm_model": "openai/gpt-oss-120b",
"llm_temperature": 0.7,
"llm_max_tokens": 512,
"inbound": false,
"sip_endpoint": "",
"outbound_auto_call": false,
"auto_update_dropoff_nodes": false,
"auto_update_topic_nodes": false
}
'import requests
url = "https://api.telnyx.com/v2/ai/tests/test_framework/v1/aiagents"
payload = {
"agent_name": "Support Bot Under Test",
"assistant_id": "e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6",
"description": "Evaluates the support assistant against generated callers.",
"language": "en",
"llm_model": "openai/gpt-oss-120b",
"llm_temperature": 0.7,
"llm_max_tokens": 512,
"inbound": False,
"sip_endpoint": "",
"outbound_auto_call": False,
"auto_update_dropoff_nodes": False,
"auto_update_topic_nodes": False
}
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({
agent_name: 'Support Bot Under Test',
assistant_id: 'e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6',
description: 'Evaluates the support assistant against generated callers.',
language: 'en',
llm_model: 'openai/gpt-oss-120b',
llm_temperature: 0.7,
llm_max_tokens: 512,
inbound: false,
sip_endpoint: '',
outbound_auto_call: false,
auto_update_dropoff_nodes: false,
auto_update_topic_nodes: false
})
};
fetch('https://api.telnyx.com/v2/ai/tests/test_framework/v1/aiagents', 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/aiagents",
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([
'agent_name' => 'Support Bot Under Test',
'assistant_id' => 'e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6',
'description' => 'Evaluates the support assistant against generated callers.',
'language' => 'en',
'llm_model' => 'openai/gpt-oss-120b',
'llm_temperature' => 0.7,
'llm_max_tokens' => 512,
'inbound' => false,
'sip_endpoint' => '',
'outbound_auto_call' => false,
'auto_update_dropoff_nodes' => false,
'auto_update_topic_nodes' => false
]),
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/aiagents"
payload := strings.NewReader("{\n \"agent_name\": \"Support Bot Under Test\",\n \"assistant_id\": \"e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6\",\n \"description\": \"Evaluates the support assistant against generated callers.\",\n \"language\": \"en\",\n \"llm_model\": \"openai/gpt-oss-120b\",\n \"llm_temperature\": 0.7,\n \"llm_max_tokens\": 512,\n \"inbound\": false,\n \"sip_endpoint\": \"\",\n \"outbound_auto_call\": false,\n \"auto_update_dropoff_nodes\": false,\n \"auto_update_topic_nodes\": false\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/aiagents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"Support Bot Under Test\",\n \"assistant_id\": \"e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6\",\n \"description\": \"Evaluates the support assistant against generated callers.\",\n \"language\": \"en\",\n \"llm_model\": \"openai/gpt-oss-120b\",\n \"llm_temperature\": 0.7,\n \"llm_max_tokens\": 512,\n \"inbound\": false,\n \"sip_endpoint\": \"\",\n \"outbound_auto_call\": false,\n \"auto_update_dropoff_nodes\": false,\n \"auto_update_topic_nodes\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/tests/test_framework/v1/aiagents")
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 \"agent_name\": \"Support Bot Under Test\",\n \"assistant_id\": \"e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6\",\n \"description\": \"Evaluates the support assistant against generated callers.\",\n \"language\": \"en\",\n \"llm_model\": \"openai/gpt-oss-120b\",\n \"llm_temperature\": 0.7,\n \"llm_max_tokens\": 512,\n \"inbound\": false,\n \"sip_endpoint\": \"\",\n \"outbound_auto_call\": false,\n \"auto_update_dropoff_nodes\": false,\n \"auto_update_topic_nodes\": false\n}"
response = http.request(request)
puts response.read_body{
"id": 1259,
"agent_name": "Support Bot Under Test",
"contact_number": "+13125550123",
"inbound": false,
"description": "Evaluates the support assistant against generated callers.",
"language": "en",
"assistant_id": "e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6",
"chat_assistant_id": "",
"llm_system_prompt": "You are calling a customer support line.",
"llm_model": "openai/gpt-oss-120b",
"llm_temperature": 0.7,
"llm_max_tokens": 512,
"outbound_auto_call": false,
"sip_endpoint": "",
"sip_auth": null,
"knowledge_base_files": [],
"enabled_personalities": [
4567
],
"auto_update_dropoff_nodes": false,
"auto_update_topic_nodes": false,
"hallucination_metric_kb_files": [],
"outbound_numbers": [],
"created_at": "2026-10-13T18:04:05.123456Z",
"updated_at": "2026-10-13T18:04:05.123456Z"
}{
"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
Name of the test agent.
ID of the Telnyx AI assistant under test.
ISO language code the test agent converses in.
Response
Test agent created.
Name of the test agent.
ID of the Telnyx AI assistant under test.
Contact phone number for the test agent.
Whether the test agent accepts inbound calls.
ISO language code the test agent converses in.
ID of the chat assistant under test, when testing text channels.
Model used to drive the test agent's side of the conversation.
Show child attributes
Show child attributes
Knowledge-base files associated with the test agent.
IDs of the test personalities enabled for this agent.
Outbound numbers associated with the test agent.
Was this page helpful?
curl --request POST \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/aiagents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_name": "Support Bot Under Test",
"assistant_id": "e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6",
"description": "Evaluates the support assistant against generated callers.",
"language": "en",
"llm_model": "openai/gpt-oss-120b",
"llm_temperature": 0.7,
"llm_max_tokens": 512,
"inbound": false,
"sip_endpoint": "",
"outbound_auto_call": false,
"auto_update_dropoff_nodes": false,
"auto_update_topic_nodes": false
}
'import requests
url = "https://api.telnyx.com/v2/ai/tests/test_framework/v1/aiagents"
payload = {
"agent_name": "Support Bot Under Test",
"assistant_id": "e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6",
"description": "Evaluates the support assistant against generated callers.",
"language": "en",
"llm_model": "openai/gpt-oss-120b",
"llm_temperature": 0.7,
"llm_max_tokens": 512,
"inbound": False,
"sip_endpoint": "",
"outbound_auto_call": False,
"auto_update_dropoff_nodes": False,
"auto_update_topic_nodes": False
}
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({
agent_name: 'Support Bot Under Test',
assistant_id: 'e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6',
description: 'Evaluates the support assistant against generated callers.',
language: 'en',
llm_model: 'openai/gpt-oss-120b',
llm_temperature: 0.7,
llm_max_tokens: 512,
inbound: false,
sip_endpoint: '',
outbound_auto_call: false,
auto_update_dropoff_nodes: false,
auto_update_topic_nodes: false
})
};
fetch('https://api.telnyx.com/v2/ai/tests/test_framework/v1/aiagents', 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/aiagents",
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([
'agent_name' => 'Support Bot Under Test',
'assistant_id' => 'e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6',
'description' => 'Evaluates the support assistant against generated callers.',
'language' => 'en',
'llm_model' => 'openai/gpt-oss-120b',
'llm_temperature' => 0.7,
'llm_max_tokens' => 512,
'inbound' => false,
'sip_endpoint' => '',
'outbound_auto_call' => false,
'auto_update_dropoff_nodes' => false,
'auto_update_topic_nodes' => false
]),
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/aiagents"
payload := strings.NewReader("{\n \"agent_name\": \"Support Bot Under Test\",\n \"assistant_id\": \"e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6\",\n \"description\": \"Evaluates the support assistant against generated callers.\",\n \"language\": \"en\",\n \"llm_model\": \"openai/gpt-oss-120b\",\n \"llm_temperature\": 0.7,\n \"llm_max_tokens\": 512,\n \"inbound\": false,\n \"sip_endpoint\": \"\",\n \"outbound_auto_call\": false,\n \"auto_update_dropoff_nodes\": false,\n \"auto_update_topic_nodes\": false\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/aiagents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"Support Bot Under Test\",\n \"assistant_id\": \"e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6\",\n \"description\": \"Evaluates the support assistant against generated callers.\",\n \"language\": \"en\",\n \"llm_model\": \"openai/gpt-oss-120b\",\n \"llm_temperature\": 0.7,\n \"llm_max_tokens\": 512,\n \"inbound\": false,\n \"sip_endpoint\": \"\",\n \"outbound_auto_call\": false,\n \"auto_update_dropoff_nodes\": false,\n \"auto_update_topic_nodes\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/tests/test_framework/v1/aiagents")
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 \"agent_name\": \"Support Bot Under Test\",\n \"assistant_id\": \"e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6\",\n \"description\": \"Evaluates the support assistant against generated callers.\",\n \"language\": \"en\",\n \"llm_model\": \"openai/gpt-oss-120b\",\n \"llm_temperature\": 0.7,\n \"llm_max_tokens\": 512,\n \"inbound\": false,\n \"sip_endpoint\": \"\",\n \"outbound_auto_call\": false,\n \"auto_update_dropoff_nodes\": false,\n \"auto_update_topic_nodes\": false\n}"
response = http.request(request)
puts response.read_body{
"id": 1259,
"agent_name": "Support Bot Under Test",
"contact_number": "+13125550123",
"inbound": false,
"description": "Evaluates the support assistant against generated callers.",
"language": "en",
"assistant_id": "e1a2b3c4-d5e6-f7a8-b9c0-d1e2f3a4b5c6",
"chat_assistant_id": "",
"llm_system_prompt": "You are calling a customer support line.",
"llm_model": "openai/gpt-oss-120b",
"llm_temperature": 0.7,
"llm_max_tokens": 512,
"outbound_auto_call": false,
"sip_endpoint": "",
"sip_auth": null,
"knowledge_base_files": [],
"enabled_personalities": [
4567
],
"auto_update_dropoff_nodes": false,
"auto_update_topic_nodes": false,
"hallucination_metric_kb_files": [],
"outbound_numbers": [],
"created_at": "2026-10-13T18:04:05.123456Z",
"updated_at": "2026-10-13T18:04:05.123456Z"
}{
"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."
}
]
}