feat(community): add Brave Search web search tool (#3528)

* feat(community): add Brave Search web search tool

Add a community web_search provider backed by the official Brave Search
API (https://api.search.brave.com/res/v1/web/search). API key is read
from the tool config (inline api_key) or the BRAVE_SEARCH_API_KEY env
var. Output schema (title/url/content) matches existing search tools.
No new dependencies (uses the existing httpx). Also wires up the setup
wizard, doctor health check, config example, and EN/ZH docs.

* refactor(community): drop redundant [:count] slice in Brave search

The Brave API already caps results via the `count` request param, so
client-side slicing was redundant. Tests now simulate the API honoring
`count` instead of relying on the slice. Addresses PR review nit.

* style(tests): apply ruff format to test_doctor.py

Collapse multiline write_text calls onto single lines to satisfy the
CI ruff formatter (lint-backend was failing on format --check).
This commit is contained in:
Ryker_Feng
2026-06-13 22:47:35 +08:00
committed by GitHub
parent 8955b3222a
commit 6e839342a7
10 changed files with 582 additions and 7 deletions
+12 -1
View File
@@ -113,7 +113,7 @@ Community tools connect the agent to external services. They are configured in `
### Web search
<Tabs items={["DuckDuckGo (default)", "Tavily", "Exa", "InfoQuest", "Firecrawl"]}>
<Tabs items={["DuckDuckGo (default)", "Tavily", "Brave", "Exa", "InfoQuest", "Firecrawl"]}>
<Tabs.Tab>
```yaml
tools:
@@ -134,6 +134,17 @@ Install: `cd backend && uv add 'deerflow-harness[tavily]'`
</Tabs.Tab>
<Tabs.Tab>
```yaml
tools:
- use: deerflow.community.brave.tools:web_search_tool
api_key: $BRAVE_SEARCH_API_KEY
```
Results from Brave's independent index via the official [Brave Search API](https://brave.com/search/api/). Requires an API key. `max_results` is capped at 20.
No extra dependency required.
</Tabs.Tab>
<Tabs.Tab>
```yaml
tools:
- use: deerflow.community.exa.tools:web_search_tool
api_key: $EXA_API_KEY
+20 -1
View File
@@ -110,7 +110,7 @@ tools:
### 网络搜索
<Tabs items={["DuckDuckGo(默认)", "Tavily", "Exa", "Firecrawl"]}>
<Tabs items={["DuckDuckGo(默认)", "Tavily", "Brave", "Exa", "InfoQuest", "Firecrawl"]}>
<Tabs.Tab>
```yaml
tools:
@@ -131,6 +131,17 @@ tools:
</Tabs.Tab>
<Tabs.Tab>
```yaml
tools:
- use: deerflow.community.brave.tools:web_search_tool
api_key: $BRAVE_SEARCH_API_KEY
```
通过官方 [Brave Search API](https://brave.com/search/api/) 返回 Brave 独立索引的结果。需要 API Key`max_results` 上限为 20。
无需额外依赖。
</Tabs.Tab>
<Tabs.Tab>
```yaml
tools:
- use: deerflow.community.exa.tools:web_search_tool
api_key: $EXA_API_KEY
@@ -142,6 +153,14 @@ tools:
</Tabs.Tab>
<Tabs.Tab>
```yaml
tools:
- use: deerflow.community.infoquest.tools:web_search_tool
api_key: $INFOQUEST_API_KEY
```
InfoQuest 搜索集成。
</Tabs.Tab>
<Tabs.Tab>
```yaml
tools:
- use: deerflow.community.firecrawl.tools:web_search_tool
api_key: $FIRECRAWL_API_KEY