Tutorial

How to Feed Search Data into an n8n Voice Agent

Connect the Scavio search API to an n8n voice agent workflow so it can answer caller questions with live web data. Step-by-step n8n setup.

Feed live search data into an n8n voice agent by adding an HTTP Request node that calls the Scavio API whenever the agent needs current information to answer a caller's question. Voice agents without live data access are limited to their training cutoff and cannot answer questions about current pricing, availability, or events. This tutorial builds an n8n workflow that intercepts the agent's tool-call requests, executes a search, and returns the results as context for the voice response.

Prerequisites

  • n8n instance running (self-hosted or cloud)
  • A Scavio API key from scavio.dev
  • An n8n voice agent workflow (Twilio, VAPI, or similar)
  • Basic familiarity with n8n workflow builder

Walkthrough

Step 1: Add the HTTP Request node for search

Create an HTTP Request node in your n8n workflow that calls the Scavio API with the caller's question.

JSON
// n8n HTTP Request node configuration:
// Method: POST
// URL: https://api.scavio.dev/api/v1/search
// Authentication: Header Auth
//   Header Name: x-api-key
//   Header Value: {{ $env.SCAVIO_API_KEY }}
// Body (JSON):
{
  "platform": "google",
  "query": "{{ $json.caller_query }}"
}

Step 2: Parse search results for voice context

Add a Code node that extracts the top 3 snippets and formats them as concise voice-friendly text.

JavaScript
// n8n Code node (JavaScript):
const results = $input.first().json.organic_results || [];
const topResults = results.slice(0, 3).map(r => ({
  title: r.title,
  snippet: r.snippet || '',
  url: r.link
}));

const voiceContext = topResults
  .map(r => `${r.title}: ${r.snippet}`)
  .join('. ');

return [{ json: { voiceContext, resultCount: topResults.length, results: topResults } }];

Step 3: Inject context into the voice agent prompt

Pass the search context to the AI agent node as additional system context for generating the voice response.

Python
// n8n AI Agent node system prompt:
// You are a helpful voice assistant. Use the following live web context
// to answer the caller's question accurately.
//
// Live context: {{ $json.voiceContext }}
//
// Rules:
// - Keep responses under 30 seconds of speech
// - Cite the source if quoting specific data
// - If the context does not answer the question, say so honestly

// Python equivalent for testing the search step:
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}
data = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
    json={'platform': 'google', 'query': 'current weather Austin TX'}).json()
snippets = [r.get('snippet', '') for r in data.get('organic_results', [])[:3]]
print(' '.join(snippets))

Step 4: Test the end-to-end flow

Trigger a test call and verify the voice agent uses live search data in its response.

Python
# Test via n8n manual execution or webhook:
# 1. Set caller_query to a time-sensitive question
# 2. Run the workflow
# 3. Verify the search node returns results
# 4. Verify the voice context is injected

import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}

def test_voice_search(query: str) -> str:
    data = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
        json={'platform': 'google', 'query': query}, timeout=10).json()
    results = data.get('organic_results', [])[:3]
    voice_text = '. '.join(r.get('snippet', '') for r in results if r.get('snippet'))
    return voice_text[:500]

print(test_voice_search('current weather Austin TX'))

Python Example

Python
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}

def voice_context(query):
    data = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
        json={'platform': 'google', 'query': query}).json()
    snippets = [r.get('snippet', '') for r in data.get('organic_results', [])[:3]]
    return '. '.join(s for s in snippets if s)

print(voice_context('current weather Austin TX'))

JavaScript Example

JavaScript
const H = {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'};
async function voiceContext(query) {
  const r = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST', headers: H, body: JSON.stringify({platform: 'google', query})
  });
  const results = (await r.json()).organic_results || [];
  return results.slice(0, 3).map(r => r.snippet || '').filter(Boolean).join('. ');
}
voiceContext('current weather Austin TX').then(console.log);

Expected Output

JSON
An n8n workflow where the voice agent receives live search context from Scavio before generating each response, enabling real-time answers to caller questions.

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

n8n instance running (self-hosted or cloud). A Scavio API key from scavio.dev. An n8n voice agent workflow (Twilio, VAPI, or similar). Basic familiarity with n8n workflow builder. A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Connect the Scavio search API to an n8n voice agent workflow so it can answer caller questions with live web data. Step-by-step n8n setup.