← Catalog

pi-byted-web-search

Doubao Search extension for pi coding agent

Extension

Install

Install with PiG

pig install npm:pi-byted-web-search

Install with Pi

pi install npm:pi-byted-web-search
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.4.0 (README.md). PiG does not review it.

中文 | English

A pi coding agent extension that provides web search capabilities via the Doubao Search API (Volcano Engine).

API reference snapshots (Custom/Global versions) live in docs/api/. They are captured from the official docs and may lag behind — always verify against the live Volcano Engine docs.

Features

  • Web Search Tool - Registers a doubao_web_search tool the LLM can call autonomously
  • Dual API Versions — Custom version (Chinese content, richer filters) and Global version (international content)
  • Multi API Key — Round-robin key pool with automatic failover on rate limits and quota exhaustion
  • Billing Type Aware — Distinguishes postpaid vs subscription keys; Global version only uses postpaid keys
  • Token Efficient — Three detail levels (brief / summary / full), output truncation with truncateHead
  • Cancellation — Passes AbortSignal to fetch; pressing Esc cancels in-flight requests
  • Custom TUI Rendering — Compact collapsed view, expandable result preview

Installation

pi install npm:pi-byted-web-search

From GitHub

pi install git:github.com/zzwtsy/pi-byted-web-search

Try without installing

pi -e git:github.com/zzwtsy/pi-byted-web-search

From source (development)

git clone https://github.com/zzwtsy/pi-byted-web-search.git
cd pi-byted-web-search
pi install .

Configuration

API Keys (required)

# Multiple keys (comma-separated, recommended)
export DOUBAO_SEARCH_API_KEYS=key1,key2,key3

# Single key
export DOUBAO_SEARCH_API_KEY=key1

Keys can be tagged with billing type using a prefix:

export DOUBAO_SEARCH_API_KEYS=postpaid:key1,subscription:key2

Untagged keys default to postpaid.

Get your API keys from the Volcano Engine console.

Config File (optional)

Global: ~/.pi/agent/doubao-search.json Project: .pi/doubao-search.json (overrides global)

{
  "defaultVersion": "custom",
  "defaultCount": 5,
  "defaultDetailLevel": "summary",
  "contentFormat": "markdown",
  "queryRewrite": false,
  "authInfoLevel": 0,
  "industry": null,
  "maxSnippetLength": 1000,
  "requestTimeoutMs": 10000,
  "rateLimitCooldownMs": 60000,
  "postpaidKeys": ["key1"],
  "subscriptionKeys": ["key2"]
}

Usage

Once configured, the LLM can call doubao_web_search automatically when it needs real-time information:

> What's new in Python 3.13?

[LLM calls doubao_web_search with query="Python 3.13 release date"]

✓ 5 results (custom, 372ms)

Tool Parameters

ParameterTypeDefaultDescription
querystring—Search query, 1-100 chars
countinteger5Number of results (1-10)
version"custom" | "global"customAPI version
detail_level"brief" | "summary" | "full"summaryResult detail level
time_rangestring—OneDay / OneWeek / OneMonth / OneYear / YYYY-MM-DD..YYYY-MM-DD (Custom only)
sitesstring—Restrict to domains, pipe-separated (Custom only)
block_hostsstring—Exclude domains, pipe-separated (Custom only)
include_imagesbooleanfalseInclude up to 3 image snippets per result (Global only)

Commands

  • /doubao-keys — Open the interactive API key pool status panel (↑/↓ to select, Esc to close, live refresh)

Error Handling & Retries

  • Rate limits (700429) and quota exhaustion (10406/10412/etc.) automatically fail over to the next API key
  • Internal errors (10500/10501, documented as retryable by Volcano Engine) retry once on the same key with exponential backoff + jitter, then fail over
  • Connection-level network errors fail over to the next key; timeouts are not retried (the request may have been billed)
  • Parameter errors (10400 etc.) fail fast with the API error message
  • All keys unavailable → error with per-key status (keys are masked in status output)
  • User cancellation (Esc) returns a friendly message instead of an error

Caching

Search results are cached in-memory with a configurable TTL (cacheTtlMs, default 5 minutes). Repeated searches with identical parameters return cached results instantly without consuming API quota. Set cacheTtlMs to 0 to disable caching.

API Version Comparison

(blank)CustomGlobal
Best forChinese content, richer filtersInternational content
Max results5020
Time/site filteringYesNo
Content fieldsSnippet / Summary / ContentSnippet only
BillingPostpaid & SubscriptionPostpaid only
Latency~700ms avg~1053ms avg

License

MIT