dsh-web-search-brave: Provide DSH with single HTTP web search using the Brave Search API

Introduction

In DeepSeek Harness (DSH), the model performs web searches by calling the web_search tool through the official web capability seam (ctx.web). The bundled DeepSeek search provider typically consumes a full model turn per search, resulting in higher latency and cost. If you already have a Brave Search API subscription, or prefer “one search = one HTTP GET, without consuming a model turn”, you can switch the search backend to the community plugin huohua-dev/dsh-web-search-brave. This article describes its positioning, installation method, and configuration essentials.

What is This

dsh-web-search-brave (npm package name @huohua-dev/dsh-web-search-brave, current version 0.1.0) is maintained by huohua-dev and categorized as a web tool. It hooks into the DSH official web capability seam, calls the Brave official endpoint https://api.search.brave.com/res/v1/web/search, and maps the web.results[] in the response to the seam-conformant WebSearchResult. From the upper-layer model’s perspective, the tool name remains the stable web_search; only the underlying provider changes to Brave.

As stated in the README: One search is one HTTP request — no model turn, making it lighter and faster than the bundled DeepSeek provider.

Environment and Dependencies

Before installing, confirm:

  1. dsh version 0.1.1-rc.2 or higher;
  2. Node.js >= 20.3.0;
  3. A valid Brave Search API subscription token (available at api-dashboard.search.brave.com; documentation indicates a free tier exists).

Core Features

The following capabilities are drawn from the project README and are summarized here for reference.

Pure Search, No Model Turn

Each web_search corresponds to one HTTP GET, without opening an additional model conversation turn to complete the search.

Security and Request Constraints

  • The subscription token is sent to Brave only via the request header X-Subscription-Token; it does not appear in the URL or in logs;
  • baseURL is locked to the official endpoint by default; if using a custom address, you must explicitly set allowCustomBaseURL: true and use https, to prevent keys from being redirected to another host after configuration injection;
  • Each request has a hard timeout searchTimeoutMs (default 30 seconds) and respects the caller’s abort signal.

Results and Parameters

  • The caller’s maxResults is enforced at the request layer; count does not exceed the configured value or the API limit (20);
  • URL deduplication; page_age is mapped to publishedAt only when it can be parsed as a date.

Proxy and Hot Reloading

  • An optional proxy is supported, defaulting to HTTPS_PROXY / HTTP_PROXY from the startup environment; in scenarios where api.search.brave.com suffers DNS pollution, the hostname can be resolved on the proxy side. This is implemented via lazy loading of undici (optional dependency); if no proxy is configured, this dependency is not loaded.
  • Once mounted, the configuration section is re-read between searches; modifying a profile patch does not require restarting DSH; enabled: false can suspend the provider without unmounting the plugin.

One-Click Provider Switching

The bundled cordis.patch.yml mounts the plugin and switches web.searchProvider from the bundle default deepseek-official to brave.

Installation and Activation

Install from GitHub (command from the original README):

dsh plugin --profile web add github:huohua-dev/dsh-web-search-brave

After installation, the bundle’s patch will automatically mount the plugin and select searchProvider: brave. To revert to the official DeepSeek provider, remove the plugin or override it in the profile’s patch ($DSH_HOME/profiles/<profile>/cordis.patch.yml):

- id: web
  config:
    searchProvider: deepseek-official

Note: The README states that newly installed plugins require a dsh restart to take effect; a running host will not hot-mount new plugins. Configuration changes to already-mounted plugins support hot reloading.

Verify whether the plugin has been mounted successfully:

dsh --profile web --dump-config   # You should see a web-search-brave entry

API Key Configuration

The token is resolved at each search using “first match wins”:

  1. DSH credential service (recommended): Add BRAVE_API_KEY: <your-token> to $DSH_HOME/.credentials.yaml;
  2. Environment variable: export BRAVE_API_KEY=<your-token> before starting dsh (can be renamed via the apiKeyEnv config item);
  3. Literal apiKey in plugin configuration (secret role; it will be masked in settings describe output).

When the key is missing, the search fails with WEB_PROVIDER_CREDENTIAL_MISSING, and the error message reiterates the methods above.

Typical Configuration

All fields are optional. Edit the web-search-brave entry in the profile’s cordis.patch.yml, for example:

- id: web-search-brave
  config:
    apiKeyEnv: BRAVE_API_KEY
    count: 10
    country: cn
    searchLang: zh-hans

Common fields (default values and descriptions per the README table):

Field Default Description
apiKey — Literal token (secret); takes precedence over credential storage once set
apiKeyEnv BRAVE_API_KEY Credential name or environment variable name
baseURL Official web search URL Custom URL requires allowCustomBaseURL: true and https
count 10 Number of results per request (1–20)
country — Two-letter country code, e.g., cn, us
searchLang — e.g., zh-hans, en
freshness — Time filter: pd / pw / pm / py or ISO date range
safesearch moderate strict / moderate / off
textDecorations false Whether to preserve Brave’s <b> highlighting in the summary
proxy HTTPS_PROXY / HTTP_PROXY from environment HTTP proxy for search requests
searchTimeoutMs 30000 Per-request timeout (1000–55000 ms)
enabled true Master switch

Typical Usage

  1. Complete the installation as described above, configure BRAVE_API_KEY, and restart dsh (for newly installed plugins).
  2. Run dsh --profile web --dump-config to confirm that web-search-brave is mounted and searchProvider is brave.
  3. In the conversation, let the model use the web_search tool; the interface on the model side is identical to the bundled provider, so no changes to the tool name in the prompt are needed.

Development-side self-testing (for maintainers):

npm install
npm test    # vitest; the README states 43 test cases

The package contains hand-written ESM source code with no additional build step.

Use Cases and Notes

Who Is It For

  • Users who already use or plan to use Brave Search API and want DSH web search without consuming model turns;
  • Users who need region-specific search via parameters such as country / searchLang;
  • Users whose network environment requires accessing api.search.brave.com through an HTTP proxy.

Please Be Aware Before Use

  • The DSH ecosystem emphasizes “everything is a plugin”; the SkillHub catalog page is a community site with no official affiliation with DeepSeek / Huanfang.
  • The plugin runs under the current dsh process’s permissions; the outbound target is only the Brave API (or an explicitly allowed https mirror). Before installing, it is recommended to read the source code and the MIT license; the README states there is no telemetry, no install hooks, and no !!js expressions in the bundled patch.
  • The project README acknowledges the official DeepSeek search plugin and community implementations of the same kind; the structure and error semantics are aligned with @deepseek-ai/dsh-web-search-deepseek.

Conclusion

huohua-dev/dsh-web-search-brave connects DSH’s web_search to the Brave Search API: one HTTP request per search, conservative token and endpoint policies, with support for proxying and hot configuration reloading. If your profile is already web, simply follow the README installation command to add the plugin, configure BRAVE_API_KEY, and restart to switch the provider.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye