Metadata-Version: 2.5
Name: gpt-researcher-webrouter
Version: 0.1.1
Summary: GPT Researcher retriever plugin for WebRouter: keyless web search, routed across providers.
Project-URL: Homepage, https://docs.webrouter.net
Project-URL: Documentation, https://github.com/yogev-nimble/gpt-researcher-webrouter#readme
Project-URL: Repository, https://github.com/yogev-nimble/gpt-researcher-webrouter
Project-URL: Issues, https://github.com/yogev-nimble/gpt-researcher-webrouter/issues
Author: Nimble
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: agents,gpt-researcher,research,retriever,web-search,webrouter
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: webrouter<1,>=0.17
Provides-Extra: test
Requires-Dist: pytest>=8.3; extra == 'test'
Requires-Dist: ruff<1,>=0.8; extra == 'test'
Description-Content-Type: text/markdown

# gpt-researcher-webrouter

A [GPT Researcher](https://github.com/assafelovic/gpt-researcher) retriever plugin
for [WebRouter](https://github.com/Nimbleway/webrouter), an open-source library
that puts one search interface in front of many web search providers.

Version 0.1.1 defaults to keyless search.
It requires WebRouter 0.17 or later and passes `use_environment=False`, so ordinary
provider variables such as `EXA_API_KEY` and `TAVILY_API_KEY` are ignored. Keyless
backends are third-party services that receive your queries.

Version 0.1.0 discovers provider credentials from the process environment.
The isolated behavior below applies to 0.1.1 and later.

## Install

```bash
pip install gpt-researcher-webrouter
export RETRIEVER=webrouter
```

Install it in the same Python environment as GPT Researcher. It registers the
`webrouter` retriever under the `gpt_researcher.retrievers` entry point, so no
change to GPT Researcher is needed. Combine it with a built-in retriever, e.g.
`RETRIEVER=webrouter,arxiv`.

## Configuration

| Variable | Default | What it does |
| --- | --- | --- |
| `WEBROUTER_PROVIDER` | unset (`auto`) | Pin one provider, e.g. `exa` or `you-mcp`; a pinned provider has no fallback. Unset, only keyless backends are eligible. |
| `WEBROUTER_API_KEY` | unset | Explicitly opt in to the selected provider using this plugin-specific key. Requires a specific `WEBROUTER_PROVIDER` (not `auto`). Other provider environment keys are never imported. |

For credentialed search, set `WEBROUTER_PROVIDER=exa` and supply your Exa key as
`WEBROUTER_API_KEY` through your deployment's secret configuration. Only that
provider receives the key, via `provider_config`. This is an operator-wide
setting, not a per-user secret store. Without this explicit configuration,
search remains keyless; pinning a keyed provider without its key fails rather
than using server credentials.

Upgrading from 0.1.0: ambient provider keys no longer enable paid backends.
Operators who want one must configure the two plugin-specific settings above.

## Behaviour

- Results are links with their title and a snippet (at most 500 characters),
  and GPT Researcher scrapes each page (`requires_scraping = True`).
- Domains in `query_domains` are passed to WebRouter as `include_domains`.
- Each search waits at most 30 seconds.
- On a failed search (no provider available, a timeout) it logs a warning and
  returns no results, so one failing retriever does not stop a research run.
  A misconfiguration, such as an unknown `WEBROUTER_PROVIDER`, is logged as an
  error.
- The package does not depend on `gpt-researcher`, so installing it never
  changes your GPT Researcher version; install it next to GPT Researcher 0.16.1
  or later.

Providers, their keys and the options each supports are listed in the
[WebRouter documentation](https://docs.webrouter.net/providers).

## Development

```bash
pip install -e ".[test]"
ruff check . && ruff format --check .
pytest
```

Offline tests cover result shaping with a fake and credential isolation against
the released WebRouter library using synthetic keys and intercepted HTTP. With
`gpt-researcher` installed, one more test checks that GPT Researcher loads the
plugin by name.

## License

Apache 2.0
