Tools
Tools let an agent do something mid-conversation — look up data, notify your backend, hand off to a human, or hang up. They work the same on phone calls and the Voice Socket.
The two tool types you define
| Type | What it does | Does the agent wait? |
|---|---|---|
| Function | Calls your HTTP endpoint and speaks the reply. | Yes — it pauses, calls you, then answers with your data. |
| Event | Fire-and-forget ping to your backend. The agent keeps talking. | No |
(Transferring to a human and ending the call are built-in — those live in the agent's actions, not here.)
Define a tool
Tools go in the tools array of your agent config.
A Function tool — the agent fills argsSchema, you reply, the agent speaks your reply:
{
"name": "lookup_order",
"type": "function",
"description": "Look up an order's status. Use when the caller asks about their order.",
"argsSchema": { "orderId": "the caller's order number" },
"handlerUrl": "https://yourapp.com/tools/lookup-order"
}An Event tool — fire-and-forget, no reply expected:
{
"name": "log_complaint",
"type": "event",
"description": "Record a complaint. Use when the caller is unhappy.",
"argsSchema": { "reason": "what they're unhappy about" }
}| Field | Required | What |
|---|---|---|
name |
yes | The tool name the agent calls. |
type |
yes | function or event. |
description |
yes | When to use it — the agent reads this to decide. |
argsSchema |
no | A { field: hint } map. The hint describes the field; the agent fills the value. |
handlerUrl |
function only | Your HTTPS endpoint. We POST the args; you reply with JSON. |
Saved agents get their tools from your dashboard instead. Inline agents carry tools in the config as shown here. See Inline agents.
Where you see tool activity
The same tool call can show up in three places. They all share an id so you can match the start to the result.
1. Live, on the Voice Socket
Two frames — one when it starts, one when it finishes:
{ "v": 1, "type": "tool.called", "id": "t1", "name": "lookup_order", "args": { "orderId": "1234" } }
{ "v": 1, "type": "tool.completed", "id": "t1", "name": "lookup_order", "result": { "ok": true, "data": { "status": "shipped" } } }Match them by id. A slow Function tool's tool.completed can arrive after later speech frames — don't assume it comes right after tool.called. See the Protocol reference.
2. In the transcript (call history & `call.ended`)
Tool calls are saved into the transcript you get from GET /v1/calls/{sessionId} and the call.ended webhook. They appear as role: "tool" entries — a call and its paired result:
[
{ "role": "user", "text": "What's my subscription?", "timestamp": "2026-06-13T19:40:33.924Z" },
{ "role": "assistant", "text": "One moment.", "timestamp": "2026-06-13T19:40:33.924Z" },
{
"role": "tool", "event": "call",
"id": "ae01cbd8", "name": "check_subscription", "tool_type": "function",
"args": { "name": "Anshuman" },
"timestamp": "2026-06-13T19:40:33.924Z"
},
{
"role": "tool", "event": "result",
"id": "ae01cbd8", "name": "check_subscription",
"ok": true, "result": { "plan": "pro", "renews": "2026-07-01" },
"timestamp": "2026-06-13T19:40:34.512Z"
}
]The call entry carries name, tool_type (function / event / control), and args. The result entry carries ok, plus result (on success) or error (on failure). Both share the id.
3. Event tools — a webhook
An Event tool also fires a tool_call webhook to your endpoint, so your backend can react in real time. See Webhooks.
Results & errors
ok |
Meaning |
|---|---|
true |
It ran. result holds the output, if any. |
false |
It failed. error holds the reason. |
Common errors:
error |
Meaning |
|---|---|
unknown_tool |
The agent called a name that isn't defined on it. Check the name matches. |
unsupported_channel |
A built-in action was used where it can't run (e.g. transfer on a socket). |
event_dispatch_failed |
An Event tool's webhook couldn't be queued. |
A failed tool never crashes the call — the agent is told it failed and keeps going.
Good to know
- Match by
id, never by order — a result can arrive late. - Args and results are saved in the transcript and sent in
call.ended. Don't return secrets you don't want stored.
