api/python/telnyx-ai-assistants-python/SKILL.md
Create and manage AI voice assistants with custom personalities, knowledge bases, and tool integrations. This skill provides Python SDK examples.
npx skillsauth add team-telnyx/telnyx-toolkit telnyx-ai-assistants-pythonInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
pip install telnyx
import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
All examples below assume client is already initialized as shown above.
Retrieve a list of all AI Assistants configured by the user.
GET /ai/assistants
assistants_list = client.ai.assistants.list()
print(assistants_list.data)
Create a new AI Assistant.
POST /ai/assistants — Required: name, model, instructions
assistant = client.ai.assistants.create(
instructions="instructions",
model="model",
name="name",
)
print(assistant.id)
Retrieve an AI Assistant configuration by assistant_id.
GET /ai/assistants/{assistant_id}
assistant = client.ai.assistants.retrieve(
assistant_id="assistant_id",
)
print(assistant.id)
Update an AI Assistant's attributes.
POST /ai/assistants/{assistant_id}
assistant = client.ai.assistants.update(
assistant_id="assistant_id",
)
print(assistant.id)
Delete an AI Assistant by assistant_id.
DELETE /ai/assistants/{assistant_id}
assistant = client.ai.assistants.delete(
"assistant_id",
)
print(assistant.id)
This endpoint allows a client to send a chat message to a specific AI Assistant.
POST /ai/assistants/{assistant_id}/chat — Required: content, conversation_id
response = client.ai.assistants.chat(
assistant_id="assistant_id",
content="Tell me a joke about cats",
conversation_id="42b20469-1215-4a9a-8964-c36f66b406f4",
)
print(response.content)
Send an SMS message for an assistant.
POST /ai/assistants/{assistant_id}/chat/sms — Required: from, to
response = client.ai.assistants.send_sms(
assistant_id="assistant_id",
from_="from",
to="to",
)
print(response.conversation_id)
Clone an existing assistant, excluding telephony and messaging settings.
POST /ai/assistants/{assistant_id}/clone
assistant = client.ai.assistants.clone(
"assistant_id",
)
print(assistant.id)
Import assistants from external providers.
POST /ai/assistants/import — Required: provider, api_key_ref
assistants_list = client.ai.assistants.imports(
api_key_ref="api_key_ref",
provider="elevenlabs",
)
print(assistants_list.data)
Get scheduled events for an assistant with pagination and filtering
GET /ai/assistants/{assistant_id}/scheduled_events
page = client.ai.assistants.scheduled_events.list(
assistant_id="assistant_id",
)
page = page.data[0]
print(page)
Create a scheduled event for an assistant
POST /ai/assistants/{assistant_id}/scheduled_events — Required: telnyx_conversation_channel, telnyx_end_user_target, telnyx_agent_target, scheduled_at_fixed_datetime
from datetime import datetime
scheduled_event_response = client.ai.assistants.scheduled_events.create(
assistant_id="assistant_id",
scheduled_at_fixed_datetime=datetime.fromisoformat("2025-04-15T13:07:28.764"),
telnyx_agent_target="telnyx_agent_target",
telnyx_conversation_channel="phone_call",
telnyx_end_user_target="telnyx_end_user_target",
)
print(scheduled_event_response)
Retrieve a scheduled event by event ID
GET /ai/assistants/{assistant_id}/scheduled_events/{event_id}
scheduled_event_response = client.ai.assistants.scheduled_events.retrieve(
event_id="event_id",
assistant_id="assistant_id",
)
print(scheduled_event_response)
If the event is pending, this will cancel the event.
DELETE /ai/assistants/{assistant_id}/scheduled_events/{event_id}
client.ai.assistants.scheduled_events.delete(
event_id="event_id",
assistant_id="assistant_id",
)
Retrieves a paginated list of assistant tests with optional filtering capabilities
GET /ai/assistants/tests
page = client.ai.assistants.tests.list()
page = page.data[0]
print(page.test_id)
Creates a comprehensive test configuration for evaluating AI assistant performance
POST /ai/assistants/tests — Required: name, destination, instructions, rubric
assistant_test = 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",
}],
)
print(assistant_test.test_id)
Retrieves a list of all distinct test suite names available to the current user
GET /ai/assistants/tests/test-suites
test_suites = client.ai.assistants.tests.test_suites.list()
print(test_suites.data)
Retrieves paginated history of test runs for a specific test suite with filtering options
GET /ai/assistants/tests/test-suites/{suite_name}/runs
page = client.ai.assistants.tests.test_suites.runs.list(
suite_name="suite_name",
)
page = page.data[0]
print(page.run_id)
Executes all tests within a specific test suite as a batch operation
POST /ai/assistants/tests/test-suites/{suite_name}/runs
test_run_responses = client.ai.assistants.tests.test_suites.runs.trigger(
suite_name="suite_name",
)
print(test_run_responses)
Retrieves detailed information about a specific assistant test
GET /ai/assistants/tests/{test_id}
assistant_test = client.ai.assistants.tests.retrieve(
"test_id",
)
print(assistant_test.test_id)
Updates an existing assistant test configuration with new settings
PUT /ai/assistants/tests/{test_id}
assistant_test = client.ai.assistants.tests.update(
test_id="test_id",
)
print(assistant_test.test_id)
Permanently removes an assistant test and all associated data
DELETE /ai/assistants/tests/{test_id}
client.ai.assistants.tests.delete(
"test_id",
)
Retrieves paginated execution history for a specific assistant test with filtering options
GET /ai/assistants/tests/{test_id}/runs
page = client.ai.assistants.tests.runs.list(
test_id="test_id",
)
page = page.data[0]
print(page.run_id)
Initiates immediate execution of a specific assistant test
POST /ai/assistants/tests/{test_id}/runs
test_run_response = client.ai.assistants.tests.runs.trigger(
test_id="test_id",
)
print(test_run_response.run_id)
Retrieves detailed information about a specific test run execution
GET /ai/assistants/tests/{test_id}/runs/{run_id}
test_run_response = client.ai.assistants.tests.runs.retrieve(
run_id="run_id",
test_id="test_id",
)
print(test_run_response.run_id)
Retrieves all versions of a specific assistant with complete configuration and metadata
GET /ai/assistants/{assistant_id}/versions
assistants_list = client.ai.assistants.versions.list(
"assistant_id",
)
print(assistants_list.data)
Retrieves a specific version of an assistant by assistant_id and version_id
GET /ai/assistants/{assistant_id}/versions/{version_id}
assistant = client.ai.assistants.versions.retrieve(
version_id="version_id",
assistant_id="assistant_id",
)
print(assistant.id)
Updates the configuration of a specific assistant version.
POST /ai/assistants/{assistant_id}/versions/{version_id}
assistant = client.ai.assistants.versions.update(
version_id="version_id",
assistant_id="assistant_id",
)
print(assistant.id)
Permanently removes a specific version of an assistant.
DELETE /ai/assistants/{assistant_id}/versions/{version_id}
client.ai.assistants.versions.delete(
version_id="version_id",
assistant_id="assistant_id",
)
Promotes a specific version to be the main/current version of the assistant.
POST /ai/assistants/{assistant_id}/versions/{version_id}/promote
assistant = client.ai.assistants.versions.promote(
version_id="version_id",
assistant_id="assistant_id",
)
print(assistant.id)
Endpoint to get a canary deploy configuration for an assistant.
GET /ai/assistants/{assistant_id}/canary-deploys
canary_deploy_response = client.ai.assistants.canary_deploys.retrieve(
"assistant_id",
)
print(canary_deploy_response.assistant_id)
Endpoint to create a canary deploy configuration for an assistant.
POST /ai/assistants/{assistant_id}/canary-deploys — Required: versions
canary_deploy_response = client.ai.assistants.canary_deploys.create(
assistant_id="assistant_id",
versions=[{
"percentage": 1,
"version_id": "version_id",
}],
)
print(canary_deploy_response.assistant_id)
Endpoint to update a canary deploy configuration for an assistant.
PUT /ai/assistants/{assistant_id}/canary-deploys — Required: versions
canary_deploy_response = client.ai.assistants.canary_deploys.update(
assistant_id="assistant_id",
versions=[{
"percentage": 1,
"version_id": "version_id",
}],
)
print(canary_deploy_response.assistant_id)
Endpoint to delete a canary deploy configuration for an assistant.
DELETE /ai/assistants/{assistant_id}/canary-deploys
client.ai.assistants.canary_deploys.delete(
"assistant_id",
)
Get an assistant texml by assistant_id.
GET /ai/assistants/{assistant_id}/texml
response = client.ai.assistants.get_texml(
"assistant_id",
)
print(response)
Test a webhook tool for an assistant
POST /ai/assistants/{assistant_id}/tools/{tool_id}/test
response = client.ai.assistants.tools.test(
tool_id="tool_id",
assistant_id="assistant_id",
)
print(response.data)
List all available integrations.
GET /ai/integrations
integrations = client.ai.integrations.list()
print(integrations.data)
List user setup integrations
GET /ai/integrations/connections
connections = client.ai.integrations.connections.list()
print(connections.data)
Get user setup integrations
GET /ai/integrations/connections/{user_connection_id}
connection = client.ai.integrations.connections.retrieve(
"user_connection_id",
)
print(connection.data)
Delete a specific integration connection.
DELETE /ai/integrations/connections/{user_connection_id}
client.ai.integrations.connections.delete(
"user_connection_id",
)
Retrieve integration details
GET /ai/integrations/{integration_id}
integration = client.ai.integrations.retrieve(
"integration_id",
)
print(integration.id)
Retrieve a list of MCP servers.
GET /ai/mcp_servers
page = client.ai.mcp_servers.list()
page = page.items[0]
print(page.id)
Create a new MCP server.
POST /ai/mcp_servers — Required: name, type, url
mcp_server = client.ai.mcp_servers.create(
name="name",
type="type",
url="url",
)
print(mcp_server.id)
Retrieve details for a specific MCP server.
GET /ai/mcp_servers/{mcp_server_id}
mcp_server = client.ai.mcp_servers.retrieve(
"mcp_server_id",
)
print(mcp_server.id)
Update an existing MCP server.
PUT /ai/mcp_servers/{mcp_server_id}
mcp_server = client.ai.mcp_servers.update(
mcp_server_id="mcp_server_id",
)
print(mcp_server.id)
Delete a specific MCP server.
DELETE /ai/mcp_servers/{mcp_server_id}
client.ai.mcp_servers.delete(
"mcp_server_id",
)
tools
Build cross-platform VoIP calling apps with React Native using Telnyx Voice SDK. High-level reactive API with automatic lifecycle management, CallKit/ConnectionService integration, and push notifications. Use for mobile VoIP apps with minimal setup.
tools
Build browser-based VoIP calling apps using Telnyx WebRTC JavaScript SDK. Covers authentication, voice calls, events, debugging, call quality metrics, and AI Agent integration. Use for web-based real-time communication.
tools
Build VoIP calling apps on iOS using Telnyx WebRTC SDK. Covers authentication, making/receiving calls, CallKit integration, PushKit/APNS push notifications, call quality metrics, and AI Agent integration. Use when implementing real-time voice communication on iOS.
tools
Build cross-platform VoIP calling apps with Flutter using Telnyx WebRTC SDK. Covers authentication, making/receiving calls, push notifications (FCM + APNS), call quality metrics, and AI Agent integration. Works on Android, iOS, and Web.