npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ocramz/pi-web-search

v0.1.0

Published

Web search for the pi agent: one agent tool per search backend. First backend: Tavily.

Readme

pi-web-search

Web search for the pi coding agent: one agent tool per search backend, each normalising into a shared result shape (title, URL, text excerpt) sized for a model's context.

Tools

| Tool | Backend | Key | |---|---|---| | web_search_tavily | Tavily | TAVILY_API_KEY |

web_search_tavily parameters: query (required), max_results (default 5), topic (general/news), search_depth (basic/advanced), time_range (day/week/month/year or shorthand like 3d), start_date/end_date (YYYY-MM-DD), include_answer, include_domains/exclude_domains. The rest of the Tavily request body (images, favicons, raw content, usage accounting) is pinned to text-only defaults — see src/tavily.ts, which is one curl call:

curl --request POST \
  --url https://api.tavily.com/search \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{"query": "who is Leo Messi?", ...}'

Install

pi install npm:@ocramz/pi-web-search

Needs Node 24 or later — the package ships TypeScript and relies on Node's native type stripping, so there is no build step and nothing to compile.

For local development, point pi at a checkout instead:

pi install /path/to/pi-web-search      # user settings, ~/.pi/agent/settings.json
pi install -l /path/to/pi-web-search   # project settings, .pi/settings.json
pi -e /path/to/pi-web-search           # this run only, nothing written

Project-scoped packages (-l) load only once the project is trusted; a user-scoped install has no such gate.

Setup

Export TAVILY_API_KEY before starting pi. Installing the package is not enough on its own: the key is a runtime requirement, read at tool-execute time rather than at load time. A missing key is a readable tool result telling the model (and through it, you) what to set — never a crash.

Adding a backend

One file in src/ exporting a search(apiKey, opts) that returns the shared SearchOutcome from src/types.ts, one pi.registerTool call in extensions/index.ts, and (if it makes live calls) one line in test/tui/live.test.ts's required-keys list. The formatter in src/format.ts takes any backend's SearchResponse.

Tests

Four tiers, registered through the repo Makefile like every extension:

  • npm test — unit: request construction, normalisation, truncation and error paths, against a stubbed fetch. No network.
  • npm run typecheck — tsc against pi's real declarations.
  • npm run test:tui — live: a real model drives web_search_tavily through pi's TUI in a pty. Needs both OPENROUTER_API_KEY and TAVILY_API_KEY in the repo-root .env; it refuses to start without them rather than skipping quietly.
  • npm run test:container — the unit suite again inside the pinned distroless image, as the unprivileged user with no node_modules.