How they work
- You define a tool in the Portal with a name, description, and JSON Schema for parameters — the same way you configure other tool types.
- The assistant decides when to call it based on the conversation context and the tool’s description.
- Your client-side handler runs in the browser, receiving the parsed arguments from the assistant.
- The return value is sent back to the assistant so it can continue the conversation naturally.
Client-side tools are available for WebRTC-based conversations (voice and chat) using the
@telnyx/ai-agent-lib JavaScript/React library. They are not available for SIP/phone-call-based conversations.When to use client-side tools
Configure a client-side tool in the Portal
- Open AI Assistants in the Telnyx Portal.
- Select an assistant and scroll to the Tools section.
- Click Add Tool and select Client-Side Tool.
- Fill in the fields:
- Click Create & Add to Assistant.
The Parameters schema uses the same JSON Schema format as webhook tool body parameters. The visual editor supports
string, number, integer, boolean, enum, and array types. If your schema uses keywords the visual editor doesn’t support (like minimum, pattern, or default), it will be displayed in Advanced mode as raw JSON to preserve those keywords.Implement client-side tool handlers
Install the Telnyx AI Agent library:Client-side tools require
@telnyx/ai-agent-lib version 0.5.0 or later.Register tools at construction time
Register tools at runtime
Use with React
Handler contract
- The return value is serialized and sent back as the tool output. Strings are sent verbatim; anything else is JSON-stringified.
- Handlers may be async. Each runs with its tool’s Timeout configured in the Portal, falling back to
clientToolTimeoutMsfor tools that have none. If the handler exceeds it, a{ "error": "timeout" }output is returned to the assistant. - The library handles the
call_idround-trip — you don’t need to manage that yourself.
Error handling
The library always returns a result to the assistant so the conversation never hangs:
Your handler should handle its own errors gracefully. If you want the assistant to know about a failure (e.g., an API returned 404), return an error object rather than throwing:
Observe tool lifecycle events
Tool arguments and outputs are never logged — they may contain customer data. Only safe correlation fields (
callId, tool name) appear in debug logs.Client-side tools vs. webhook tools
Use cases
- E-commerce: Look up cart contents, check order status from the browser session, apply a promo code
- Scheduling: Read the user’s calendar from the page, open a booking modal
- Customer support: Fetch user details from the client session, trigger a screen share
- IoT dashboards: Read device state from the dashboard, toggle a device on/off
Learn more
- Tools Library — Create shared tools and reuse them across assistants
- Async Tools & Deferred Context — Webhook tools that don’t block the conversation
- Voice Assistant Quickstart — Get started with AI assistants in the Portal
- @telnyx/ai-agent-lib on npm — Full API reference for the JavaScript/React library