A multi-source research agent searches Google, Reddit, and YouTube for a topic using the Scavio search API's platform parameter, combines the results into a unified context, and generates a research brief using an LLM.
Prerequisites
- Python 3.9+
- Scavio API key
- anthropic SDK
Walkthrough
Step 1: Define per-platform search functions
Each platform call uses the same endpoint with a different platform value.
import requests
API_KEY = "your-scavio-api-key"
def search(query: str, platform: str = "google", n: int = 5) -> list:
r = requests.post(
"https://api.scavio.dev/api/v1/search",
json={"query": query, "platform": platform, "num_results": n},
headers={"x-api-key": API_KEY},
timeout=15
)
r.raise_for_status()
return r.json().get("organic_results", [])
search_google = lambda q, n=5: search(q, "google", n)
search_reddit = lambda q, n=5: search(q, "reddit", n)
search_youtube = lambda q, n=5: search(q, "youtube", n)Step 2: Gather multi-source results
Run three searches in parallel using ThreadPoolExecutor.
from concurrent.futures import ThreadPoolExecutor, as_completed
def gather_sources(topic: str) -> dict:
sources = {}
tasks = {
"google": (topic + " overview",),
"reddit": (topic + " discussion",),
"youtube": (topic + " tutorial",)
}
with ThreadPoolExecutor(max_workers=3) as executor:
futures = {
executor.submit(search, query, platform): platform
for platform, (query,) in tasks.items()
}
for future in as_completed(futures):
platform = futures[future]
try:
sources[platform] = future.result()
except Exception as e:
sources[platform] = []
print(f"{platform} search failed: {e}")
return sourcesStep 3: Format and generate research brief
Combine results into a context block and prompt Claude for a structured brief.
import anthropic
ANTHROPIC_KEY = "your-anthropic-key"
def format_sources(sources: dict) -> str:
lines = []
for platform, results in sources.items():
lines.append(f"\n### {platform.upper()}")
for r in results[:3]:
lines.append(f"- {r.get('title')}\n {r.get('snippet','')[:150]}")
return "\n".join(lines)
def research_brief(topic: str) -> str:
sources = gather_sources(topic)
context = format_sources(sources)
prompt = f"""Based on these multi-source search results about '{topic}', write a research brief with:
1. Key findings (3 bullets)
2. Community sentiment from Reddit
3. Top learning resources from YouTube
{context}
Brief:"""
client = anthropic.Anthropic(api_key=ANTHROPIC_KEY)
msg = client.messages.create(model="claude-sonnet-4-6", max_tokens=1024,
messages=[{"role": "user", "content": prompt}])
return msg.content[0].text
print(research_brief("vector databases 2026"))Python Example
import requests
import anthropic
from concurrent.futures import ThreadPoolExecutor, as_completed
SCAVIO_KEY = "your-scavio-api-key"
ANTHROPIC_KEY = "your-anthropic-key"
def search(query, platform="google", n=5):
r = requests.post("https://api.scavio.dev/api/v1/search",
json={"query": query, "platform": platform, "num_results": n},
headers={"x-api-key": SCAVIO_KEY}, timeout=15)
r.raise_for_status()
return r.json().get("organic_results", [])
def gather(topic):
tasks = {"google": f"{topic} overview", "reddit": f"{topic} discussion", "youtube": f"{topic} tutorial"}
results = {}
with ThreadPoolExecutor(max_workers=3) as ex:
futures = {ex.submit(search, q, p): p for p, q in tasks.items()}
for f in as_completed(futures):
p = futures[f]
results[p] = f.result() if not f.exception() else []
return results
def format_ctx(sources):
parts = []
for p, items in sources.items():
parts.append(f"\n### {p.upper()}")
parts.extend(f"- {i.get('title')}\n {i.get('snippet','')[:120]}" for i in items[:3])
return "\n".join(parts)
def research_brief(topic):
sources = gather(topic)
ctx = format_ctx(sources)
prompt = f"Research brief for '{topic}':\n\n{ctx}\n\nWrite: 1) Key findings 2) Reddit sentiment 3) YouTube resources"
client = anthropic.Anthropic(api_key=ANTHROPIC_KEY)
msg = client.messages.create(model="claude-sonnet-4-6", max_tokens=1024,
messages=[{"role": "user", "content": prompt}])
return msg.content[0].text
if __name__ == "__main__":
print(research_brief("vector databases 2026"))JavaScript Example
const SCAVIO_KEY = 'your-scavio-api-key';
async function search(query, platform = 'google', n = 5) {
const res = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': SCAVIO_KEY },
body: JSON.stringify({ query, platform, num_results: n })
});
const data = await res.json();
return data.organic_results ?? [];
}
async function gatherSources(topic) {
const [google, reddit, youtube] = await Promise.all([
search(`${topic} overview`, 'google'),
search(`${topic} discussion`, 'reddit'),
search(`${topic} tutorial`, 'youtube')
]);
return { google, reddit, youtube };
}
const sources = await gatherSources('vector databases 2026');
for (const [platform, results] of Object.entries(sources)) {
console.log(`\n${platform.toUpperCase()}:`);
for (const r of results.slice(0, 2)) console.log(` - ${r.title}`);
}Expected Output
Research Brief: vector databases 2026
**Key Findings**
- Pinecone and Weaviate dominate production deployments; Qdrant gaining share for performance-sensitive use cases
- pgvector usage increased significantly as teams prefer staying in PostgreSQL
- Hybrid search (vector + keyword) is now standard; pure vector search is declining
**Reddit Sentiment**
Reddit discussions show frustration with vendor lock-in. r/MachineLearning and r/LocalLLaMA prefer self-hosted options (Qdrant, Chroma). Cost is the top concern.
**YouTube Resources**
- "Vector Databases Explained" by Fireship (2.3M views)
- "Qdrant Tutorial 2026" by TechWithTim (890K views)