rokan

Why does my voice agent read its tool call out loud?

Callers hear things like “check availability, date, twenty twenty-six” or “open brace”. It usually comes from one of three places: the sentence the agent speaks while a function runs is empty or vague, the model writes its reasoning or the call as text, or a model switch changed how it formats tool calls. When in the call it happens, and when it started, tell you which.

Updated · General advice for any voice platform · 6 min read

The symptom

The agent speaks part of a function call instead of a normal sentence. Common versions:

  • The function’s name, read as words: “book appointment”, “get caller info”, sometimes with the underscores dropped.
  • Argument names and values: “start time, ten AM, phone number, …”.
  • Raw JSON or symbols: “open curly brace”, “quote name quote colon”.
  • Its own plan: “I need to call the lookup tool with the caller’s postcode.”

It often happens on some calls and not others, which makes it easy to miss in testing and easy to hear about first from a customer.

How to tell which step causes it

Open a few affected calls and look at where the leaked words sit, and whether the function actually ran.

Match what you see to the likely cause
What you seeLikely cause
The leak is spoken while the function is running, right before its result comes back, and the function did runThe waiting message. It is empty, or a vague instruction like “tell the user what you are doing”, so the model fills it by describing the call.
The leak is in a normal reply, and at that moment the function never ran (no tool call in the log)The model wrote the call or its plan as text instead of using native function calling.
Calls were clean until a certain day, then the leak appeared on many of themA change: a different model or model version, a new prompt, or a new function. Line the first affected call up against your change history.

Two more things to check while you are there. If your prompt shows function names or JSON examples in the part that tells the agent what to say, the model can repeat them. And if the leak only follows one function, look at that function’s description: a description written as a sentence to the caller can be read out as one.

Fixes to try

If it is the waiting message

  • Give it real words. Use a fixed sentence such as “One moment while I check that for you.” A fixed sentence cannot leak anything. Retell calls this setting Talk While Waiting, with a choice of a generated prompt or a fixed sentence (Retell docs); other platforms have a similar per-function message.
  • If it has to be generated, say exactly what it may contain: “One short, plain sentence telling the caller you are checking. Never say function names, field names, codes, numbers from the request or symbols.”
  • Or say nothing. For fast functions, a short pause or a typing sound can be better than words.

If the model leaks its reasoning or writes the call as text

  • Use the platform’s native function calling, not instructions that ask the model to print a call in a format.
  • Add a plain rule to the prompt: “Never say function names, parameter names, IDs, JSON or code out loud. Speak only to the caller.”
  • Keep JSON examples and function identifiers out of the parts of the prompt that describe what to say.
  • If you run your own model server, add a last check before speech: hold back any reply that contains braces or one of your exact function or argument names, and replace it with a safe line.

If it started with a model switch

  • Pin the model version you tested, so it does not change under you.
  • Run the same conversations through the old and the new model before moving every customer, and roll back if only the new one leaks.

Find every affected call in an export

Before you change anything, count how big the problem is. Export your calls with transcripts, then search only the agent’s turns for:

  1. Every function name, exactly, with the underscores and with them replaced by spaces (the model sometimes writes the name as plain words, like “book appointment”).
  2. Every argument name, such as start_time or caller_phone.
  3. Symbols that never belong in speech: {, }, and a quoted key followed by a colon, like "name":.

A short script does it. Rename the fields to match your export; this one expects a JSON list of calls, each with an id and a list of turns that have a role and text.

import json, re, sys

FUNCTIONS = ["book_appointment", "check_availability"]  # your function names
ARGUMENTS = ["start_time", "caller_phone"]              # your argument names

words = FUNCTIONS + ARGUMENTS
words += [w.replace("_", " ") for w in words]
leak = re.compile(r'[{}]|"\w+"\s*:|\b(' + "|".join(map(re.escape, words)) + r')\b', re.I)

calls = json.load(open(sys.argv[1]))
hits = [c["id"] for c in calls
        if any(t["role"] == "agent" and leak.search(t["text"]) for t in c["turns"])]
print(len(hits), "of", len(calls), "calls")
print("\n".join(hits))

Listen to a handful of the hits. Spaced-out names can match ordinary speech (“check availability” is a normal thing to say), so drop any word that gives false hits and keep the exact identifiers.

Check the fix worked on past calls

  1. Keep the list. The calls the search found are your test set, along with the count from before the fix.
  2. Replay them. Run the callers’ side of those conversations against the changed prompt or settings, and run the same search on the new agent turns. The target is zero hits.
  3. Check the function still runs. A fix that stops the leak by stopping the call is not a fix. In each replay, the function should still be called with the right arguments.
  4. Replay some clean calls too. Take calls that had no leak and make sure they still behave the same.
  5. Keep the search running. After the change goes live, run it on each day’s calls and compare against the rate before the fix.

Short answers

Why does my voice agent say the function name to the caller?

Usually one of three things: the message the agent speaks while a function runs is empty or vague, so the model describes the call itself; the model writes its plan or the call as plain text instead of using native function calling; or the behaviour started after a change of model. Check when in the call it happens and when it started to tell which.

How do I find every call where the agent read out a tool call?

Export your calls and search only the agent’s turns for your exact function names, your argument names, curly braces and quoted keys followed by a colon. Every hit is a call to listen to. Run the same search after the fix to compare.

Will a fixed waiting sentence stop the leak?

It removes the most common cause, because the model no longer has to make up what to say while the function runs. It does not stop leaks from reasoning in the main reply or from a model change, so keep the prompt rule and the transcript search as well.

How Rokan handles it

Rokan reads your exported calls, lines up what the caller said with what the agent did, finds where it went wrong, writes the fix and tests it on your past calls before you approve it. Its replay re-tests the prompt and rules, not your speech-to-text.