LlamaIndex Tools Integration: SearchApi
Multi-engine web search tool for LlamaIndex agents powered by SearchApi.io.
SearchApi provides structured data from 100+ search engines through a single API. This integration supports Google, Google News, Google Shopping, Google Jobs, YouTube, Bing, and Baidu.
Installation
pip install llama-index-tools-searchapi
Setup
Get your API key at searchapi.io (free tier: 100 searches/month).
Usage
from llama_index.tools.searchapi import SearchApiToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
tool_spec = SearchApiToolSpec(api_key="your-key")
agent = FunctionAgent(
tools=tool_spec.to_tool_list(),
llm=OpenAI(model="gpt-4.1"),
)
response = await agent.run("what's the latest news about AI agents?")
Google News
tool_spec = SearchApiToolSpec(api_key="your-key", engine="google_news")
YouTube
tool_spec = SearchApiToolSpec(api_key="your-key", engine="youtube")
With Location and Language
tool_spec = SearchApiToolSpec(api_key="your-key", num_results=5)
results = tool_spec.search("coffee shops", location="San Francisco", country="us", language="en")
Per-query Engine Override
tool_spec = SearchApiToolSpec(api_key="your-key")
results = tool_spec.search("wireless headphones", engine="google_shopping")
Supported Engines
| Engine | Description |
|---|---|
google |
Google web search (default) |
google_news |
Google News |
google_shopping |
Google Shopping |
google_jobs |
Google Jobs |
youtube |
YouTube video search |
bing |
Bing web search |
baidu |
Baidu search |
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key |
str |
required | SearchApi API key |
engine |
str |
"google" |
Default search engine |
num_results |
int |
10 |
Default number of results |
Metadata
Release files for llama-index-tools-searchapi 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama_index_tools_searchapi-0.1.0.tar.gz | 2.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_index_tools_searchapi-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.2 kB
Release files / llama_index_tools_searchapi-0.1.0.tar.gz
| Download URL | llama_index_tools_searchapi-0.1.0.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
884ee440d5901655b0064848feeecadc9bf111d80360f955de37855701ece738
|
|
BLAKE2b-256 checksum How to use checksums |
92d07f8c13411ec964a1437df6f249abe1b5d2abc35214b75b4f9131d32fc3cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / llama_index_tools_searchapi-0.1.0-py3-none-any.whl
| Download URL | llama_index_tools_searchapi-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4160749918b79b50eec6bc2fc6e4681a850ab28353543a10a1718e1f8519c063
|
|
BLAKE2b-256 checksum How to use checksums |
1a24ac75f37bf18a08004fcfcf0fd9503fca57343054797e5745357c166b93be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|