Skip to main content
POST
/
ai
/
assistants
/
tests
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: 'My API Key',
});

const assistantTest = await client.ai.assistants.tests.create({
  destination: '+15551234567',
  instructions:
    'Act as a frustrated customer who received a damaged product. Ask for a refund and escalate if not satisfied with the initial response.',
  name: 'Customer Support Bot Test',
  rubric: [
    { criteria: 'Assistant responds within 30 seconds', name: 'Response Time' },
    { criteria: 'Provides correct product information', name: 'Accuracy' },
  ],
});

console.log(assistantTest.test_id);
{
  "test_id": "123e4567-e89b-12d3-a456-426614174000",
  "name": "Customer Support Bot Test",
  "description": "<string>",
  "telnyx_conversation_channel": "web_chat",
  "destination": "<string>",
  "max_duration_seconds": 123,
  "test_suite": "<string>",
  "instructions": "<string>",
  "rubric": [
    {
      "criteria": "Responds within 30 seconds",
      "name": "Response Time"
    }
  ],
  "created_at": "2024-01-15T09:00:00Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request model for creating a new assistant test.

This model defines all the required and optional parameters needed to create a comprehensive test for an AI assistant, including test configuration, evaluation criteria, and scheduling options.

name
string
required

A descriptive name for the assistant test. This will be used to identify the test in the UI and reports.

Required string length: 1 - 255
Example:

"Customer Support Bot Test"

destination
string
required

The target destination for the test conversation. Format depends on the channel: phone number for SMS/voice, webhook URL for web chat, etc.

Minimum length: 1
Example:

"+15551234567"

instructions
string
required

Detailed instructions that define the test scenario and what the assistant should accomplish. This guides the test execution and evaluation.

Required string length: 1 - 5000
Example:

"Act as a frustrated customer who received a damaged product. Ask for a refund and escalate if not satisfied with the initial response."

rubric
Rubric · object[]
required

Evaluation criteria used to assess the assistant's performance. Each rubric item contains a name and specific criteria for evaluation.

Minimum length: 1
Example:
[
{
"criteria": "Assistant responds within 30 seconds",
"name": "Response Time"
},
{
"criteria": "Provides correct product information",
"name": "Accuracy"
}
]
description
string

Optional detailed description of what this test evaluates and its purpose. Helps team members understand the test's objectives.

Maximum length: 1000
telnyx_conversation_channel
enum<string>
default:web_chat

The communication channel through which the test will be conducted. Determines how the assistant will receive and respond to test messages.

Available options:
phone_call,
web_call,
sms_chat,
web_chat
Example:

"web_chat"

max_duration_seconds
integer

Maximum duration in seconds that the test conversation should run before timing out. If not specified, uses system default timeout.

Required range: 1 <= x <= 3600
test_suite
string

Optional test suite name to group related tests together. Useful for organizing tests by feature, team, or release cycle.

Maximum length: 100

Response

Returns the created test configuration with assigned test ID

Response model containing complete assistant test information.

Returns all test configuration details including evaluation criteria, scheduling, and metadata. Used when retrieving individual tests or after creating/updating tests.

test_id
string<uuid>
required

Unique identifier for the assistant test.

Example:

"123e4567-e89b-12d3-a456-426614174000"

name
string
required

Human-readable name of the test.

Example:

"Customer Support Bot Test"

telnyx_conversation_channel
enum<string>
required

Communication channel used for test execution.

Available options:
phone_call,
web_call,
sms_chat,
web_chat
Example:

"web_chat"

rubric
Rubric · object[]
required

Evaluation criteria used to assess test performance.

Example:
[
{
"criteria": "Responds within 30 seconds",
"name": "Response Time"
}
]
created_at
string<date-time>
required

Timestamp when the test was created.

Example:

"2024-01-15T09:00:00Z"

description
string

Detailed description of the test's purpose and scope.

destination
string

Target destination for test conversations.

max_duration_seconds
integer

Maximum allowed duration for test execution in seconds.

test_suite
string

Test suite grouping for organizational purposes.

instructions
string

Detailed test scenario instructions and objectives.