← Back to PRs

#19379: feat: increase Brave search MAX_SEARCH_COUNT to 20 (AI-assisted)

by liyishuai open 2026-02-17 18:45 View on GitHub →
docs agents size: XS
## Disclaimer * Created by OpenClaw. * Untested. * Prompts: > Per https://api-dashboard.search.brave.com/documentation/services/web-search#pagination > Brave supports at most 20 results per query, > but https://github.com/openclaw/openclaw/blob/main/src/agents/tools/web-search.ts limits `MAX_SEARCH_COUNT = 10` > Create an issue and PR to change the max count to 20. Abide by the issue and PR templates strictly. * I understand what the code does. ## Summary Describe the problem and fix in 2–5 bullets: - Problem: Brave search results are hard-capped at 10. - Why it matters: The Brave Search API supports up to 20 results per query (see [docs](https://api-dashboard.search.brave.com/documentation/services/web-search#pagination)). - What changed: Increased `MAX_SEARCH_COUNT` from 10 to 20 in the Brave search tool. - What did NOT change (scope boundary): The default count remains unchanged; only the upper limit is increased. ## Change Type (select all) - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Docs - [ ] Security hardening - [ ] Chore/infra ## Scope (select all touched areas) - [ ] Gateway / orchestration - [x] Skills / tool execution - [ ] Auth / tokens - [ ] Memory / storage - [ ] Integrations - [ ] API / contracts - [ ] UI / DX - [ ] CI/CD / infra ## Linked Issue/PR - Closes #19377 - Related # ## User-visible / Behavior Changes Agents can now request up to 20 results per search query using the `count` parameter. ## Security Impact (required) - New permissions/capabilities? (`No`) - Secrets/tokens handling changed? (`No`) - New/changed network calls? (`No`) - Command/tool execution surface changed? (`No`) - Data access scope changed? (`No`) ## Repro + Verification ### Environment - OS: Linux - Runtime/container: OpenClaw Agent - Model/provider: Brave Search ### Steps 1. Call `web_search` with `count: 20`. 2. Observe if the limit prevents requesting more than 10. ### Expected - The tool allows requesting up to 20 results. ### Actual - The tool was limited to 10. ## Evidence Attach at least one: - [x] [Brave Pagination Documentation](https://api-dashboard.search.brave.com/documentation/services/web-search#pagination) ## Human Verification (required) What you personally verified (not just CI), and how: - Verified scenarios: Code constant update. - Edge cases checked: None (safe constant increase). - What you did **not** verify: Live API response with 20 results (verified via docs). ## Compatibility / Migration - Backward compatible? (`Yes`) - Config/env changes? (`No`) - Migration needed? (`No`) ## Failure Recovery (if this breaks) - How to disable/revert this change quickly: Revert commit to set `MAX_SEARCH_COUNT` back to 10. - Files/config to restore: `src/agents/tools/web-search.ts` - Known bad symptoms reviewers should watch for: Unexpected search tool errors if Brave API limit changes (unlikely as 20 is documented). ## Risks and Mitigations List only real risks for this PR. Add/remove entries as needed. If none, write `None`. - Risk: Brave API limit could potentially decrease in the future. - Mitigation: The tool handles API errors gracefully if the count is too high. <!-- greptile_comment --> <h3>Greptile Summary</h3> Increased Brave search maximum result count from 10 to 20 to align with the Brave Search API's native pagination capacity. The change updates the `MAX_SEARCH_COUNT` constant and propagates the new limit throughout all documentation (English and Chinese), type definitions, schema descriptions, and help text. Default count remains 5; only the upper limit is raised. This is a backward-compatible enhancement that allows agents to request more search results when needed. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with no concerns - The change is a simple constant update from 10 to 20, fully supported by Brave's API documentation. All related documentation, type definitions, and schema descriptions have been consistently updated across English and Chinese docs. The change is backward compatible (only raises the maximum, default stays at 5) and involves no new logic or behavior changes. - No files require special attention <sub>Last reviewed commit: 32a58e7</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs