Skip to main content
New to tool calling? Start with the Tools overview and Tool Calling for LLM. This page focuses on best practices for building reliable tool integrations. Maintaining legacy inline tools? See Legacy inline tool calling.

How Tavus tool calls work

A tool dispatches over exactly one channel, set per tool via the delivery field - see Tool Delivery:
  • App message (default) - the call arrives in your frontend as a conversation.tool_call event; your app runs the logic and sends a conversation.tool_result event back.
  • API call (HTTP) - Tavus makes an HTTPS request to an endpoint you configure; your backend runs the logic and returns the result in the HTTP response.
What the PAL does with the result - speak it, summarize it, absorb it silently, or ignore it - is set by the tool’s on_resolve, independent of which channel delivered the call. App-message flow:
API (HTTP) flow:
With app-message delivery, Tavus does not run the tool for you - your frontend handles conversation.tool_call events and runs your own logic. With API delivery, Tavus calls your endpoint directly, so no frontend handling is needed. Pick one per tool; see Tool Delivery.
Because Tavus agents operate in live conversational environments, tool design should prioritize reliability, clarity, and conversational continuity. Below are the six most important principles for building effective tool integrations.

1. Keep Tool Schemas Clear and Explicit

Tool definitions should be as clear and specific as possible. Ambiguous parameters make it harder for the model to choose and populate tools correctly. Prefer narrow tools with explicit parameters. Bad:
Better:
Clear schemas reduce incorrect tool usage and improve consistency.

2. Separate Read Tools from Write Tools

Tools generally fall into two categories. Read tools retrieve information and are safe to call frequently. Examples:
  • retrieving account data
  • searching knowledge bases
  • checking order status
Write tools modify system state. Examples:
  • creating support tickets
  • sending emails
  • updating records
Write tools should only run when user intent is clear and parameters are validated.

3. Keep Tool Results Small

Whatever you return - the output of a conversation.tool_result (app message) or the body of your HTTP response (API) - is injected back into the model’s context. Large payloads increase token usage and can degrade conversational quality. Return only the fields needed for the next response:
This keeps conversations efficient and improves response quality.

4. Avoid Triggering Tools Too Early

Tavus agents operate in real-time conversations where users may interrupt or revise their requests. If a tool executes too early, it may perform the wrong action. The LLM does not truly know intent is clear. You make “intent is clear” operational by defining concrete criteria such as:
  • required slots are present (for example, email, issue_type, etc.)
  • no unresolved ambiguity (for example, “today or tomorrow?”)
  • user gave explicit confirmation for write actions (for example, “yes, submit it”)
Best practice:
  • wait until the user’s intent is clear
  • avoid executing write actions mid-sentence
  • allow the conversation to stabilize before triggering tools

Add the following policy to your PAL’s system prompt to improve tool-call quality and safety:

5. Log Tool Calls for Observability

Production systems should log tool activity so issues can be debugged easily. For app-message delivery, listen to Tavus app-events (Daily app-message events) for end-to-end observability. For API delivery, log on your backend. Either way, you can trace the full lifecycle:
  • when the conversation.tool_call (or HTTPS request) fired
  • what payload was received
  • what your app executed
  • what result you returned (the conversation.tool_result output or the HTTP response body)
At minimum, log:
  • conversation_id
  • tool_call_id
  • tool_name
  • parameters
  • execution result
  • status (success / error)
  • timestamp
This helps identify duplicate calls, incorrect parameters, or unexpected behavior during conversations.

6. Return Results Back to the Conversation

After executing a tool call, return the result so the LLM can use it. How you return it depends on the delivery channel; what the PAL does with it is controlled by the tool’s on_resolve.

App-message delivery

The call arrives as a conversation.tool_call event carrying a tool_call_id:
properties.arguments is a JSON string - parse it to read the parameters. Execute your logic, then send a conversation.tool_result back with the matching tool_call_id:
If your client never sends a result, the dispatch eventually drops out of context - the PAL just won’t have the data.

API (HTTP) delivery

Tavus calls your configured HTTPS endpoint with the tool arguments; you return the result in the response. A 2xx is treated as success and the response body becomes the tool result; non-2xx is marked error. There’s nothing to send back over the data channel - see Tool Delivery for the request/response shapes, retries, and signature verification.

Controlling What the PAL does with the result

Set the tool’s on_resolve (it applies to both channels): See the on_resolve reference for full details.

Example Implementation

For a complete working example of how to implement tool calling with Tavus, see the official example repository: https://github.com/Tavus-Engineering/tavus-examples/tree/main/examples/cvi-tool-calling This example demonstrates how to:
  • Create tools and attach them to a PAL
  • Listen for conversation.tool_call events
  • Execute backend logic when a tool is triggered
  • Return results with conversation.tool_result