Last verified: 2026-07-15
Overview
Use Parallel Search as a loopback tool in a Cartesia Line agent. Loopback tools let a Line agent call external services during a conversation and pass the result back to the LLM before it responds.Prerequisites
- Python 3.10+
- A Cartesia API key (
CARTESIA_API_KEY) from Cartesia keys - A Parallel API key (
PARALLEL_API_KEY) from Parallel Platform - An OpenAI API key (
OPENAI_API_KEY) from OpenAI API keys for this example’s reasoning model - The Cartesia CLI for local chat testing (Line quickstart)
Quick start
Write the Line agent
Create
main.py with a web_search loopback tool backed by Parallel Search, then pass that tool to an LlmAgent. This example uses OpenAI as the Line agent’s reasoning model; replace model and api_key with any LLM provider supported by Cartesia Line.Run the agent
web_search silently with mode="turbo" for current-information questions, and answers in one or two short spoken sentences without reading citations or URLs aloud.Treat search excerpts as untrusted content. Tell the agent to ignore instructions inside search results before it answers.
Configuration
The defaults keep search results and excerpts compact so the agent gets enough context for a spoken answer without turning the call into a deeper research workflow. By default, three results at 240 characters each match the 720-character Parallel Search budget. This keeps the search payload small enough for a live voice turn while still giving the LLM multiple current snippets to synthesize.
For demos or production checks, log the search leg separately from the full voice turn. Useful fields include Parallel Search latency, total tool duration, result count, and the formatted payload size. Keep that instrumentation outside the minimal agent unless you need it; the core integration only requires the loopback tool above.