Skip to main content

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. By default, calls use keyless providers. Starting with version 0.1.1 (WebRouter 0.17 or later), provider keys in the process environment are ignored. To use a credentialed provider, supply its key explicitly through provider_config; calls using that key are billed to its account. Version 0.1.0 reads environment credentials. The examples below describe 0.1.1; check PyPI for release availability.

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 and pass its credentials from your application’s secret store (tavily_key and firecrawl_key below):

webrouter_tool = WebRouterToolSpec(
    search_provider="tavily",
    extract_provider="firecrawl",
    provider_config={
        "tavily": {"api_key": tavily_key},
        "firecrawl": {"api_key": firecrawl_key},
    },
)

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 run offline, including credential-isolation checks against the real WebRouter library with synthetic keys and mock HTTP transports. 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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-tools-webrouter 0.1.1
File Size Uploaded Provenance Actions
llama_index_tools_webrouter-0.1.1.tar.gz 10.0 kB With provenance Details for llama_index_tools_webrouter-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-tools-webrouter 0.1.1
File Interpreter ABI Platform Actions
llama_index_tools_webrouter-0.1.1-py3-none-any.whl Python 3 none any Details for llama_index_tools_webrouter-0.1.1-py3-none-any.whl

Total release size: 18.7 kB

Release files / llama_index_tools_webrouter-0.1.1.tar.gz

Download URL llama_index_tools_webrouter-0.1.1.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
409ae08a61db182e67bd18e354b7a62c95b02219e2b5c7a4f9ca47bb41975a17
BLAKE2b-256 checksum
How to use checksums
80381860f4adad1092f64289a6de109ebf820ba798e2d9fa8e69342819b73474
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 30, 2026.

Transparency log

Release files / llama_index_tools_webrouter-0.1.1-py3-none-any.whl

Download URL llama_index_tools_webrouter-0.1.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8a36f9885ca9dbc484bee11efade121c391aa4632c853cd2e0185183ee158c0
BLAKE2b-256 checksum
How to use checksums
527b2eee31d45f07df0d168c427592a4b72b0564266c1b95b2e5a9539634e20e
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 30, 2026.

Transparency log

Security for llama-index-tools-webrouter 0.1.1

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.

Select from 2 files

Attestation for llama_index_tools_webrouter-0.1.1.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 30, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page