← Back to PRs

#12304: feat: add DeSearch as web_search provider

by tatjr13 open 2026-02-09 03:26 View on GitHub →
agents size: M
## Summary Adds [DeSearch](https://desearch.ai/) as a third `web_search` provider alongside Brave and Perplexity. DeSearch is a decentralized AI search engine built on the Bittensor network (Subnet 22). It provides real-time web search results through a simple REST API. **What this PR does:** - Adds `"desearch"` to the provider union in config schema, types, and Zod validation - Implements `runDesearchSearch()` using the `GET /web` endpoint (`api.desearch.ai/web?query=...&num=...&start=0`) - Maps DeSearch results (title, snippet, link, date, source) to OpenClaw's standard result format — identical shape to Brave results - Auth uses raw API key in `Authorization` header (no Bearer prefix), matching the [official Python SDK](https://github.com/Desearch-ai/desearch.py) - Supports config-based and env var (`DESEARCH_API_KEY`) API key resolution - Adds config UI labels and help text for DeSearch fields - Adds 2 test cases for DeSearch config validation (full config + minimal config) **Config example:** ```json { "tools": { "web": { "search": { "provider": "desearch", "desearch": { "apiKey": "dt_...", "baseUrl": "https://api.desearch.ai" } } } } } ``` **Files changed:** - `src/agents/tools/web-search.ts` — DeSearch provider logic, types, resolvers - `src/config/schema.ts` — Field labels + help text - `src/config/types.tools.ts` — TypeScript type for desearch config block - `src/config/zod-schema.agent-runtime.ts` — Zod validation schema - `src/config/config.web-search-provider.test.ts` — Config validation tests Follows the same pattern as the existing Perplexity provider and the Tavily PR (#11978). Refs: Discussion #5342 ## Test plan - [x] TypeScript type check passes (`tsc --noEmit` — exit 0) - [x] All 972 test files pass (6680 tests, 0 failures) - [x] New DeSearch config validation tests pass (2 tests) - [ ] Manual test with DeSearch API key (set `provider: "desearch"` + `DESEARCH_API_KEY`) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds DeSearch as a third `web_search` provider alongside Brave and Perplexity. It extends config types/Zod schema/UI labels, resolves DeSearch credentials from config or `DESEARCH_API_KEY`, calls the DeSearch `/web` REST endpoint, and maps results into the existing `{title,url,description,published,siteName}` shape used by Brave. Overall the integration follows the existing provider patterns and includes config validation tests for the new provider. <h3>Confidence Score: 4/5</h3> - Mostly safe to merge, but needs a security guardrail on configurable DeSearch baseUrl. - Changes are localized and follow existing patterns with tests for config parsing. The main concern is that a user-configurable baseUrl is used for requests that include a raw API key in the Authorization header; without enforcing HTTPS, misconfiguration can leak credentials. - src/agents/tools/web-search.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs