← Catalog

@thgilciffart/pi-websearch

Web search tool for the pi coding agent with one web_search tool, 10 providers, automatic fallback, and direct API calls, so a search costs the API price, not model tokens.

Extension

Install

Install with PiG

pig install npm:@thgilciffart/pi-websearch

Install with Pi

pi install npm:@thgilciffart/pi-websearch
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.2.1 (README.md). PiG does not review it.

pi-websearch

Web search tool for the Pi coding agent with one web_search tool, 10 providers, automatic fallback, and direct API calls, so a search costs the API price, not model tokens.

Install

pi install npm:@thgilciffart/pi-websearch

Set a provider's environment variable before starting Pi, or use DuckDuckGo without a key. Run /reload after installation in an open session.

export BRAVE_SEARCH_API_KEY="your-key"
pi

Run /websearch to check provider status, or /websearch <query> for a three-result test search.

Providers

Automatic selection uses the first configured, enabled provider in this order:

ProviderEnvironment variable
tavilyTAVILY_API_KEY
braveBRAVE_SEARCH_API_KEY, alias BRAVE_API_KEY
serperSERPER_API_KEY
exaEXA_API_KEY
perplexityPERPLEXITY_API_KEY
youcomYDC_API_KEY, aliases YOU_API_KEY, YOUCOM_API_KEY
parallelPARALLEL_API_KEY
linkupLINKUP_API_KEY
searxngSEARXNG_URL, the instance base URL
duckduckgoNone. Uses an unofficial HTML endpoint that may be rate-limited or blocked.

Configure providers

On first run, the extension creates ~/.pi/agent/web-search/config.json with all providers listed. Existing files remain intact. Project settings in .pi/web-search.json override global settings field by field. Environment variables override credentials.

{
	"defaultProvider": "brave",
	"maxResults": 8,
	"providers": {
		"brave": { "apiKey": "your-key" },
		"searxng": { "baseUrl": "http://localhost:8080" },
		"duckduckgo": { "enabled": false }
	}
}
SettingEffect
defaultProviderDefault provider ID. "auto" uses the first available provider.
fallbackOrderProvider IDs to prioritize before the built-in order.
maxResultsDefault result count. Defaults to 5, capped at 20.
providers.<id>.enabledfalse prevents all use of that provider, including explicit requests.
providers.<id>.apiKeyCredential when no environment variable supplies one.

Provider-specific options include parallel.mode, linkup.depth, exa.type, serper.gl, serper.hl, perplexity.contextSize, and youcom.highlights. SearXNG uses baseUrl instead of apiKey.

Tool reference

ParameterMeaning
queryRequired search text.
providerProvider ID. Omit for automatic selection and fallback.
max_resultsResult count from 1 to 20. Defaults to the configured count.
time_rangeday, week, month, or year. Support varies by provider.
include_domainsArray of domains to include.
exclude_domainsArray of domains to exclude.

An automatic search tries at most three providers if requests fail. Naming a provider disables fallback. Cancellation stops retry waits and further fallback requests.

Results include the answering provider and structuredContent with provider, query, and results.

Develop

bun install
./scripts/link-pi-types.sh
bun run typecheck
bun test
pi -e ./src/index.ts

To add a provider, implement SearchProvider in src/providers/ and register it in src/providers/index.ts.

MIT license.