Large language models hallucinate when they lack current information. Grounding AI agents with real-time search data solves this by providing verified, up-to-date facts at inference time. Scavio's API returns structured search results from Google, Amazon, YouTube, Walmart, and Reddit through a single integration. Use it as a tool in LangChain, CrewAI, or any agent framework to give your AI access to live web data.
API Endpoint
POST https://api.scavio.dev/api/v1/searchPython Example
import requests
API_KEY = "YOUR_API_KEY"
def search_web(query: str, country: str = "us") -> dict:
"""Tool function for AI agent grounding."""
response = requests.post(
"https://api.scavio.dev/api/v1/search",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={"query": query, "country_code": country},
)
response.raise_for_status()
data = response.json()
# Format results for the LLM context window
results = []
for r in data.get("organic_results", [])[:5]:
results.append({
"title": r["title"],
"snippet": r.get("snippet", ""),
"url": r["link"],
})
# Include knowledge graph if available
kg = data.get("knowledge_graph")
if kg:
results.insert(0, {
"title": kg.get("title", ""),
"snippet": kg.get("description", ""),
"url": kg.get("website", ""),
"type": "knowledge_graph",
})
return {"query": query, "results": results}
# Example: ground a question
context = search_web("latest openai o3 model capabilities")
print(f"Found {len(context['results'])} grounding results")JavaScript Example
const API_KEY = "YOUR_API_KEY";
async function searchWeb(query, country = "us") {
const response = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query, country_code: country }),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
// Format results for the LLM context window
const results = (data.organic_results || []).slice(0, 5).map((r) => ({
title: r.title,
snippet: r.snippet || "",
url: r.link,
}));
// Include knowledge graph if available
if (data.knowledge_graph) {
results.unshift({
title: data.knowledge_graph.title || "",
snippet: data.knowledge_graph.description || "",
url: data.knowledge_graph.website || "",
type: "knowledge_graph",
});
}
return { query, results };
}
// Example: ground a question
const context = await searchWeb("latest openai o3 model capabilities");
console.log(`Found ${context.results.length} grounding results`);Expected Response
{
"search_metadata": {
"status": "success",
"query": "latest openai o3 model capabilities",
"country_code": "us"
},
"knowledge_graph": {
"title": "OpenAI o3",
"type": "AI model",
"description": "o3 is OpenAI's latest reasoning model released in 2025, featuring advanced multi-step reasoning capabilities."
},
"organic_results": [
{
"position": 1,
"title": "OpenAI o3: Capabilities, Benchmarks, and What's New",
"link": "https://example.com/openai-o3-review",
"snippet": "OpenAI o3 achieves state-of-the-art performance on ARC-AGI, GPQA, and SWE-bench..."
},
{
"position": 2,
"title": "o3 vs o1: What Changed in OpenAI's Reasoning Models",
"link": "https://example.com/o3-vs-o1",
"snippet": "The o3 model introduces deliberative alignment and improved tool use..."
}
]
}Benefits
- Prevent AI hallucinations with real-time, verified search data
- Single API covers Google, Amazon, YouTube, Walmart, and Reddit
- Structured JSON is ready to inject into LLM context windows
- Works with LangChain, CrewAI, MCP, and any HTTP-capable agent
- Knowledge graph data provides high-confidence factual grounding
- Fresh results ensure agents have current information, not stale training data