The Problem
LangGraph agents hallucinate when they lack current information. The graph-based workflow is powerful for multi-step reasoning, but without live data, the agent generates plausible-sounding answers based on stale training data. This is especially problematic for tasks involving prices, recent events, product availability, or any time-sensitive information. Adding web search to LangGraph requires defining a custom tool node and wiring it into the graph.
The Scavio Solution
Add Scavio as a search tool node in your LangGraph graph. The tool accepts a query and platform parameter, returns structured JSON results, and feeds them into the agent's context for grounded reasoning. The search node runs as part of the graph execution, so the agent can decide when and how to search based on its reasoning state.
Before
Before adding search grounding, the LangGraph agent answered pricing questions with training-data estimates that were months out of date. Product availability answers were guesses. News-related queries produced confident but fictional responses.
After
After integrating the search tool node, the agent queries Scavio before answering time-sensitive questions. Responses include citations with URLs. Pricing answers reflect current data, and the agent correctly declines to answer when search results are inconclusive.
Who It Is For
LangGraph developers building agents that need accurate, current information. Teams migrating from LangChain chains to LangGraph graphs who want to maintain web search capability in the new architecture.
Key Benefits
- Live search data eliminates hallucination for time-sensitive queries
- Structured JSON results integrate cleanly into LangGraph state
- Agent decides when to search based on reasoning needs
- Multi-platform coverage: Google, Amazon, YouTube, Reddit in one tool
- Per-query cost of $0.005 keeps grounding affordable at scale
Python Example
import requests
from typing import TypedDict, Annotated
API_KEY = "your_scavio_api_key"
def scavio_search(query: str, platform: str = "google") -> str:
"""Search the web for current information. Use for prices, news, products, or any time-sensitive data."""
res = requests.post(
"https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": platform, "query": query, "ai_overview": platform == "google"},
timeout=15,
)
res.raise_for_status()
data = res.json()
blocks = []
if data.get("ai_overview"):
blocks.append(f"AI Overview: {data['ai_overview']['text'][:300]}")
for r in data.get("organic", [])[:5]:
blocks.append(f"- {r.get('title', '')}: {r.get('snippet', '')} ({r.get('link', '')})")
return "\n".join(blocks) if blocks else "No results found."
# LangGraph integration:
# from langgraph.prebuilt import create_react_agent
# tools = [scavio_search]
# agent = create_react_agent(model, tools)
# result = agent.invoke({"messages": [("user", "What is Scavio API pricing in 2026?")]})
print(scavio_search("scavio api pricing 2026"))JavaScript Example
const API_KEY = "your_scavio_api_key";
async function scavioSearch(query, platform = "google") {
const res = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST",
headers: { "x-api-key": API_KEY, "content-type": "application/json" },
body: JSON.stringify({ platform, query, ai_overview: platform === "google" }),
});
if (!res.ok) throw new Error(`scavio ${res.status}`);
const data = await res.json();
const blocks = [];
if (data.ai_overview) blocks.push(`AI Overview: ${data.ai_overview.text?.slice(0, 300)}`);
for (const r of (data.organic ?? []).slice(0, 5)) {
blocks.push(`- ${r.title ?? ""}: ${r.snippet ?? ""} (${r.link ?? ""})`);
}
return blocks.join("\n") || "No results found.";
}
// LangGraph.js integration:
// import { createReactAgent } from "@langchain/langgraph/prebuilt";
// const tools = [scavioSearch];
// const agent = createReactAgent({ llm: model, tools });
console.log(await scavioSearch("scavio api pricing 2026"));Platforms Used
Web search with knowledge graph, PAA, and AI overviews
Amazon
Product search with prices, ratings, and reviews
YouTube
Video search with transcripts and metadata
Community, posts & threaded comments from any subreddit