Skip to main content
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

Quick start

1

Install the packages

2

Set environment variables

3

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.
4

Run the agent

The agent greets you, calls 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.
5

Ask a current-information question

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.

Resources