pi-searxng-search-turbo

Feature-complete, performance-optimized SearXNG web_search and streaming web_fetch tools for Pi.

Packages

Package details

extension

Install pi-searxng-search-turbo from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-searxng-search-turbo
Package
pi-searxng-search-turbo
Version
0.1.0
Published
Aug 4, 2026
Downloads
209/mo · 16/wk
Author
patlux
License
MIT
Types
extension
Size
23.7 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./extensions/searxng-search.js"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-searxng-search-turbo

Feature-complete, performance-optimized web_search and streaming web_fetch tools for Pi, backed by a SearXNG instance.

The turbo distribution preserves the complete tool surface while reducing memory use. It bounds downloaded and retained data before converting or formatting it. Large fetch responses are processed incrementally and cancelled as soon as the model-facing output limit is reached.

Requirements

  • Node.js 22 or newer
  • Pi
  • A SearXNG instance with JSON search enabled

The default SearXNG URL is:

http://127.0.0.1:8888

Override it with SEARXNG_URL.

Install

pi install npm:pi-searxng-search-turbo

Or test it for one Pi invocation:

pi -e npm:pi-searxng-search-turbo

Reload an already-running Pi session after installation:

/reload

Tools

web_search

Runs a SearXNG JSON search and returns deduplicated, formatted results.

Parameters:

  • query
  • preset: general, news, code, docs, packages, or qa
  • categories: raw SearXNG category override
  • language: defaults to en-US
  • timeRange: day, week, month, or year
  • maxResults: 1–20, defaults to 8

web_fetch

Fetches HTTP(S) text, JSON, XML, JavaScript, or HTML content. HTML is converted to text incrementally. Use offset to continue from a later line.

Resource limits

  • model-facing fetch/search output: 50 KiB or 2,000 lines
  • successful SearXNG JSON response: 1 MiB before parsing
  • SearXNG error body: 1,000 bytes or 20 lines
  • bounded individual result fields
  • stream cancellation after an output or response limit
  • UTF-8-safe byte truncation
  • no background processes, persistent clients, or caches

Configuration

Variable Default Purpose
SEARXNG_URL http://127.0.0.1:8888 SearXNG base URL
SEARXNG_LANGUAGE en-US Default search language
SEARXNG_CATEGORIES preset-specific Override categories for all presets

Development

Run regression tests:

npm test

Run the reproducible before/after memory benchmark:

npm run benchmark

Run all package checks:

npm run check

The benchmark executes every source/scenario in a fresh Node process and reports median peak RSS and retained heap. benchmarks/baseline/searxng-search.js is the pre-streaming implementation retained solely as a reproducible comparison fixture; it is not loaded by the Pi package.

Covered behavior includes streaming limits, byte and line truncation, UTF-8 boundaries, CRLF chunks, aborts, HTML conversion, error handling, response-size limits, offsets, search parameter contracts, and URL deduplication.

Security

Fetched pages and search results are untrusted third-party content. The extension returns their text as tool output; it does not execute page scripts. Only http:// and https:// fetch targets are accepted.

License

MIT