Integrate SERPEX for Real-Time Web Search
Search Google, Bing, DuckDuckGo, and more from a LlamaIndex agent via the SERPEX API.
Why it matters
Enhance your LlamaIndex applications with real-time web search capabilities using the SERPEX API. Access up-to-date information from multiple search engines to enrich your data and improve AI-driven insights.
Outcomes
What it gets done
Connect LlamaIndex to SERPEX for web search
Retrieve real-time search results from Google, Bing, DuckDuckGo, and more
Filter search results by time range (day, week, month, year)
Utilize structured JSON output for AI processing
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-tool-tools-serpex | bash Overview
LlamaIndex Tools Integration: SERPEX
A LlamaIndex tool that runs real-time web searches through the SERPEX API across Google, Bing, DuckDuckGo, Brave, Yahoo, and Yandex. Use when an agent needs current web search results with optional recency filtering, not a page-content scraper.
What it does
The SERPEX LlamaIndex Tool lets an agent search the web and get real-time results from multiple search engines through the SERPEX API. The SerpexToolSpec exposes a search function that an agent (or a developer calling it directly) can use to run queries against Google, Bing, DuckDuckGo, Brave, Yahoo, or Yandex - or let SERPEX auto-route to the best available engine.
Search calls accept an engine parameter to target a specific search provider, a num_results count, and a time_range filter (day, week, month, or year) to scope results to recent content. SERPEX returns clean, structured JSON responses designed for AI applications rather than raw HTML, and bills at a flat one credit per request with failed requests not charged.
When to use - and when NOT to
Use it when a LlamaIndex agent needs current, real-time web search results rather than relying on a model's training data - answering questions about recent events, comparing information across multiple search engines, or filtering results by recency. Use the time_range filter specifically when freshness matters, such as searching for today's or this week's news. Do not use it as a scraper for full page content - SERPEX returns search result listings, not full-text extraction of the pages found.
Capabilities
search runs a query against a chosen or auto-routed search engine (Google, Bing, DuckDuckGo, Brave, Yahoo, Yandex) with configurable num_results and time_range filtering, returning structured JSON results.
How to install
pip install llama-index-tools-serpex
Requires a SERPEX API key from the SERPEX dashboard, passed to SerpexToolSpec or set as the SERPEX_API_KEY environment variable.
Who it's for
Developers building LlamaIndex agents that need real-time web search across multiple engines with recency filtering, without integrating each search provider's API separately.
Source README
LlamaIndex Tools Integration: SERPEX
This tool allows you to use SERPEX API to search the web and get real-time results from multiple search engines within your LlamaIndex application.
Installation
pip install llama-index-tools-serpex
Usage
from llama_index.tools.serpex import SerpexToolSpec
from llama_index.agent.openai import OpenAIAgent
### Initialize the tool
serpex_tool = SerpexToolSpec(api_key="your_serpex_api_key")
### Create agent with the tool
agent = OpenAIAgent.from_tools(serpex_tool.to_tool_list(), verbose=True)
### Use the agent
response = agent.chat("What are the latest AI developments?")
print(response)
Advanced Usage
### Use specific search engine
serpex_tool = SerpexToolSpec(
api_key="your_api_key",
engine="google", # or 'bing', 'duckduckgo', 'brave', etc.
)
### Search with time filter
results = serpex_tool.search(
"recent AI news",
num_results=10,
time_range="day", # 'day', 'week', 'month', 'year'
)
### Use different engines for different queries
results = serpex_tool.search(
"privacy tools", engine="duckduckgo", num_results=5
)
API Key
Get your API key from SERPEX Dashboard.
Set as environment variable:
export SERPEX_API_KEY=your_api_key
Features
- Multiple Search Engines: Auto-routing, Google, Bing, DuckDuckGo, Brave, Yahoo, Yandex
- Real-time Results: Get up-to-date search results via API
- Time Filtering: Filter by day, week, month, or year
- Fast & Reliable: 99.9% uptime SLA with global proxy network
- Structured Data: Clean JSON responses optimized for AI applications
- Cost Effective: Only 1 credit per request, failed requests free
Search Engines
auto- Automatically routes to the best available engine (default)google- Google Searchbing- Microsoft Bingduckduckgo- Privacy-focused DuckDuckGobrave- Brave Searchyahoo- Yahoo Searchyandex- Yandex Search
Links
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.