What
Adds Serply as an alternative provider for the web_search tool. If TAVILY_API_KEY
is not set but SERPLY_API_KEY is, the tool uses Serply instead of returning an error.
Why
web_search currently hard-requires Tavily. Serply is a SERP API (Google/Bing, plus
Scholar and other verticals) that passes the query straight through as Google search
syntax, so dork operators (site:, filetype:, intitle:) work unmodified, which is
useful for recon in a pentest agent. Existing behavior with Tavily is unchanged, and the
tool still works with neither key set (same error path, just mentioning both options).
Notes
- Response fields normalized to the same shape
_format_resultsalready expects from Tavily, so no duplicate formatting logic. - Serply sits behind Cloudflare and rejects the default httpx User-Agent, so the request sends an explicit one.
Testing
Ran web_search directly with SERPLY_API_KEY set and TAVILY_API_KEY unset, using a
dork-style query (site:github.com filetype:env ...), and got back real results with
titles and links in the same format as the existing Tavily output. Also confirmed the
tool still returns the original error message when neither key is set.
Disclosure: I work with Serply. Happy to adjust scope, naming, or drop this entirely if it isn't a direction you want for the project.