ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Replace Tavily in LangChain with Scavio
Tutorial

How to Replace Tavily in LangChain with Scavio

Swap Tavily for Scavio in your LangChain agent with a custom tool wrapper. Multi-platform search, no Nebius vendor risk. Working code.

Get Free API KeyAPI Docs

After Nebius acquired Tavily for $275M in February 2026, teams using TavilySearchResults in LangChain face vendor uncertainty. Replacing Tavily with Scavio takes one custom tool class that wraps the Scavio API in LangChain's Tool interface. The swap gives you multi-platform search (Google, Reddit, YouTube, Amazon) instead of Tavily's web-only results, with no acquisition risk.

Prerequisites

  • Python 3.10+
  • langchain and requests installed
  • A Scavio API key from scavio.dev
  • An existing LangChain agent using Tavily

Walkthrough

Step 1: Create the Scavio search tool for LangChain

Build a custom LangChain Tool that calls the Scavio API as a drop-in replacement for TavilySearchResults.

Python
import os, requests
from langchain.tools import Tool

API_KEY = os.environ['SCAVIO_API_KEY']

def scavio_search(query: str) -> str:
    resp = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY, 'Content-Type': 'application/json'},
        json={'query': query, 'country_code': 'us'})
    results = resp.json().get('organic_results', [])[:5]
    if not results: return 'No results found.'
    return '\n\n'.join(f"{r['title']}\n{r.get('snippet', '')}\nURL: {r['link']}" for r in results)

scavio_tool = Tool(name='web_search',
    description='Search the web for current information.',
    func=scavio_search)

Step 2: Add multi-platform search variants

Create Reddit and YouTube tools that Tavily never offered.

Python
def scavio_reddit(query: str) -> str:
    resp = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY, 'Content-Type': 'application/json'},
        json={'query': query, 'platform': 'reddit', 'country_code': 'us'})
    results = resp.json().get('organic_results', [])[:5]
    if not results: return 'No Reddit discussions found.'
    return '\n\n'.join(f"{r['title']}\n{r.get('snippet', '')}\nURL: {r['link']}" for r in results)

def scavio_youtube(query: str) -> str:
    resp = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY, 'Content-Type': 'application/json'},
        json={'query': query, 'platform': 'youtube', 'country_code': 'us'})
    results = resp.json().get('organic_results', [])[:5]
    if not results: return 'No YouTube videos found.'
    return '\n\n'.join(f"{r['title']}\n{r.get('snippet', '')}\nURL: {r['link']}" for r in results)

reddit_tool = Tool(name='reddit_search', description='Search Reddit for discussions.', func=scavio_reddit)
youtube_tool = Tool(name='youtube_search', description='Search YouTube for videos.', func=scavio_youtube)

Step 3: Swap tools in your existing agent

Replace TavilySearchResults with the Scavio tools.

Python
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate

# BEFORE: tools = [TavilySearchResults(max_results=5)]
# AFTER:
tools = [scavio_tool, reddit_tool, youtube_tool]

llm = ChatOpenAI(model='gpt-4o', temperature=0)
prompt = ChatPromptTemplate.from_messages([
    ('system', 'Use web_search for general queries, reddit_search for opinions, youtube_search for videos.'),
    ('human', '{input}'),
    ('placeholder', '{agent_scratchpad}'),
])

agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
result = executor.invoke({'input': 'What are developers saying about Tavily alternatives?'})
print(result['output'])

Step 4: Test the migration

Run comparison queries to verify result quality.

Python
queries = ['best SERP API 2026', 'TikTok API for brands', 'how to build SEO dashboard']
for q in queries:
    print(f'\nQuery: {q}')
    g = scavio_search(q)
    r = scavio_reddit(q)
    print(f'  Google: {len(g.split(chr(10)+chr(10)))} results')
    print(f'  Reddit: {len(r.split(chr(10)+chr(10)))} results')
    print(f'  Cost: $0.01 (2 credits)')

Python Example

Python
import os, requests
from langchain.tools import Tool

API_KEY = os.environ['SCAVIO_API_KEY']

def search(query, platform='google'):
    resp = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY, 'Content-Type': 'application/json'},
        json={'query': query, 'platform': platform, 'country_code': 'us'})
    results = resp.json().get('organic_results', [])[:5]
    return '\n\n'.join(f"{r['title']}\n{r.get('snippet', '')}" for r in results) or 'No results.'

tools = [
    Tool(name='web_search', description='Search the web.', func=lambda q: search(q)),
    Tool(name='reddit_search', description='Search Reddit.', func=lambda q: search(q, 'reddit')),
]
print(search('tavily alternatives 2026'))

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
const H = { 'x-api-key': API_KEY, 'Content-Type': 'application/json' };

async function search(query, platform = 'google') {
  const data = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST', headers: H,
    body: JSON.stringify({ query, platform, country_code: 'us' })
  }).then(r => r.json());
  return (data.organic_results || []).slice(0, 5)
    .map(r => `${r.title}\n${r.snippet || ''}`).join('\n\n') || 'No results.';
}

async function main() {
  console.log(await search('tavily alternatives 2026'));
  console.log(await search('tavily alternatives', 'reddit'));
}
main().catch(console.error);

Expected Output

JSON
Query: What are developers saying about Tavily alternatives?
> Calling: reddit_search("Tavily alternatives developer opinions 2026")
Tavily acquired by Nebius - what are you switching to?
Several devs switching to Scavio and Exa...
> Final answer: Developers on Reddit discuss several Tavily alternatives...

Related Tutorials

  • How to Add Search to a Deep Research Agent
  • How to Fetch Google Search Results in Python
  • How to Add a SearXNG Fallback to Your Search Pipeline

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 and requests installed. A Scavio API key from scavio.dev. An existing LangChain agent using Tavily. A Scavio API key gives you 50 free credits on signup.

Yes. The free tier includes 50 credits on signup, 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.

Related Resources

Use Case

LangChain Tavily Migration

Read more
Best Of

Best Tavily Replacements After Rate Limit Cuts (2026)

Read more
Workflow

Tavily to Scavio Migration Workflow

Read more
Solution

Tavily to Scavio Migration Stack

Read more
Use Case

Tavily to Scavio Migration for Agent Workflows

Read more
Best Of

Best Tavily Alternatives for Search API in 2026

Read more

Start Building

Swap Tavily for Scavio in your LangChain agent with a custom tool wrapper. Multi-platform search, no Nebius vendor risk. Working code.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy