Overview
Voice agents built in n8n lack real-time knowledge because the underlying LLM has a fixed training cutoff. This workflow adds a search enrichment step to n8n voice agent pipelines: when the agent encounters a factual question, n8n triggers an HTTP Request node to Scavio, retrieves structured results, and injects them into the agent's context before it responds. Latency stays under 3 seconds, fitting within natural conversation pauses.
Trigger
Webhook from voice agent platform (Vapi, Retell) when factual question detected
Schedule
On demand (webhook trigger)
Workflow Steps
Receive voice agent query
n8n webhook receives the transcribed question from the voice agent platform along with session context.
Classify query type
Use an IF node to check if the query requires real-time data (prices, hours, news) or can be answered from training data.
Search for current data
For real-time queries, call Scavio's API via HTTP Request node. Choose platform based on query type (Google for general, Amazon for products).
Format for voice response
Extract the most relevant snippet and format it as a speakable response under 200 characters.
Return enriched context
Send the formatted search result back to the voice agent platform to include in the LLM's context for response generation.
Python Implementation
# n8n HTTP Request node configuration:
# Method: POST
# URL: https://api.scavio.dev/api/v1/search
# Headers: x-api-key = {{$credentials.scavioApiKey}}
# Body: {"platform": "google", "query": "{{$json.transcribed_question}}"}
#
# n8n Function node to format for voice:
# const r = $input.first().json;
# const aio = r.ai_overview;
# let answer = '';
# if (aio && aio.text) {
# answer = aio.text.substring(0, 200);
# } else if (r.organic && r.organic.length > 0) {
# answer = r.organic[0].snippet.substring(0, 200);
# }
# return [{ json: { voice_response: answer } }];
# Python equivalent for testing:
import requests, os
H = {"x-api-key": os.environ["SCAVIO_API_KEY"]}
def voice_search(question, platform="google"):
r = requests.post("https://api.scavio.dev/api/v1/search", headers=H,
json={"platform": platform, "query": question, "ai_overview": True}, timeout=5).json()
aio = r.get("ai_overview")
if aio and aio.get("text"):
return aio["text"][:200]
organic = r.get("organic", [])
if organic:
return organic[0].get("snippet", "")[:200]
return "I could not find that information right now."
print(voice_search("what is the current price of bitcoin"))JavaScript Implementation
const H = {"x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json"};
async function voiceSearch(question, platform = "google") {
const r = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST", headers: H,
body: JSON.stringify({platform, query: question, ai_overview: true})
}).then(r => r.json());
if (r.ai_overview?.text) return r.ai_overview.text.slice(0, 200);
const top = (r.organic || [])[0];
return top ? (top.snippet || "").slice(0, 200) : "I could not find that information right now.";
}Platforms Used
Web search with knowledge graph, PAA, and AI overviews
Amazon
Product search with prices, ratings, and reviews
Community, posts & threaded comments from any subreddit