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.
POST
/
ai
/
tests
/
test_framework
/
v1
/
aiagents
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const TestAgent = await client.ai.tests.testFramework.v1.aiagents.create({
agent_name: 'agent_name',
assistant_id: 'assistant_id',
});
console.log(TestAgent.id);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
test_agent = client.ai.tests.test_framework.v1.aiagents.create(
agent_name="agent_name",
assistant_id="assistant_id",
)
print(test_agent.id)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
aiagent, err := client.AI.Tests.TestFramework.V1.Aiagents.New(
context.TODO(),
telnyx.AITestTestFrameworkV1AiagentNewParams{
AgentName: "agent_name",
AssistantID: "assistant_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", aiagent.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.tests.testFramework.v1.aiagents.AiagentCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AiagentCreateParams params = AiagentCreateParams.builder()
.agentName("agent_name")
.assistantId("assistant_id")
.build();
var response = client.ai().tests().testFramework().v1().aiagents().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
test_agent = telnyx.ai.tests.test_framework.v1.aiagents.create(agent_name: "agent_name", assistant_id: "assistant_id")
puts(test_agent)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$test_agent = $client->ai->tests->testFramework->v1->aiagents->create(
agent_name: 'agent_name',
assistant_id: 'assistant_id',
);
var_dump($test_agent);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:tests:test-framework:v1:aiagents create \
--api-key 'My API Key' \
--agent-name agent_name \
--assistant-id assistant_idcurl --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
}
'{
"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
Body
application/json
Response
Test agent created.
Was this page helpful?
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const TestAgent = await client.ai.tests.testFramework.v1.aiagents.create({
agent_name: 'agent_name',
assistant_id: 'assistant_id',
});
console.log(TestAgent.id);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
test_agent = client.ai.tests.test_framework.v1.aiagents.create(
agent_name="agent_name",
assistant_id="assistant_id",
)
print(test_agent.id)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
aiagent, err := client.AI.Tests.TestFramework.V1.Aiagents.New(
context.TODO(),
telnyx.AITestTestFrameworkV1AiagentNewParams{
AgentName: "agent_name",
AssistantID: "assistant_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", aiagent.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.tests.testFramework.v1.aiagents.AiagentCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AiagentCreateParams params = AiagentCreateParams.builder()
.agentName("agent_name")
.assistantId("assistant_id")
.build();
var response = client.ai().tests().testFramework().v1().aiagents().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
test_agent = telnyx.ai.tests.test_framework.v1.aiagents.create(agent_name: "agent_name", assistant_id: "assistant_id")
puts(test_agent)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$test_agent = $client->ai->tests->testFramework->v1->aiagents->create(
agent_name: 'agent_name',
assistant_id: 'assistant_id',
);
var_dump($test_agent);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:tests:test-framework:v1:aiagents create \
--api-key 'My API Key' \
--agent-name agent_name \
--assistant-id assistant_idcurl --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
}
'{
"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."
}
]
}