Skip to main content

librarian-searxng

A SearXNG search backend for librarian's research loop and search eval. librarian ships no search backend. Installing this package into librarian's environment lets start_research / librarian research start search the web through a SearXNG metasearch instance that runs in Docker on your machine.

librarian research loop ──► SearxngBackend ──► SearXNG (Docker, 127.0.0.1:8080) ──► upstream engines
                                  │
                   paged · paced · cached · health-aware

Before you enable it: upstream engines and their terms

SearXNG answers queries by querying other search engines on your behalf. The bundled settings.yml enables engines that include Google (via google cse), Bing, Yandex, Yep, and DuckDuckGo, plus scholarly indexes (arXiv, Crossref, OpenAlex, PubMed, Semantic Scholar). Many commercial search engines' terms of service prohibit automated querying. Which engines you enable, and whether your use complies with their terms, is your decision and your responsibility. Edit settings.yml (or point SEARXNG_SETTINGS_PATH at your own) to match your policy. The scholarly indexes alone are a reasonable conservative setup.

To customize engines, copy the bundled settings.yml, edit the copy, and set SEARXNG_SETTINGS_PATH to it. If you enable OpenAlex, add your own contact address as its mailto in that copy (OpenAlex's "polite pool"). The bundled default deliberately leaves it unset.

Install

Install into the same environment as librarian:

# from PyPI
uv pip install librarian-searxng        # or: pip install librarian-searxng

# from GitHub
uv pip install git+https://github.com/kevin-j-smith/librarian-searxng

# or from a local checkout, next to your librarian checkout
cd librarian
uv pip install -e ../librarian-searxng

librarian itself is not a declared dependency, and pip will not install it for you. librarian is not published on PyPI, and the PyPI project named librarian is an unrelated package. Install librarian first, from its repository, then add this plugin to that environment.

With a uv-managed librarian checkout, a plain uv sync removes packages that aren't in librarian's lockfile, and this one isn't (on purpose). Run the install command again after uv sync, or use uv sync --inexact.

For a tool install: uv tool install git+https://github.com/kevin-j-smith/librarian --with librarian-searxng.

Then, in librarian's .env:

RESEARCH_ENABLED=true
# RESEARCH_SEARCH_BACKEND=searxng   # only needed if several backends are installed

Docker (Docker Desktop on Windows and macOS) must be installed. You don't start the container yourself. The backend runs docker compose -p librarian -f <bundled compose file> up -d when a research task starts, and stops the container after SEARXNG_IDLE_GRACE_SECONDS of no research. It listens on 127.0.0.1:8080 only.

Check it:

librarian eval engines                 # which upstream engines refuse, and which are silently empty
librarian eval search "surface code error correction thresholds"

Configuration

All settings are read from librarian's .env (the names predate this package, so existing setups keep working).

Variable Default Description
SEARXNG_BASE_URL http://127.0.0.1:8080 Where SearXNG answers. Point it at an existing instance to skip Docker entirely (the container is only started if nothing answers here).
SEARXNG_SETTINGS_PATH bundled settings.yml Engine configuration mounted into the container. Its hash also namespaces librarian's response cache.
SEARXNG_COMPOSE_FILE bundled compose file Compose file used to start and stop the container
SEARXNG_COMPOSE_PROJECT librarian Compose project name. It matches containers created before this was a plugin.
SEARXNG_START_TIMEOUT 60 Seconds to wait for SearXNG to become healthy
SEARXNG_IDLE_GRACE_SECONDS 120 Keep the container up this long after the last task
SEARXNG_MIN_INTERVAL_SECONDS 4.0 Minimum gap between outgoing queries per category. 0 disables pacing.
SEARXNG_JITTER_SECONDS 3.0 Random extra delay, from 0 to this many seconds, so queries aren't sent on a fixed beat
SEARXNG_MAX_PAGES 4 Result pages per search. Each page queries every engine again.

Response caching is librarian's (SEARCH_CACHE_* in librarian's configuration docs). This backend uses it, so a cache hit skips both the request and the pacing delay.

How it maps to librarian's interface

librarian category SearXNG category Notes
web default (general) Paged until the requested count is met
video videos One page
science science Paged through the full page budget

Results come back unfiltered, in SearXNG's order. librarian applies the same topical gate, media filter, dedup, ranking, and caps to every backend. Engines SearXNG reports as refusing come back as degraded, so librarian can log and record them. See DESIGN.md for the measurements behind pacing, paging, and the engine set.

Development

cd librarian && uv pip install --no-deps -e ../librarian-searxng
cd ../librarian-searxng && uv run --project ../librarian --no-sync python -m pytest tests

License

Apache License 2.0; see LICENSE and NOTICE. This package is licensed independently of librarian, which is source-available under its own terms. This package contains no SearXNG code. It talks to SearXNG (AGPL-3.0) over HTTP and starts the upstream searxng/searxng image.

Metadata

Release files for librarian-searxng 0.1.0

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

Source distribution (sdist)

Source distribution for librarian-searxng 0.1.0
File Size Uploaded Provenance Actions
librarian_searxng-0.1.0.tar.gz 29.9 kB With provenance Details for librarian_searxng-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for librarian-searxng 0.1.0
File Interpreter ABI Platform Actions
librarian_searxng-0.1.0-py3-none-any.whl Python 3 none any Details for librarian_searxng-0.1.0-py3-none-any.whl

Total release size: 51.9 kB

Release files / librarian_searxng-0.1.0.tar.gz

Download URL librarian_searxng-0.1.0.tar.gz
Size 29.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c1f9334cc1fa7533fdfa9e224d35780744767bc5e42ffd4696ef1519a5bd4b5b
BLAKE2b-256 checksum
How to use checksums
6f5bed2d69067885c58965aa84d9519fd6a0595f7051a2da85b298890d8564cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 29, 2026.

Transparency log

Release files / librarian_searxng-0.1.0-py3-none-any.whl

Download URL librarian_searxng-0.1.0-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4236b555ea7717792f7b495bda33d9e634b93c020da3c9aa357cdbd31f09f583
BLAKE2b-256 checksum
How to use checksums
c5b39d124411624e6d310d026b979062ffb2f63739fe309debbd628b4c670494
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 29, 2026.

Transparency log

Security for librarian-searxng 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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for librarian_searxng-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 Sep 29, 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.0 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