Skip to main content

Custom Functions

Custom functions let your voice agents call external HTTP endpoints mid-conversation. When the agent determines it needs to perform an action — check the weather, book an appointment, look up an order — it invokes a function you’ve defined, waits for the response, and continues the conversation with that data.

How it works

  1. You define a function with a name, description, URL, and input/output schema
  2. You attach it to an agent
  3. During a voice call, the agent’s LLM reads the description and decides when to call it
  4. The bot sends a POST request to your URL with the input parameters
  5. Your endpoint responds with data
  6. The agent uses that data to continue the conversation

Create a function

Response
Header values are encrypted at rest and never returned by the API. Only header_keys (the key names) appear in responses.

Function fields

Schema fields

Each entry in input_schema or output_schema:
The description field on the function is the most important part. The LLM uses it to decide when to call the function. Be explicit: “Call this when the user asks about order status” is better than “Get order info”.

Reserved function names

These names are used by built-in integrations and cannot be used: knowledge_base_search, calendar_create_event, calendar_list_events, calendar_update_event, calendar_delete_event, gmail_send_email, gmail_search_emails, slack_send_message, slack_list_channels, add_to_cart, view_cart, clear_cart, checkout

Attach a function to an agent

After creating a function, attach it to one or more agents:
Response

Enable or disable a function for an agent

Functions are enabled by default when attached. Toggle with enabled:
cURL
Response

Detach a function from an agent

cURL
Returns 204 No Content on success.

List functions on an agent

See all functions currently active on an agent:
cURL
Response

Manage functions

List all your functions

cURL

Get a single function

cURL

Update a function

All fields are optional — only provided fields are updated.
cURL

Delete a function

cURL
Returns 204 No Content. Deleting a function automatically detaches it from all agents.

Full lifecycle example


Building your function endpoint

Your endpoint receives a POST request from the bot with the input fields in the body:
Respond with a JSON object matching your output_schema:
Requirements:
  • Must respond within the configured timeout (default 30 seconds)
  • Must return valid JSON
  • Must return a 2xx status code
  • HTTPS required in production
If your endpoint fails (timeout, non-2xx, invalid JSON), the bot says the error_message and continues the conversation.

Error responses


Tips

Write clear descriptions. The description is the #1 factor in whether the agent calls the function at the right time. Include specific trigger phrases: “Call this when the user asks about their order status or delivery date.”
  • Keep timeouts short. Users are waiting in real-time. A 10-second timeout feels like an eternity in a voice conversation.
  • Use started_messages. They fill the silence while your endpoint processes. Without them, there is dead air.
  • One function, many agents. Create a function once and attach it to as many agents as you need.

Next steps

Quick Start

Create an agent to attach functions to.

Knowledge Base

Give your agent document context alongside custom functions.