Web Tools
title: Web Tools description: Configure web search (Brave/Perplexity) and fetching for OpenClaw agents. sidebar: label: Web Tools order: 5
Section titled “title: Web Tools description: Configure web search (Brave/Perplexity) and fetching for OpenClaw agents. sidebar: label: Web Tools order: 5”Web Tools
Section titled “Web Tools”OpenClaw includes two powerful tools for internet access:
web_search: Find information using search engines (Brave or Perplexity).web_fetch: Retrieve and read the content of specific web pages (HTML to Markdown).
Web Search
Section titled “Web Search”OpenClaw supports two providers for web search:
| Provider | Description | Best For |
|---|---|---|
| Brave Search | Standard search results (links + snippets). | General queries, finding URLs. |
| Perplexity | AI-synthesized answers with citations. | Complex questions, research. |
Configuration
Section titled “Configuration”You can configure the search provider in ~/.openclaw/openclaw.json.
- Get an API key from Brave Search API.
- Set
BRAVE_API_KEYin your environment OR config:
{ tools: { web: { search: { provider: "brave", apiKey: "BSA-..." // Optional if env var set } } }}- Get an API key from OpenRouter.
- Set
OPENROUTER_API_KEYin your environment OR config:
{ tools: { web: { search: { provider: "perplexity", perplexity: { apiKey: "sk-or-...", // Optional if env var set model: "perplexity/sonar-pro" } } } }}Web Fetch
Section titled “Web Fetch”The web_fetch tool downloads a webpage and converts it to readable text (Markdown) for the agent.
- Auto-Fallback: If a direct fetch fails (e.g., due to anti-bot protection), it can automatically try Firecrawl if configured.
- Privacy: Fetches are done from the Gateway server IP.
Usage Example
Section titled “Usage Example”The agent decides when to use these tools. You might see logs like:
[agent] invoking tool: web_search({ query: "latest SpaceX launch" })[agent] invoking tool: web_fetch({ url: "https://www.spacex.com/launches/" })Advanced Settings
Section titled “Advanced Settings”{ tools: { web: { search: { enabled: true, maxResults: 5, cacheTtlMinutes: 15 // Cache results to save API credits }, fetch: { timeoutSeconds: 30, userAgent: "OpenClaw/1.0" // Custom User-Agent } } }}freshness: “pw” });
## web_fetch
Fetch a URL and extract readable content.
### Requirements
- `tools.web.fetch.enabled` must not be `false` (default: enabled)- Optional Firecrawl fallback: set `tools.web.fetch.firecrawl.apiKey` or `FIRECRAWL_API_KEY`.
### Config
```json5{ tools: { web: { fetch: { enabled: true, maxChars: 50000, timeoutSeconds: 30, cacheTtlMinutes: 15, maxRedirects: 3, userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_7_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36", readability: true, firecrawl: { enabled: true, apiKey: "FIRECRAWL_API_KEY_HERE", // optional if FIRECRAWL_API_KEY is set baseUrl: "https://api.firecrawl.dev", onlyMainContent: true, maxAgeMs: 86400000, // ms (1 day) timeoutSeconds: 60 } } } }}Tool parameters
Section titled “Tool parameters”url(required, http/https only)extractMode(markdown|text)maxChars(truncate long pages)
Notes:
web_fetchuses Readability (main-content extraction) first, then Firecrawl (if configured). If both fail, the tool returns an error.- Firecrawl requests use bot-circumvention mode and cache results by default.
web_fetchsends a Chrome-like User-Agent andAccept-Languageby default; overrideuserAgentif needed.web_fetchblocks private/internal hostnames and re-checks redirects (limit withmaxRedirects).web_fetchis best-effort extraction; some sites will need the browser tool.- See Firecrawl for key setup and service details.
- Responses are cached (default 15 minutes) to reduce repeated fetches.
- If you use tool profiles/allowlists, add
web_search/web_fetchorgroup:web. - If the Brave key is missing,
web_searchreturns a short setup hint with a docs link.