AI Assistants on Telnyx can now call functions that run directly in the browser during a voice or chat conversation. Client-side tools give the assistant access to browser state, local data, and any API the page is already authenticated to, without a webhook or backend round-trip.
registerClientTool
and unregisterClientTool
. Per-tool timeout is configurable via clientToolTimeoutMs
.npm install @telnyx/ai-agent-lib
(requires version 0.5.0 or later).
import { TelnyxAIAgent } from '@telnyx/ai-agent-lib';
const agent = new TelnyxAIAgent({
agentId: 'your-agent-id',
clientTools: {
lookup_order: async (args) => {
const { orderId } = args as { orderId: string };
const response = await fetch(`/api/orders/${orderId}`);
const order = await response.json();
return { status: 'found', orderId: order.id, total: order.total };
},
},
});
Client-side tools are available for WebRTC-based conversations (voice and chat) using the @telnyx/ai-agent-lib
library. They are not available for SIP or phone-call-based conversations.
Learn more in the client-side tools guide or the AI Agent Lib docs.