← Back to PRs

#13843: feat(web-search): allow overriding Brave Search base URL

by strelov1 open 2026-02-11 03:06 View on GitHub →
agents stale
## Summary - Add `baseUrl` option for the Brave Search provider to support proxying or custom endpoints - Resolved from config `tools.web.search.baseUrl` or `BRAVE_SEARCH_BASE_URL` env var - Defaults to `https://api.search.brave.com/res/v1/web/search` when neither is set - Follows the same pattern as the existing Perplexity `baseUrl` override ## Configuration ```json { "tools": { "web": { "search": { "provider": "brave", "baseUrl": "https://my-proxy.example.com/v1/web/search" } } } } ``` Or via environment variable: ``` BRAVE_SEARCH_BASE_URL=https://my-proxy.example.com/v1/web/search ``` Priority: config > env > default. ## Changed files - `src/agents/tools/web-search.ts` — `resolveBraveBaseUrl()` function, wired into `runWebSearch` - `src/config/types.tools.ts` — `baseUrl` field added to search config - `src/config/zod-schema.agent-runtime.ts` — `baseUrl: z.string().url().optional()` validation ## Test plan - [x] All existing tests pass (25 tests) - [ ] Manual test with custom base URL <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds a `baseUrl` override for the Brave web search provider, resolved from runtime config (`tools.web.search.baseUrl`) or `BRAVE_SEARCH_BASE_URL`, and threads it through to `runWebSearch` so requests can target a proxy/custom endpoint. Config typing and runtime schema validation were updated to accept the new optional URL field alongside the existing provider/apiKey settings. <h3>Confidence Score: 3/5</h3> - Reasonably safe to merge after fixing a cache key correctness issue for Brave baseUrl overrides. - The change is small and follows an existing pattern, but the newly introduced `braveBaseUrl` parameter is not included in the Brave cache key, which can return incorrect cached results when the endpoint differs. - src/agents/tools/web-search.ts <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs