Agent Tools
Manage custom tools and tool assignments for voice agents.
Tools Guide
Tools extend your agents' capabilities by allowing them to perform actions beyond conversation. When an agent determines a tool is needed, it automatically invokes the appropriate tool with parameters extracted from the conversation.
Tool Types
HTTP Tools
HTTP tools execute on your server via HTTP requests. When invoked, the system sends an HTTP request to your configured endpoint with the extracted parameters.
Execution Flow:
Agent determines tool is needed during conversation
System sends HTTP request to your endpoint
Your server processes request and returns JSON response (must complete within 6 seconds)
Agent receives response and continues conversation
Best for:
Database queries and updates
External API integrations
Payment processing
Server-side business logic
CRM integrations
Key characteristics:
Work with all call types (WebRTC, WebSocket, telephony)
6-second timeout
Parameters can be sent in header, query, path, or body
Secure server-side execution
Client Tools
Client tools execute in your client application via WebSocket messages. When invoked, the system sends a client_tool_invocation message to your WebSocket connection.
Execution Flow:
Agent determines client tool is needed
System sends
client_tool_invocationmessage via WebSocketYour client receives message and executes logic
Your client sends
client_tool_resultmessage backAgent receives result and continues conversation
Best for:
Call transfers and forwarding
UI updates and notifications
Client-side state management
Real-time visual feedback
Device control (camera, microphone)
Key characteristics:
Only work with WebRTC and WebSocket calls
No timeout restrictions
Lower latency (no server round-trip)
Direct UI control
Parameters sent via WebSocket (no location field needed)
Why Client Tools Are Essential for Telephony/SIP:
When integrating with SIP systems, HTTP tools cannot work because:
SIP call is connected via WebSocket (audio stream)
HTTP tool fires to your server on a separate connection
Your server has no way to map the HTTP request to the active SIP call
Cannot control which call to forward or transfer
Client tools solve this by sending the invocation on the SAME WebSocket connection as the audio, so your SIP system knows exactly which call to act on.
Example Use Case - Lead Qualification:
Customer calls in → SIP connects via WebSocket → Agent qualifies lead during conversation → Agent invokes client tool with qualification data → Your SIP system receives client_tool_invocation on the active call connection → Your system forwards call to sales team → Sends client_tool_result back → Agent continues or ends call.
Parameters
Dynamic Parameters
Values the AI extracts from conversation. Different for each invocation. Configure with:
type: string, number, boolean, object, array
description: Helps AI understand what to extract
required: Whether parameter must be provided
enum: Optional list of allowed values
location (HTTP tools only): header, query, path, or body
Automatic Parameters
Values provided automatically by the system. Same for every invocation. Hidden from the AI.
Use for API keys, user context, session data
Configure with knownValue field
location field required for HTTP tools
WebSocket Protocol (for Client Tools)
Client tools use WebSocket messages for communication. The WebSocket connection established by /calls/create with medium=websocket carries both binary audio frames and text JSON messages.
Message Types
Messages You Receive (Server → Client)
These are JSON text messages sent from the server to your client application via WebSocket.
1. client_tool_invocation
Sent when the agent invokes a client tool. Your client must handle this and send back a client_tool_result.
Structure:
type: "client_tool_invocation"invocationId: Unique identifier for matching your responsetoolName: The modelToolName of the tool being invokedparameters: Object with parameter values extracted from conversation
2. state
Sent when agent changes state.
Structure:
type: "state"state: One of "idle", "listening", "thinking", "speaking"
Use this to show visual indicators (e.g., microphone icon, thinking spinner, speaking animation).
3. call_started
Sent when call is initialized and ready.
Structure:
type: "call_started"callId: Unique call identifier
Use this to know when the call is active and ready for interaction.
Messages You Send (Client → Server)
These are JSON text messages your client sends to the server via WebSocket.
client_tool_result
Your response after executing a client tool. Send this after receiving client_tool_invocation.
Success Response Structure:
type: "client_tool_result"invocationId: Must match the invocationId from the client_tool_invocation you receivedresult: String with execution resultresponseType: "tool-response" (optional, defaults to this)
Error Response Structure:
type: "client_tool_result"invocationId: Must match the invocationId from the client_tool_invocation you receivederrorType: "implementation-error" or "undefined"errorMessage: Human-readable error description
Critical: You MUST send a client_tool_result for every client_tool_invocation you receive. Use the exact same invocationId. The agent waits for this response to continue the conversation.
Audio Format
Format: Binary WebSocket frames carry PCM s16le (signed 16-bit little-endian PCM) audio data at the sample rates specified in the call creation request.
For SIP/Telephony Integrations:
SIP systems typically use G.711 ulaw (8kHz, 8-bit compressed). You must transcode between formats:
SIP → Ultravox: Convert G.711 ulaw to PCM s16le at your specified inputSampleRate
Ultravox → SIP: Convert PCM s16le at outputSampleRate to G.711 ulaw
Common SIP configuration uses 8000 Hz for both input and output sample rates.
Best Practices
HTTP Tools
Optimize endpoints to respond within 6 seconds
Return clear error messages for failures
Use automatic parameters for API keys and secrets
Validate all inputs on your server
Use HTTPS for all endpoints
Client Tools
Always send client_tool_result for every invocation
Use exact invocationId from invocation message
Handle errors gracefully with error objects
Monitor WebSocket connection health
Implement reconnection logic
Tool Design
Use descriptive modelToolName values (camelCase)
Each tool should have one clear purpose
Write detailed descriptions explaining when to use the tool
Use enums for parameters with limited valid values
Mark parameters as required only if tool cannot function without them
Retrieve all custom tools created for voice agents.
Tool Types
Tools can be filtered by type using the type parameter:
type=http- Returns only HTTP tools (call external APIs)type=client- Returns only client tools (run in browser, invoked via WebSocket messages)No type filter - Returns all tools
Response Format
HTTP tools include httpMethod and baseUrlPattern fields. Client tools omit HTTP-specific fields. Both types include parameters with appropriate structure for their use case.
API key for authentication
Page number for pagination
1Number of items per page
50Search tools by name, description, or model name
Filter tools by type
Successful response
Successful response
Create a new custom tool for voice agents.
Tool Types
HTTP Tools - Call external APIs and webhooks:
Run on your server when the AI invokes them
Require
httpMethodandbaseUrlPatternParameters include
locationfield (header/query/path/body)Perfect for database lookups, external API calls, webhooks
Work across all call mediums (WebRTC, websocket, telephony)
Client Tools - Run directly in the browser:
Execute client-side JavaScript when AI invokes them
No HTTP fields required
Parameters don't use
locationfieldPerfect for UI updates, notifications, client-side interactions
Work with WebRTC and websocket calls (not telephony)
Invoked via
client_tool_invocationWebSocket messages (see/calls/createendpoint for message format)
API key for authentication
Tool created successfully
Invalid request body
Tool name or model name already exists
Delete an agent tool (only if not assigned to any agents)
API key for authentication
Tool ID
Tool deleted successfully
Tool not found
Tool is assigned to agents and cannot be deleted
No content
Update an existing agent tool
API key for authentication
Tool ID
Tool updated successfully
Invalid request body
Tool not found
Tool name or model name already exists
Assign multiple tools to an agent
API key for authentication
Agent ID
Array of tool IDs to assign to the agent
Tools assigned successfully
Invalid request
Agent or tools not found
Unassign a specific tool from an agent
API key for authentication
Agent ID
Tool ID to remove
Tool unassigned successfully
Agent not found or tool not assigned to agent
No content
Last updated