Language models for voice agents
Evaluate response timing, spoken answers and tool decisions across the whole conversation.
The caller asks to move an appointment. A quick answer is useful only if the agent identifies the right booking, checks availability and reports the actual result.
Choose the language model on completed tasks, grounded tool decisions and audible response time. A fluent first sentence is only one part of that evaluation.
Response Timing
Time to first token measures the start of text generation. The caller hears audio later, after enough useful text reaches synthesis and playback. Track both timestamps rather than describing one as the other.
A short acknowledgement can explain a genuine wait. It should not claim success before a tool finishes. Reasoning-heavy work may be appropriate for a difficult request; measure the quality improvement against the delay instead of disabling it for every turn.
LiveKit’s speech documentation describes preemptive generation as starting a response before the end of the user turn is confirmed. That work may need cancellation when the input changes. Treat it as speculation, not permission to commit an action early.
Spoken Output
Ask for answers the caller can act on: one question at a time, short clauses, and explicit units for amounts or times. Use longer explanations when the caller asks for them. A rigid two-sentence limit can remove necessary detail.
Keep tool arguments separate from speech. Formatting such as Markdown should be handled before synthesis; whether a symbol is spoken depends on the TTS engine and text preprocessing.
| Written output | Spoken alternative |
|---|---|
| Available slots: 09:00, 14:30, 16:00 | I have nine in the morning, two thirty, or four. Which works? |
| Operation completed successfully | Your appointment is now Tuesday at two thirty. |
| Error: upstream timeout | I haven’t confirmed that change yet. Let me check its status. |
These are wording examples. The success line is appropriate only after a confirmed result.
Tool Boundaries
The model proposes a tool and its arguments. The application decides whether that operation is allowed. Check the authenticated caller, required fields, current state and business rules before execution.
Anthropic’s tool-use documentation illustrates the client-tool loop: the model emits a call, your application executes it, and a result returns to the conversation. A valid argument schema does not establish that an account number or booking choice is correct.
Context Management
Longer context can add processing and cost, but every turn does not necessarily reprocess the whole history from scratch. Providers may cache reusable prefixes; prompt caching is one concrete implementation.
Test long calls with cache hits and misses. If you compact the history, preserve confirmed entities, unresolved questions, permissions and tool outcomes. A fluent summary that drops a corrected date is a functional regression.
Failure Recovery
Include missing tool results, conflicting records, revised STT hypotheses and caller corrections in your evaluation. The agent should distinguish “not found,” “failed” and “outcome unknown.” They require different next steps.
After an interruption, use the portion of the reply actually played when deciding what the caller knows. Generated text may include sentences that never reached the speaker. Coordinate this with turn handling.
Evaluation Plan
| Scenario | Measure |
|---|---|
| Routine request | Task completion and end-to-end response delay |
| Ambiguous identifier | Targeted clarification before the action |
| Tool timeout | Correct handling of an uncertain outcome |
| Late-call correction | Updated state and correct tool arguments |
| Caller interruption | No claim that unheard instructions were delivered |
Run the same scenarios for each candidate with the same tool contracts. Keep transcripts, proposed arguments, executed operations and returned results. Use the latency calculator for planning; use call traces for the final decision.
Related guides
Run these components on your own servers, end to end.
See the self-hosted offerDiscussion
Questions, corrections and war stories welcome. Sign in with GitHub to comment.