← Back to PRs

#17703: feat(web-search): add Parallel search provider

by raktim-mondol open 2026-02-16 03:16 View on GitHub →
commands agents stale size: M
feat(web-search): add Parallel search provider This PR adds support for Parallel (parallel.ai) as a web search provider alongside Brave, Perplexity, and Grok. ## Features - New provider option: `tools.web.search.provider = "parallel"` - Configurable mode: one-shot (default), agentic, or fast - API key via `PARALLEL_API_KEY` env var or config - CLI wizard support for easy configuration ## Configuration Example ```yaml tools: web: search: enabled: true provider: parallel parallel: apiKey: "your-parallel-api-key" mode: "one-shot" # one-shot | agentic | fast maxResults: 10 maxCharsPerResult: 10000 ``` ## API Details - Base URL: https://api.parallel.ai/v1beta - Endpoint: /search - Docs: https://docs.parallel.ai ## Files Changed - `src/agents/tools/web-search.ts` - Core implementation - `src/config/types.tools.ts` - Type definitions - `src/config/zod-schema.agent-runtime.ts` - Schema validation - `src/config/schema.help.ts` - Field metadata - `src/commands/configure.wizard.ts` - CLI wizard support <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds Parallel (parallel.ai) as a fourth web search provider alongside Brave, Perplexity, and Grok. The implementation spans config types, Zod validation, schema help text, CLI wizard support, and the core search logic in `web-search.ts`. - **Config & schema changes** (`types.tools.ts`, `zod-schema.agent-runtime.ts`, `schema.help.ts`): Clean additions that follow existing patterns for Perplexity and Grok. Parallel config supports `apiKey`, `baseUrl`, `mode` (one-shot/agentic/fast), `maxResults`, and excerpt limits. - **CLI wizard** (`configure.wizard.ts`): Well-structured refactoring that upgrades the wizard from Brave-only to a multi-provider selector with per-provider key prompts and a Parallel mode selector. - **Core implementation** (`web-search.ts`): Adds the `runParallelSearch` function, config resolvers, and result mapping. One cache key issue found: excerpt config (`maxCharsPerResult`, `maxCharsTotal`) is omitted from the Parallel cache key, which could cause stale results if these values differ between tool instances sharing the module-level `SEARCH_CACHE`. The file has grown to 998 LOC (project guideline is ~700 LOC); consider extracting per-provider logic into separate modules in a follow-up. - **Tests**: The new `resolveParallel*` functions are exported via `__testing` but the existing test file (`web-search.e2e.test.ts`) doesn't import or test them. Adding unit tests would improve confidence in the config resolution logic. <h3>Confidence Score: 3/5</h3> - This PR is likely safe to merge but has a cache key bug and lacks test coverage for the new provider logic. - The implementation follows existing patterns well and the config/schema/wizard changes are clean. Score is 3 rather than higher due to: (1) a cache key bug where Parallel excerpt configuration is not included, risking stale cached results; (2) no unit tests for the newly exported resolver functions; (3) two previously flagged security issues (missing externalContent metadata and unwrapped raw excerpts) that still need addressing. - Pay close attention to `src/agents/tools/web-search.ts` — specifically the cache key construction (line 715) and the result mapping block (lines 793-815) where previously flagged security issues exist. <sub>Last reviewed commit: 5c2e8cf</sub> <!-- greptile_other_comments_section --> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) <!-- /greptile_comment -->

Most Similar PRs