dsh-web-search-searchapi: The Web Search Backend for DeepSeek Harness SearchApi

Introduction

In DeepSeek Harness (DSH), the web_search tool relies on a backend to retrieve web page content. Existing solutions either require configuring multiple services or involve complex state management. DSH’s plugin-based design allows us to add only the necessary functionality. This article introduces a plugin that provides a single backend for DSH’s web service, returning Google search results as structured sources.

Plugin Scope

gabsferreira/dsh-web-search-searchapi is a SearchApi search provider serving the web service (ctx.web) of DeepSeek Harness. Its responsibility is singular: receive the query from the web_search tool, call SearchApi’s Google engine, and return organic search results as structured sources.

Core Features

  • A single GET request to https://www.searchapi.io/api/v1/search?engine=google
  • Maps SearchApi’s organic_results[] to { url, title, snippet, publishedAt }
  • Respects the maxResults limit
  • In default mode, follows Google’s google.com/goto redirect links once (processed in parallel, 0.1s each)
  • Clear error handling: missing credentials, non-success HTTP status, timeout, cancellation

Installation & Activation

The plugin is installed via the plugin manager:

dsh plugin --profile web add github:gabsferreira/dsh-web-search-searchapi

After installation, the plugin mounts the provider and points the web service’s searchProvider to searchapi, while keeping fetchProvider: http unchanged. No additional wiring is required—the only prerequisite is an API key.

Storing the API Key

The key can be stored via the credentials service or provided through an environment variable.

Credentials Service

Write the following in $DSH_HOME/.credentials.yaml:

version: 1
refs:
  SEARCHAPI_API_KEY: your-key

This file should maintain chmod 600 permissions.

Environment Variable

Set it in the environment variables when launching dsh:

SEARCHAPI_API_KEY=your-key dsh web

The key is resolved on every search (credentials service first, then environment variable), so key rotation does not require a restart.

Configuration

Configuration items are set under the web-search-searchapi line in $DSH_HOME/profiles/<profile>/cordis.patch.yml:

- id: web-search-searchapi
  config:
    apiKeyEnv: SEARCHAPI_API_KEY
    gl: br
    hl: pt
Option Default Description
apiKeyEnv SEARCHAPI_API_KEY Credentials reference and environment variable name
apiKey Literal key; using the credentials service is recommended
engine google Engine that supports organic_results (e.g., bing, duckduckgo)
gl, hl Google region and language codes
resolveLinks true true: follow Google goto redirects in-process; 'api': let SearchApi resolve server-side (complete but slower); false: do not follow
linkTimeoutMs 3000 Timeout for a single redirect link (milliseconds)
timeoutMs 30000 Timeout for the entire search (milliseconds)
baseURL https://www.searchapi.io/api/v1/search API endpoint

Note: config replaces the configuration for that line. When adding new config items, you must repeat apiKeyEnv.

Mapping Notes

  • The num parameter is not sent: Google has deprecated it, and SearchApi’s documentation states it is a constant of 10. maxResults is enforced again after mapping.
  • publishedAt: When SearchApi’s date is an absolute date, it is constructed as an ISO calendar date (e.g., 2026-10-12); relative dates (e.g., “2 days ago”) are discarded.
  • Google provides some organic links as 302 redirects in the form https://www.google.com/goto?url=…. In default mode, each link is followed once in-process (in parallel, ~0.1s each, without reading the response body). Google sometimes returns a “verifying your request” page instead of a redirect; in that case, the link is kept as-is and will still redirect when opened manually. SearchApi’s link=resolved mode waits for verification to pass server-side, so it is complete but slower (adds 26–28 seconds per search).
  • Errors are unified into WebError, and the tool result retains a structured code: WEB_PROVIDER_CREDENTIAL_MISSING, WEB_PROVIDER_ERROR (includes status on HTTP failure), WEB_ABORTED. SearchApi’s error message is appended to the error when the response body is JSON; it is not for key errors.

Use Cases & Cautions

Suitable for DSH users who want to use the web_search tool with minimal configuration to access Google search results.

Please review the source code and license before installation. The plugin runs with the current dsh process permissions—ensure your environment and dependencies meet the requirements.

Conclusion

This plugin integrates SearchApi’s Google search capability into DSH’s web service, providing structured sources for web_search. Installation is straightforward, configuration is optional, and it suits scenarios requiring a stable web search backend.

Directory | GitHub

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

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

Xiaoye