Skip to content

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.

  • 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).

You can get web search running in about five minutes. I usually prefer Perplexity or Brave because they provide structured results quickly.

  1. Get your API key: For example, generate one at brave.com/search/api or perplexity.ai/settings/api.
  2. Configure OpenClaw: Run the configuration command in your terminal:
    Terminal window
    openclaw configure --section web
  3. 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"
    # or
    export PERPLEXITY_API_KEY="your_key_here"
  4. Test the Tool: Once configured, the web_search tool becomes available to your agent automatically.

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.

ProviderProsAPI Key
PerplexityFast, structured; includes filters and extractionPERPLEXITY_API_KEY
BraveFast, structured resultsBRAVE_API_KEY
GeminiGoogle Search grounding with citationsGEMINI_API_KEY
GrokxAI web-grounded responsesXAI_XPI_KEY

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",
},
},
},
},
}

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"],
});

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.

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.

OpenClaw

OpenClaw Expert

Still stuck?

If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.