feat(brave): add BraveWebSearch integration#3237
Conversation
Implements BraveWebSearch component for Haystack using the Brave Search API. Follows the same structure as TavilyWebSearch. - sync run() and async run_async() via httpx - top_k, country, search_lang, extra_params configuration - per-run top_k override - returns documents (content = description) and links - 11 unit tests, 2 integration tests (skipped without API key) Closes deepset-ai#3236
|
Hey @anakin87 all CI checks are now passing (including the API reference build). Whenever you have a chance to review, that would be great! |
anakin87
left a comment
There was a problem hiding this comment.
Left two initial comments.
Have you run yourself tests using the Brave API key?
umm no let me address the comments then check via Brave Api key , would you refer me the documention so it would be easy for me too.. |
|
Hey @anakin87 I tried to get a Brave API key for testing, but Brave has removed their free tier as of late 2025 and now requires a credit card for the $5/month metered plan. Would it be possible to verify the integration tests via a CI secret, or would you like me to proceed another way? The integration tests are already gated with |
I'll proceed with review and testing when I have some time. For the future, I'd like to invite you to only contribute to integrations you can test completely locally. |
anakin87
left a comment
There was a problem hiding this comment.
Tests pass but:
- .github/workflows/brave.yml - no CI workflow exists
- .github/labeler.yml - no integration:brave label rule
- .github/workflows/CI_coverage_comment.yml - brave isn't registered. Add it.
- Root README.md - brave isn't listed in the integrations table.
- Add .github/workflows/brave.yml CI workflow - Register 'Test / brave' in CI_coverage_comment.yml - Add integration:brave label rule to labeler.yml - Fix README.md: remove stale CHANGELOG link - Add brave-search-haystack row to root README table
- Fix broken doc links: api.search.brave.com -> api-dashboard.search.brave.com - Add timeout and max_retries params to BraveWebSearch.__init__() - Replace httpx.Client/AsyncClient with request_with_retry/async_request_with_retry - Update tests to mock request_with_retry instead of httpx directly - Restore CHANGELOG link in README.md (keep this) - Fix alphabetical order of brave row in root README.md
anakin87
left a comment
There was a problem hiding this comment.
Two final comments.
I'd invite you, if you use code agents, to review their outputs yourself before committing.
anakin87
left a comment
There was a problem hiding this comment.
I added license.
Merging now
Related Issues
Proposed Changes:
Adds
BraveWebSearch, a new Haystack component that wraps the Brave Search API.Follows the same structure as the existing
TavilyWebSearchintegration:run()for sync usage,run_async()for async usage (both viahttpx)documents(content = result description) andlinks(result URLs)top_k,country,search_lang, andextra_paramsconfigurable at init timetop_koverride supportedAPI response mapping:
Brave Search returns results under
web.results. Each result'sdescriptionbecomes the Document content, withtitleandurlstored inmeta.How did you test it?
11 unit tests covering:
to_dict/from_dict)run()returns correct documents and linkscount,country,search_lang)top_koverriderun_async()returns correct resultswebkey handled gracefully2 integration tests skipped unless
BRAVE_API_KEYis set.Notes for the reviewer
Uses
httpx(syncClientforrun(),AsyncClientforrun_async()) rather than a dedicated SDK, since Brave Search has no official Python client.httpxis a well-maintained library already used widely in the Python ecosystem.Checklist
feat: