Tutorial

How to Replace Brave Search in LangChain Agents

Brave's free tier is gone. Replace BraveSearchResults tool in LangChain with Scavio's multi-platform search using langchain-scavio.

Many LangChain agents use BraveSearchResults as their web search tool. With Brave's free tier removed in February 2026, these agents now face unexpected costs. This tutorial replaces the Brave tool with langchain-scavio, which provides 500 free credits per month and access to 5 platforms.

Prerequisites

  • Python 3.10+
  • LangChain installed
  • A Scavio API key

Walkthrough

Step 1: Install langchain-scavio

Replace the Brave search package with Scavio's LangChain integration.

Bash
# Remove Brave search (optional, but clean):
pip uninstall langchain-community  # if only used for Brave

# Install Scavio LangChain integration:
pip install langchain-scavio

Step 2: Replace tool initialization

Swap BraveSearchResults for ScavioSearchResults in your agent setup.

Python
# BEFORE (Brave):
# from langchain_community.tools import BraveSearch
# search_tool = BraveSearch.from_api_key(api_key=os.environ['BRAVE_API_KEY'])

# AFTER (Scavio):
from langchain_scavio import ScavioSearchResults
import os

search_tool = ScavioSearchResults(
    api_key=os.environ['SCAVIO_API_KEY'],
    platform='google',  # or 'reddit', 'youtube', 'amazon', 'walmart'
)

Step 3: Add multi-platform tools (optional)

Add platform-specific tools for richer agent capabilities.

Python
from langchain_scavio import ScavioSearchResults

# Create tools for different platforms:
google_tool = ScavioSearchResults(api_key=os.environ['SCAVIO_API_KEY'], platform='google')
reddit_tool = ScavioSearchResults(api_key=os.environ['SCAVIO_API_KEY'], platform='reddit')
youtube_tool = ScavioSearchResults(api_key=os.environ['SCAVIO_API_KEY'], platform='youtube')

# Use in agent:
tools = [google_tool, reddit_tool, youtube_tool]

# The agent can now search Google for facts, Reddit for opinions,
# and YouTube for tutorials - all under one API key and credit pool.

Step 4: Update your agent

Wire the new tools into your existing LangChain agent.

Python
from langchain.agents import create_tool_calling_agent, AgentExecutor
from langchain_anthropic import ChatAnthropic
from langchain_core.prompts import ChatPromptTemplate

llm = ChatAnthropic(model='claude-sonnet-4-6')
tools = [google_tool, reddit_tool]

prompt = ChatPromptTemplate.from_messages([
    ('system', 'You are a research assistant. Use search tools to find current information.'),
    ('human', '{input}'),
    ('placeholder', '{agent_scratchpad}'),
])

agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)

result = executor.invoke({'input': 'What is the current state of the SerpAPI lawsuit?'})
print(result['output'])

Python Example

Python
from langchain_scavio import ScavioSearchResults
import os

tool = ScavioSearchResults(api_key=os.environ['SCAVIO_API_KEY'], platform='google')
result = tool.invoke('python web framework comparison 2026')
print(result)

JavaScript Example

JavaScript
// langchain-scavio is Python-only. For JS, use HTTP directly:
const tool = {
  name: 'web_search',
  func: async (query) => {
    const r = await fetch('https://api.scavio.dev/api/v1/search', {
      method: 'POST', headers: {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'},
      body: JSON.stringify({platform: 'google', query})
    });
    return JSON.stringify((await r.json()).organic?.slice(0,5));
  }
};

Expected Output

JSON
A LangChain agent using langchain-scavio instead of BraveSearch, with multi-platform search capabilities and 500 free credits per month.

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.

Python 3.10+. LangChain installed. A Scavio API key. 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 LangChain, but you can adapt to your framework of choice.

Start Building

Brave's free tier is gone. Replace BraveSearchResults tool in LangChain with Scavio's multi-platform search using langchain-scavio.