This commit is contained in:
Kesku 2026-01-25 15:02:55 -08:00
parent 37f1380742
commit 93ab087cba
3 changed files with 41 additions and 60 deletions

View File

@ -9,7 +9,7 @@ read_when:
Clawdbot ships two lightweight web tools: Clawdbot ships two lightweight web tools:
- `web_search` — Search the web via Perplexity Search API (recommended) or Brave Search API. - `web_search` — Search the web using Perplexity Search API or Brave Search API.
- `web_fetch` — HTTP fetch + readable extraction (HTML → markdown/text). - `web_fetch` — HTTP fetch + readable extraction (HTML → markdown/text).
These are **not** browser automation. For JS-heavy sites or logins, use the These are **not** browser automation. For JS-heavy sites or logins, use the
@ -18,20 +18,11 @@ These are **not** browser automation. For JS-heavy sites or logins, use the
## How it works ## How it works
- `web_search` calls your configured provider and returns results. - `web_search` calls your configured provider and returns results.
- **Perplexity** (recommended): returns structured results (title, URL, snippet) for fast research.
- **Brave**: returns structured results (title, URL, snippet) with free tier available.
- Results are cached by query for 15 minutes (configurable). - Results are cached by query for 15 minutes (configurable).
- `web_fetch` does a plain HTTP GET and extracts readable content - `web_fetch` does a plain HTTP GET and extracts readable content
(HTML → markdown/text). It does **not** execute JavaScript. (HTML → markdown/text). It does **not** execute JavaScript.
- `web_fetch` is enabled by default (unless explicitly disabled). - `web_fetch` is enabled by default (unless explicitly disabled).
## Choosing a search provider
| Provider | Pros | Cons | API Key |
|----------|------|------|---------|
| **Perplexity** (recommended) | Fast, structured results, high-quality results | Requires Perplexity API access | `PERPLEXITY_API_KEY` |
| **Brave** | Structured results, free tier available | Traditional search results | `BRAVE_API_KEY` |
See [Perplexity Search setup](/perplexity) and [Brave Search setup](/brave-search) for provider-specific details. See [Perplexity Search setup](/perplexity) and [Brave Search setup](/brave-search) for provider-specific details.
Set the provider in config: Set the provider in config:
@ -41,60 +32,42 @@ Set the provider in config:
tools: { tools: {
web: { web: {
search: { search: {
provider: "brave" // or "perplexity" provider: "perplexity" // or "brave"
} }
} }
} }
} }
``` ```
Example: switch to Perplexity Search: ## Setting up web search
```json5 Use `clawdbot configure --section web` to set up your API key and choose a provider.
{
tools: {
web: {
search: {
provider: "perplexity",
perplexity: {
apiKey: "pplx-..."
}
}
}
}
}
```
## Getting a Brave API key ### Perplexity Search
1) Create a Brave Search API account at https://brave.com/search/api/
2) In the dashboard, choose the **Data for Search** plan (not “Data for AI”) and generate an API key.
3) Run `clawdbot configure --section web` to store the key in config (recommended), or set `BRAVE_API_KEY` in your environment.
Brave provides a free tier plus paid plans; check the Brave API portal for the
current limits and pricing.
### Where to set the key (recommended)
**Recommended:** run `clawdbot configure --section web`. It stores the key in
`~/.clawdbot/clawdbot.json` under `tools.web.search.apiKey`.
**Environment alternative:** set `BRAVE_API_KEY` in the Gateway process
environment. For a gateway install, put it in `~/.clawdbot/.env` (or your
service environment). See [Env vars](/help/faq#how-does-clawdbot-load-environment-variables).
## Using Perplexity Search
Perplexity Search API returns structured search results (title, URL, snippet) for fast research.
It's the recommended provider for web search.
### Getting a Perplexity API key
1) Create a Perplexity account at https://www.perplexity.ai/settings/api 1) Create a Perplexity account at https://www.perplexity.ai/settings/api
2) Generate an API key in the dashboard 2) Generate an API key in the dashboard
3) Run `clawdbot configure --section web` to store the key in config (recommended), or set `PERPLEXITY_API_KEY` in your environment. 3) Run `clawdbot configure --section web` to store the key in config, or set `PERPLEXITY_API_KEY` in your environment.
### Setting up Perplexity search Perplexity provides $5 in API credits on a monthly rolling basis to Perplexity Pro subscribers. Check the Perplexity API docs for current limits and pricing.
### Brave Search
1) Create a Brave Search API account at https://brave.com/search/api/
2) In the dashboard, choose the **Data for Search** plan (not "Data for AI") and generate an API key.
3) Run `clawdbot configure --section web` to store the key in config, or set `BRAVE_API_KEY` in your environment.
Brave provides a free tier plus paid plans; check the Brave API portal for the current limits and pricing.
### Where to store the key
**Via config (recommended):** run `clawdbot configure --section web`. It stores the key under `tools.web.search.perplexity.apiKey` or `tools.web.search.apiKey`.
**Via environment:** set `PERPLEXITY_API_KEY` or `BRAVE_API_KEY` in the Gateway process environment. For a gateway install, put it in `~/.clawdbot/.env` (or your service environment). See [Env vars](/help/faq#how-does-clawdbot-load-environment-variables).
### Config examples
**Perplexity Search:**
```json5 ```json5
{ {
@ -112,7 +85,21 @@ It's the recommended provider for web search.
} }
``` ```
**Environment alternative:** set `PERPLEXITY_API_KEY` in the Gateway environment. For a gateway install, put it in `~/.clawdbot/.env`. **Brave Search:**
```json5
{
tools: {
web: {
search: {
enabled: true,
provider: "brave",
apiKey: "BSA..." // optional if BRAVE_API_KEY is set
}
}
}
}
```
## web_search ## web_search

View File

@ -132,12 +132,10 @@ async function promptWebToolsConfig(
{ {
value: "perplexity", value: "perplexity",
label: "Perplexity Search", label: "Perplexity Search",
hint: "Recommended - structured results, fast",
}, },
{ {
value: "brave", value: "brave",
label: "Brave Search", label: "Brave Search",
hint: "Structured results, free tier available",
}, },
], ],
initialValue: existingProvider, initialValue: existingProvider,

View File

@ -454,11 +454,7 @@ export async function finalizeOnboardingWizard(options: FinalizeOnboardingOption
"Docs: https://docs.clawd.bot/tools/web", "Docs: https://docs.clawd.bot/tools/web",
].join("\n") ].join("\n")
: [ : [
"If you want your agent to be able to search the web, youll need an API key.", "To enable web search, your agent will need an API key for either Perplexity Search or Brave Search.",
"",
"Clawdbot supports two web search providers:",
"- Perplexity Search (recommended) - structured results, fast",
"- Brave Search - structured results, free tier available",
"", "",
"Set it up interactively:", "Set it up interactively:",
`- Run: ${formatCliCommand("clawdbot configure --section web")}`, `- Run: ${formatCliCommand("clawdbot configure --section web")}`,