Tools in Ultravox allow you to extend the capabilities of your AI agent by giving it access to external APIs and services. With tools, your AI can perform actions like fetching real-time data, interacting with databases, or integrating with third-party services, all while maintaining a natural conversation flow.
Tools in Ultravox are Different
Unlike using tools with single-generation LLM APIs, Ultravox actually calls your tool. This means you need to do a bit more work upfront in defining tools with the proper authentication and parameters.
Read Tools in Ultravox for loads of information about tool types, auth, and custom parameters.
Use ultravox-70B for Tools
While tools are supported across multiple variants of the Ultravox model, using tools with smaller models (i.e. 8B) typically don’t work well. YMMV. See available models for more info.
GET /tools
Lists all available tools. Account scoped.
next string URL for the next page of results. previous string URL for the previous page of results. results array Array of objects. Each object contains: toolId
, name
, created
, and definition
(see the tool definition for details.)
POST /tools
Creates a new tool. Account scoped.
namerequired string The name of the tool. Maximum 40 characters. definitionrequired object A Tool definition.
toolId string Unique identifier for the created tool. name string The name of the tool. created string Timestamp of when the tool was created. definition object The definition of the Tool .
GET /tools/{tool_id}
Retrieves details of a specific tool. Account scoped.
tool_idrequired Unique identifier of the tool to retrieve.
toolId string Unique identifier for the tool. name string The name of the tool. created string Timestamp of when the tool was created. definition object A Tool defintion object for the tool.
PUT /tools/{tool_id}
Replaces an existing tool. Updating a single field in a tool is not supported. The entire tool definition must be provided. Account scoped.
tool_idrequired Unique identifier of the tool to update.
namerequired string The updated name of the tool. Maximum 40 characters. definitionrequired object The updated Tool definition of the tool.
toolId string Unique identifier for the updated tool. name string The updated name of the tool. created string Timestamp of when the tool was originally created. definition object The updated Tool definition for the tool.
DELETE /tools/{tool_id}
Deletes a specific tool. Account scoped.
tool_idrequired Unique identifier of the tool to delete.
Examples
--url ' https://api.ultravox.ai/api/tools ' \
--header ' X-API-Key: aBCDef.123456 '
fetch ( ' https://api.ultravox.ai/api/tools ' , {
' X-API-Key ' : ' aBCDef.123456 '
. then ( response => response . json ())
. then ( data => console . log ( data ))
. catch ( error => console . error ( ' Error: ' , error ));
Response
"toolId" : " 550e8400-e29b-41d4-a716-446655440000 " ,
"created" : " 2024-09-18T10:30:00Z " ,
"description" : " Get current weather information for a given location " ,
"location" : " PARAMETER_LOCATION_QUERY " ,
"description" : " City name or ZIP code "
"baseUrlPattern" : " https://api.weatherservice.com/v1/current " ,
curl -X POST -F " file=@./<your_tools_file.yaml>;type=text/yaml " \
--url https://api.ultravox.ai/api/tools \
--header ' X-API-Key: aBCDef.123456 '
--url ' https://api.ultravox.ai/api/tools ' \
--header ' Content-Type: application/json ' \
--header ' X-API-Key: aBCDef.123456 ' \
"description": "Get the current stock price for a given symbol",
"location": "PARAMETER_LOCATION_QUERY",
"description": "Stock symbol (e.g., AAPL for Apple Inc.)"
"baseUrlPattern": "https://api.stockmarket.com/v1/price",
description: " Get the current stock price for a given symbol " ,
location: " PARAMETER_LOCATION_QUERY " ,
description: " Stock symbol (e.g., AAPL for Apple Inc.) "
baseUrlPattern: " https://api.stockmarket.com/v1/price " ,
fetch ( ' https://api.ultravox.ai/api/tools ' , {
' Content-Type ' : ' application/json ' ,
' X-API-Key ' : ' aBCDef.123456 '
body: JSON . stringify ( toolData )
. then ( response => response . json ())
. then ( data => console . log ( data ))
. catch ( error => console . error ( ' Error: ' , error ));
Response
"toolId" : " 7f1e3b78-c71e-4b1f-9c4a-b83f7683f0d2 " ,
"created" : " 2024-09-18T14:15:22Z " ,
"description" : " Get the current stock price for a given symbol " ,
"location" : " PARAMETER_LOCATION_QUERY " ,
"description" : " Stock symbol (e.g., AAPL for Apple Inc.) "
"baseUrlPattern" : " https://api.stockmarket.com/v1/price " ,
--url ' https://api.ultravox.ai/api/tools/7f1e3b78-c71e-4b1f-9c4a-b83f7683f0d2 ' \
--header ' Content-Type: application/json ' \
--header ' X-API-Key: aBCDef.123456 ' \
"name": "stock_price_v2",
"description": "Get the current stock price and company info for a given symbol",
"location": "PARAMETER_LOCATION_QUERY",
"description": "Stock symbol (e.g., AAPL for Apple Inc.)"
"baseUrlPattern": "https://api.stockmarket.com/v2/price-and-info",
const updatedToolData = {
description: " Get the current stock price and company info for a given symbol " ,
location: " PARAMETER_LOCATION_QUERY " ,
description: " Stock symbol (e.g., AAPL for Apple Inc.) "
baseUrlPattern: " https://api.stockmarket.com/v2/price-and-info " ,
fetch ( ' https://api.ultravox.ai/api/tools/7f1e3b78-c71e-4b1f-9c4a-b83f7683f0d2 ' , {
' Content-Type ' : ' application/json ' ,
' X-API-Key ' : ' aBCDef.123456 '
body: JSON . stringify ( updatedToolData )
. then ( response => response . json ())
. then ( data => console . log ( data ))
. catch ( error => console . error ( ' Error: ' , error ));
Response
"toolId" : " 7f1e3b78-c71e-4b1f-9c4a-b83f7683f0d2 " ,
"name" : " stock_price_v2 " ,
"created" : " 2024-09-18T14:15:22Z " ,
"description" : " Get the current stock price and company info for a given symbol " ,
"location" : " PARAMETER_LOCATION_QUERY " ,
"description" : " Stock symbol (e.g., AAPL for Apple Inc.) "
"baseUrlPattern" : " https://api.stockmarket.com/v2/price-and-info " ,