Introduction
Cartesia Line is an SDK for building low-latency voice agents. Pairing Line with Tavily gives your voice agent live web access — use Tavily Search for fast, voice-friendly lookups and Tavily Extract for deep-dives into specific pages. A complete reference implementation lives in the Cartesia Line repo.Step-by-Step Integration Guide
Step 1: Install Required Packages
Step 2: Set Up API Keys
- Tavily API Key: Get your Tavily API key here
- OpenAI API Key: Get your OpenAI API key here
.env file:
Step 3: Define Tavily Tools
Wrap Tavily’sAsyncTavilyClient in two @loopback_tool functions so the voice agent can call them mid-conversation. Reusing a single AsyncTavilyClient across calls keeps the underlying HTTP session warm, which matters for latency on a live call.
Step 4: Wire the Tools into a Voice Agent
Ensure you have the Cartesia CLI installed. Please refer to the Cartesia CLI documentation for more information.
Choosing a Search Depth
Voice agents are latency-sensitive. Tavily exposes four search depths — for live calls, we recommend usingfast or ultra-fast.
| Depth | Latency | Content Type | Cost | Best For |
|---|---|---|---|---|
ultra-fast | Lowest | NLP summary per URL | 1 credit | Voice agents, real-time chat |
fast | Low | Reranked chunks per URL | 1 credit | Chunk-based results with low latency |
basic | Medium | NLP summary per URL | 1 credit | General-purpose search |
advanced | Higher | Reranked chunks per URL | 2 credits | Precision-critical queries |
Additional Parameters
Extendweb_search with any of Tavily’s search parameters:
time_range—"day","week","month", or"year"for recency filteringinclude_domains/exclude_domains— restrict or block specific sourcesinclude_answer—"basic"or"advanced"for an LLM-generated answer alongside results
web_extract, the most useful knobs are:
extract_depth—"basic"(default) or"advanced"for tables and embedded contentformat—"markdown"(default) or"text"
Benefits of Tavily + Cartesia
- Voice-optimized latency:
fastandultra-fastsearch depths keep round-trips short enough for live conversation. - Fresh context: Voice agents can answer questions about today’s news, prices, and events without retraining.
- Targeted deep-dives: Providing URLs to
web_extractallows the agent to pull full-page content when a snippet isn’t enough.