#16416: feat(web-search): include Brave structured faq/discussions/infobox results
agents
size: S
Cluster:
Web Search Provider Enhancements
## Summary
- feat(web-search): include Brave structured faq/discussions/infobox results
- Split from our `v2026.2.13` patch train as a single-purpose change for easier review.
## Why
- Keep the diff focused and low-risk so it can be merged or reverted independently.
## Scope
- Branch: `feat/brave-structured-results-lite-en`
- Files changed: 2
- Key files:
- `src/agents/tools/web-search.ts`
- `src/agents/tools/web-tools.enabled-defaults.e2e.test.ts`
## Test Plan
- Suggested local command:
- `./node_modules/.bin/vitest run src/agents/tools/web-tools.enabled-defaults.e2e.test.ts`
- Validation status:
- [ ] CI checks pass
- [ ] Maintainer re-ran local tests
## Risk & Rollback
- Risk: low to medium; impact limited to touched module(s).
- Rollback: revert this PR commit(s) cleanly.
## Co-authorship
- Co-authored by @ciberponk and Codex (GPT-5).
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR enriches Brave Search results by extracting and forwarding three additional structured data types from the Brave API response: **discussions** (forum threads with top comments), **FAQ** entries, and **infobox** panels. All external text content is properly wrapped via `wrapWebContent` for security, while URLs are passed through unwrapped — consistent with the existing web result handling pattern.
- Extends `BraveSearchResponse` type with `discussions`, `faq`, and `infobox` fields
- Adds formatting/filtering logic that mirrors the existing web results pattern: map, wrap content, filter empty entries, conditionally spread into payload
- New structured fields are only included when non-empty, keeping the payload backward-compatible
- Adds a well-structured e2e test covering all three new result types with security wrapping assertions
- No issues found; the implementation is clean, follows existing conventions, and handles edge cases (empty/missing data) correctly
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge — it is purely additive, follows existing security and coding patterns, and includes test coverage.
- The changes are well-scoped: a type extension, additive data formatting that reuses the established `wrapWebContent` security wrapper, conditional payload inclusion that preserves backward compatibility, and a thorough e2e test. No existing behavior is modified, no new dependencies are introduced, and all external content is properly wrapped. The code follows the existing patterns in the file closely.
- No files require special attention.
<sub>Last reviewed commit: cffd911</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16413: feat(web-search): request and merge Brave extra_snippets
by ciberponk · 2026-02-14
84.2%
#16417: feat(web-search): enable Brave text_decorations by default
by ciberponk · 2026-02-14
80.5%
#19314: feat: add Brave web_search baseUrl override (AI-assisted)
by mrutunjay-kinagi · 2026-02-17
74.2%
#19042: Security: add URL allowlist for web_search and web_fetch
by smartprogrammer93 · 2026-02-17
73.9%
#19298: feat(tools): add Brave LLM Context API mode for web_search
by RoccoFortuna · 2026-02-17
72.6%
#13370: Tools: rewrite Grok parser, add Tavily provider, multi-provider con...
by a-anand-91119 · 2026-02-10
72.4%
#23306: fix(web-search): hint at config validation failure in missing-key e...
by lbo728 · 2026-02-22
72.2%
#19084: fix: Brave Search baseUrl and Inter-session Message Role
by jackjin1997 · 2026-02-17
72.1%
#19379: feat: increase Brave search MAX_SEARCH_COUNT to 20 (AI-assisted)
by liyishuai · 2026-02-17
71.9%
#19031: fix(web-search): normalize ui_lang parameter for Brave Search API
by moxunjinmu · 2026-02-17
70.7%