WebRouter Tool
WebRouter is an open-source (Apache-2.0) Python library that puts one interface in front of several web search and extraction providers. Each call goes to one provider and falls back to the next if that call fails.
No API key is needed. With no key set, calls go to providers that work without one. A provider key set in the environment, such as TAVILY_API_KEY, EXA_API_KEY or FIRECRAWL_API_KEY, adds that provider to the routing, and the calls it serves are billed to that key. The WebRouter docs list the providers and their variables.
WebRouter needs Python 3.11 or later.
Installation
pip install llama-index-tools-webrouter
Usage
from llama_index.tools.webrouter import WebRouterToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
webrouter_tool = WebRouterToolSpec()
agent = FunctionAgent(
tools=webrouter_tool.to_tool_list(),
llm=OpenAI(model="gpt-4o"),
)
await agent.run("What changed in the latest Python release? Read the release notes.")
To send every call to one provider instead of letting WebRouter pick, name it:
webrouter_tool = WebRouterToolSpec(
search_provider="tavily", extract_provider="firecrawl"
)
Available Functions
search: Search the web for a query. Returns a list of Documents, one per result, with the result's text and its url, title, published_date and the provider that served it in the metadata. max_results sets how many results come back, and include_domains limits them to given domains.
extract: Read one or more URLs. Returns a list of Documents, one per page, with the page content as markdown and its url, title and provider in the metadata. URLs that could not be read are logged as warnings and left out.
The functions can also be called directly:
from llama_index.tools.webrouter import WebRouterToolSpec
webrouter_tool = WebRouterToolSpec()
for doc in webrouter_tool.search("LlamaIndex agents", max_results=3):
print(doc.metadata["title"], doc.metadata["url"])
pages = webrouter_tool.extract(["https://docs.llamaindex.ai/"])
print(pages[0].text[:500])
This loader is designed to be used as a way to load data as a Tool in an Agent.
Development
pip install -e ".[test]"
ruff check . && ruff format --check .
mypy llama_index
pytest
The tests mock WebRouter and run offline. examples/webrouter.ipynb runs the tools live; search and extract need no key, the agent cell needs an LLM key.
Support and license
This package is maintained by the WebRouter maintainers. Report problems in this repository's issues. Licensed under Apache-2.0.
Metadata
Release files for llama-index-tools-webrouter 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 | Provenance | Actions |
|---|---|---|---|---|
| llama_index_tools_webrouter-0.1.0.tar.gz | 8.5 kB | With provenance | Details for llama_index_tools_webrouter-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_tools_webrouter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_tools_webrouter-0.1.0-py3-none-any.whl |
Total release size: 16.9 kB
Release files / llama_index_tools_webrouter-0.1.0.tar.gz
| Download URL | llama_index_tools_webrouter-0.1.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2badeff8a9a83e615c47c81e841525ec49255e47c5beed24b318994cafa35987
|
|
BLAKE2b-256 checksum How to use checksums |
a4abdfdb96218d19c9774021850fe40ca267a9b2a4c4624b4e05fe6dd5944430
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / llama_index_tools_webrouter-0.1.0-py3-none-any.whl
| Download URL | llama_index_tools_webrouter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13b3e09d7cb4edaa06133fd7f0973d4a2ceca4305cd0f1fbc627f5f425774d5f
|
|
BLAKE2b-256 checksum How to use checksums |
dfc9ecad0275d443c65b86ff37455c7209a48b2f39c46a147d3f60209e887fe8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for llama-index-tools-webrouter 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for llama_index_tools_webrouter-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.