@weclio/pi-web-search
v0.2.0
Published
Pi extension for native web search with Tavily search and fetch fallback.
Maintainers
Readme
@weclio/pi-web-search
Standalone Pi extension for native web search, with Tavily search and page extraction as a fallback. No separate Tavily extension is needed.
Install
pi install -l npm:@weclio/pi-web-searchAfter installation, restart Pi from the project directory.
Routing
OpenAI OAuth (
openai-codex) on the officialhttps://chatgpt.com/backend-apiendpoint uses native search by default, regardless of model ID.Other endpoints opt in with
web-search.jsonin the Pi agent directory (usually~/.pi/agent, orPI_CODING_AGENT_DIR). Match the provider, effective base URL and model ID. Example for a gateway already verified to support Responses web search:[ { "provider": "my-gateway", "baseUrl": "https://gateway.example/v1", "modelId": "verified-model-id" } ]Without a matching native route, configuring Tavily enables both
web_search(find pages) andweb_fetch(read a known public URL). On the native route neither Tavily tool is active. Tavily receives the query or URL(s), not the conversation.Tools Off or
PI_WEB_SEARCH=0disables both routes. Routing happens before requests; it does not retry a rejected native request with Tavily.
Native injection currently supports OpenAI Responses, Codex Responses and Azure OpenAI Responses. A listed endpoint on another protocol falls back to Tavily if available. The extension does not infer web search support from the protocol alone.
Results keep source URLs without an extra plugin. With Weclio citations loaded, successful Tavily search and fetch results also receive citation markers next to their evidence.
Tavily API key
- Copy the bundled
tavily.example.jsontotavily.jsonin your Pi agent directory (usually~/.pi/agent, orPI_CODING_AGENT_DIRif set). - Set the
apiKeyfield to your Tavily API key. The next turn reads the file; no restart is needed.
A non-empty TAVILY_API_KEY environment variable takes precedence. tavily.json stores the key in plaintext: keep it private. Share the empty example, not a file with a live key.
Development
Requires Pi >=1.0.2. Run npm run check from the workspace or npm run typecheck / npm test from this directory.
