Replace Brave Search in LangChain with Scavio
Brave's attribution requirement and removed free tier push LangChain devs to alternatives. Step-by-step migration code.
Brave Search has a genuinely independent index. That matters. Most search APIs quietly proxy Google or Bing results, but Brave crawls the web independently. For LangChain developers, though, two friction points keep coming up: the attribution requirement (you must display "Powered by Brave" in your UI) and the lack of a meaningful free tier. If your agent runs headless or you are on a tight budget, these constraints force a migration.
The existing BraveSearchWrapper setup
In LangChain, Brave Search is typically loaded via the community package. The wrapper handles auth and returns organic results.
# Before: Brave Search in LangChain
from langchain_community.tools import BraveSearch
brave_tool = BraveSearch.from_api_key(
api_key="BRAVE_API_KEY",
search_kwargs={"count": 5}
)
# Usage in an agent
result = brave_tool.run("best headless CMS for Next.js 2026")
# Returns JSON string of results
# Attribution required in any user-facing outputThe migration: swap to a custom Scavio tool
LangChain supports custom tools via the Tool class. Replacing Brave with Scavio means writing a thin wrapper that calls the Scavio API and returns results in the same shape your agent expects.
import requests, os, json
from langchain.tools import Tool
def scavio_search(query: str) -> str:
"""Search the web via Scavio. $0.005/credit, 500 free/mo."""
resp = requests.post(
"https://api.scavio.dev/api/v1/search",
headers={"x-api-key": os.environ["SCAVIO_API_KEY"]},
json={"query": query, "num_results": 5},
timeout=10,
)
results = resp.json().get("results", [])
return json.dumps([
{"title": r["title"], "url": r["url"], "snippet": r.get("snippet", "")}
for r in results
])
scavio_tool = Tool(
name="web_search",
description="Search the web for current information",
func=scavio_search,
)Using the tool in an agent chain
The tool drops into any LangChain agent exactly where BraveSearch sat before. The agent does not care about the underlying provider as long as it gets structured results back.
from langchain_openai import ChatOpenAI
from langchain.agents import initialize_agent, AgentType
llm = ChatOpenAI(model="gpt-4o", temperature=0)
agent = initialize_agent(
tools=[scavio_tool],
llm=llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True,
)
answer = agent.run(
"What are the top 3 headless CMS platforms in 2026 "
"and how do their pricing models compare?"
)
print(answer)Cost comparison
- Brave Search API: free tier gives 1 query/second with 2,000/mo cap. Paid plans start at $5/mo for 5,000 queries. Attribution required on all tiers.
- Scavio: 500 free credits/mo, then $0.005/credit. $30/mo for 7,000 credits. No attribution requirement.
- For an agent making 200 searches/day (6,000/mo): Brave costs $5+/mo, Scavio costs $30/mo. Brave is cheaper at this volume.
- For an agent making 20 searches/day (600/mo): both are effectively free-tier territory.
What you lose by leaving Brave
Brave's independent index means it sometimes surfaces results that Google buries. For privacy-focused applications, Brave's no-tracking policy is a selling point. Scavio proxies results from major search engines, which means you get mainstream ranking data but not an independent perspective. If index independence matters to your use case, Brave is the better choice.
What you gain
- No attribution requirement -- critical for white-label or headless agents
- Multi-platform support (Google, YouTube, Reddit, Amazon) from one API
- Simpler auth: one API key, one endpoint, no OAuth dance
- MCP server available if you later move to Claude Code or similar tools
When to stay on Brave
If your application is user-facing and you can display the Brave attribution badge, and if you value index independence over multi-platform coverage, Brave remains a solid choice. The migration only makes sense if the attribution requirement or the lack of multi-platform search is blocking your workflow.