Giving Your AI Real-Time Web Access with OpenClaw
I often find myself frustrated when an AI agent is stuck behind its training cutoff. It knows plenty about the past, but it can’t tell me what happened in a GitHub repo an hour ago or check the latest documentation for a library I’m using. Building a reliable bridge between an LLM and the live web is a common headache for developers.
OpenClaw handles this with two lightweight tools: web_search and web_fetch. They don’t use heavy browser automation, so they stay fast and efficient for most tasks. Here is how I set them up.
What You’ll Need
Section titled “What You’ll Need”- An OpenClaw installation.
- An API key from a supported provider: Brave, Perplexity, Gemini, Grok, or Kimi.
- A Firecrawl API key (optional, for better content extraction).
Quick Start
Section titled “Quick Start”You can get web search running in about five minutes. I usually prefer Perplexity or Brave because they provide structured results quickly.
- Get your API key: For example, generate one at brave.com/search/api or perplexity.ai/settings/api.
- Configure OpenClaw: Run the configuration command in your terminal:
Terminal window openclaw configure --section web - Set the Environment Variable: If you prefer not to use the config file, you can export your key directly:
Terminal window export BRAVE_API_KEY="your_key_here"# orexport PERPLEXITY_API_KEY="your_key_here" - Test the Tool: Once configured, the
web_searchtool becomes available to your agent automatically.
Choosing a Search Provider
Section titled “Choosing a Search Provider”OpenClaw supports several providers. If you don’t pick one, it tries to auto-detect based on your environment variables in this order: Brave, Gemini, Kimi, Perplexity, then Grok.
| Provider | Pros | API Key |
|---|---|---|
| Perplexity | Fast, structured; includes filters and extraction | PERPLEXITY_API_KEY |
| Brave | Fast, structured results | BRAVE_API_KEY |
| Gemini | Google Search grounding with citations | GEMINI_API_KEY |
| Grok | xAI web-grounded responses | XAI_XPI_KEY |
Configuration Examples
Section titled “Configuration Examples”If you want to be explicit, you can define your provider in your configuration file. Here is how I set up Perplexity:
{ tools: { web: { search: { enabled: true, provider: "perplexity", perplexity: { apiKey: "pplx-...", // optional if PERPLEXITY_API_KEY is set }, }, }, },}If you prefer Gemini for Google Search grounding, use this structure:
{ tools: { web: { search: { provider: "gemini", gemini: { apiKey: "AIza...", model: "gemini-2.5-flash", }, }, }, },}Using the Search Tool
Section titled “Using the Search Tool”The web_search tool supports several parameters to help you narrow down results. You can filter by date, country, or even specific domains if you use Perplexity.
// Recent results (past week)await web_search({ query: "TMBG interview", freshness: "week",});
// Domain filtering (Perplexity only)await web_search({ query: "climate research", domain_filter: ["nature.com", "science.org", ".edu"],});Fetching Page Content
Section titled “Fetching Page Content”While web_search finds links, web_fetch reads them. It uses a plain HTTP GET request and converts HTML into clean markdown or text. It is enabled by default.
I use it like this:
await web_fetch({ url: "https://example.com", extractMode: "markdown"});Keep in mind that web_fetch does not execute JavaScript. If you hit a site that is a heavy Single Page App (SPA) or requires a login, this tool won’t work.
Troubleshooting
Section titled “Troubleshooting”Missing API Key
If you try to search without a key, OpenClaw returns a short setup hint. You can fix this by running openclaw configure --section web or setting the correct environment variable for your provider.
Empty Content or JS Errors
If web_fetch returns empty results or “Readability failed” on a site, it is likely because the site requires JavaScript to render. For these cases, you should switch to the Browser tool.
Redirect Issues OpenClaw uses an SSRF guard. If a URL redirects to a private or internal IP address, the fetch will be blocked for security reasons.
If you need more help getting things running, check out the AI Setup Assistant.
What’s Next
Section titled “What’s Next”OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.