← Back to PRs

#10839: feat(web-search): add Bocha as a web search provider

by xiekeyang open 2026-02-07 02:45 View on GitHub →
agents stale
## Summary - Add **Bocha** ([bocha.cn](https://bocha.cn)) as a third web search provider alongside Brave and Perplexity - Bocha provides real-time web search with strong support for Chinese language content - Implements the same `SearchResult` interface pattern used by existing providers ## Configuration | Key | Description | |---|---| | `tools.web.search.provider` | Set to `"bocha"` | | `tools.web.search.bocha.apiKey` | API key (or set `BOCHA_API_KEY` env var) | | `tools.web.search.bocha.baseUrl` | Defaults to `https://api.bocha.cn/v1/web-search` | ## Files changed - `src/agents/tools/web-search.ts` — Bocha provider implementation - `src/config/schema.ts` — field help text for Bocha config - `src/config/types.tools.ts` — TypeScript types for Bocha options - `src/config/zod-schema.agent-runtime.ts` — Zod validation for Bocha config ## Test plan - [ ] Verify `pnpm build` passes with the new provider types - [ ] Verify `pnpm check` (lint/format) passes - [ ] Verify `pnpm test` passes - [ ] Manual test: configure Bocha provider and run a web search query 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> - Adds a third `web_search` provider (Bocha) alongside Brave and Perplexity, including request/response mapping and config resolution. - Extends config help text, TypeScript config types, and runtime Zod validation to support `tools.web.search.bocha.*`. - Integrates Bocha results into the existing `SearchResult`-style payload returned by `web_search` and reuses the shared caching/timeout utilities. <h3>Confidence Score: 3/5</h3> - This PR is close to mergeable but has correctness issues around Bocha endpoint handling and caching behavior. - Core wiring (provider selection, config schema/types, request mapping) is consistent with existing providers, but the Bocha `baseUrl` semantics are inconsistent with the help text and can cause guaranteed request failures depending on how users configure it. Additionally, cache keys for non-Brave providers don’t include provider-specific base URLs, so config changes can yield incorrect cached responses. - 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