Skip to content

Web Search

The web_search tool searches the web using your configured provider and returns results. Results are cached by query for 15 minutes (configurable).

OpenClaw also includes x_search for X (formerly Twitter) posts and web_fetch for lightweight URL fetching. In this phase, web_fetch stays local while web_search and x_search can use xAI Responses under the hood.

  1. Get an API key

    Pick a provider and get an API key. See the provider pages below for sign-up links.

  2. Configure

    Terminal window
    openclaw configure --section web

    This stores the key and sets the provider. You can also set an env var (e.g. BRAVE_API_KEY) and skip this step.

  3. Use it

    The agent can now call web_search:

    await web_search({ query: "OpenClaw plugin SDK" });

    For X posts, use:

    await x_search({ query: "dinner recipes" });
Brave Search

Structured results with snippets. Supports llm-context mode, country/language filters. Free tier available.

DuckDuckGo

Key-free fallback. No API key needed. Unofficial HTML-based integration.

Exa

Neural + keyword search with content extraction (highlights, text, summaries).

Firecrawl

Structured results. Best paired with firecrawl_search and firecrawl_scrape for deep extraction.

Gemini

AI-synthesized answers with citations via Google Search grounding.

Grok

AI-synthesized answers with citations via xAI web grounding.

Kimi

AI-synthesized answers with citations via Moonshot web search.

Perplexity

Structured results with content extraction controls and domain filtering.

SearXNG

Self-hosted meta-search. No API key needed. Aggregates Google, Bing, DuckDuckGo, and more.

Tavily

Structured results with search depth, topic filtering, and tavily_extract for URL extraction.

ProviderResult styleFiltersAPI key
BraveStructured snippetsCountry, language, time, llm-context modeBRAVE_API_KEY
DuckDuckGoStructured snippetsNone (key-free)
ExaStructured + extractedNeural/keyword mode, date, content extractionEXA_API_KEY
FirecrawlStructured snippetsVia firecrawl_search toolFIRECRAWL_API_KEY
GeminiAI-synthesized + citationsGEMINI_API_KEY
GrokAI-synthesized + citationsXAI_API_KEY
KimiAI-synthesized + citationsKIMI_API_KEY / MOONSHOT_API_KEY
PerplexityStructured snippetsCountry, language, time, domains, content limitsPERPLEXITY_API_KEY / OPENROUTER_API_KEY
SearXNGStructured snippetsCategories, languageNone (self-hosted)
TavilyStructured snippetsVia tavily_search toolTAVILY_API_KEY

Codex-capable models can optionally use the provider-native Responses web_search tool instead of OpenClaw’s managed web_search function.

  • Configure it under tools.web.search.openaiCodex
  • It only activates for Codex-capable models (openai-codex/* or providers using api: "openai-codex-responses")
  • Managed web_search still applies to non-Codex models
  • mode: "cached" is the default and recommended setting
  • tools.web.search.enabled: false disables both managed and native search
{
tools: {
web: {
search: {
enabled: true,
openaiCodex: {
enabled: true,
mode: "cached",
allowedDomains: ["example.com"],
contextSize: "high",
userLocation: {
country: "US",
city: "New York",
timezone: "America/New_York",
},
},
},
},
},
}

If native Codex search is enabled but the current model is not Codex-capable, OpenClaw keeps the normal managed web_search behavior.

Provider lists in docs and setup flows are alphabetical. Auto-detection keeps a separate precedence order:

If no provider is set, OpenClaw checks for API keys in this order and uses the first one found:

  1. BraveBRAVE_API_KEY or plugins.entries.brave.config.webSearch.apiKey
  2. GeminiGEMINI_API_KEY or plugins.entries.google.config.webSearch.apiKey
  3. GrokXAI_API_KEY or plugins.entries.xai.config.webSearch.apiKey
  4. KimiKIMI_API_KEY / MOONSHOT_API_KEY or plugins.entries.moonshot.config.webSearch.apiKey
  5. PerplexityPERPLEXITY_API_KEY / OPENROUTER_API_KEY or plugins.entries.perplexity.config.webSearch.apiKey
  6. FirecrawlFIRECRAWL_API_KEY or plugins.entries.firecrawl.config.webSearch.apiKey
  7. TavilyTAVILY_API_KEY or plugins.entries.tavily.config.webSearch.apiKey

Key-free providers are checked after API-backed providers:

  1. DuckDuckGo — no key needed (auto-detect order 100)
  2. SearXNGSEARXNG_BASE_URL or plugins.entries.searxng.config.webSearch.baseUrl (auto-detect order 200)

If no provider is detected, it falls back to Brave (you will get a missing-key error prompting you to configure one).

{
tools: {
web: {
search: {
enabled: true, // default: true
provider: "brave", // or omit for auto-detection
maxResults: 5,
timeoutSeconds: 30,
cacheTtlMinutes: 15,
},
},
},
}

Provider-specific config (API keys, base URLs, modes) lives under plugins.entries.<plugin>.config.webSearch.*. See the provider pages for examples.

For x_search, configure plugins.entries.xai.config.xSearch.*. It uses the same XAI_API_KEY fallback as Grok web search. Legacy tools.web.x_search.* config is auto-migrated by openclaw doctor --fix. When you choose Grok during openclaw onboard or openclaw configure --section web, OpenClaw can also offer optional x_search setup with the same key. This is a separate follow-up step inside the Grok path, not a separate top-level web-search provider choice. If you pick another provider, OpenClaw does not show the x_search prompt.

Run openclaw configure --section web or set the key directly:

{
plugins: {
entries: {
brave: {
config: {
webSearch: {
apiKey: "YOUR_KEY", // pragma: allowlist secret
},
},
},
},
},
}
ParameterDescription
querySearch query (required)
countResults to return (1-10, default: 5)
country2-letter ISO country code (e.g. “US”, “DE”)
languageISO 639-1 language code (e.g. “en”, “de”)
freshnessTime filter: day, week, month, or year
date_afterResults after this date (YYYY-MM-DD)
date_beforeResults before this date (YYYY-MM-DD)
ui_langUI language code (Brave only)
domain_filterDomain allowlist/denylist array (Perplexity only)
max_tokensTotal content budget, default 25000 (Perplexity only)
max_tokens_per_pagePer-page token limit, default 2048 (Perplexity only)

x_search queries X (formerly Twitter) posts using xAI and returns AI-synthesized answers with citations. It accepts natural-language queries and optional structured filters. OpenClaw only enables the built-in xAI x_search tool on the request that serves this tool call.

{
plugins: {
entries: {
xai: {
config: {
xSearch: {
enabled: true,
model: "grok-4-1-fast-non-reasoning",
inlineCitations: false,
maxTurns: 2,
timeoutSeconds: 30,
cacheTtlMinutes: 15,
},
webSearch: {
apiKey: "xai-...", // optional if XAI_API_KEY is set
},
},
},
},
},
}
ParameterDescription
querySearch query (required)
allowed_x_handlesRestrict results to specific X handles
excluded_x_handlesExclude specific X handles
from_dateOnly include posts on or after this date (YYYY-MM-DD)
to_dateOnly include posts on or before this date (YYYY-MM-DD)
enable_image_understandingLet xAI inspect images attached to matching posts
enable_video_understandingLet xAI inspect videos attached to matching posts
await x_search({
query: "dinner recipes",
allowed_x_handles: ["nytfood"],
from_date: "2026-03-01",
});
// Per-post stats: use the exact status URL or status ID when possible
await x_search({
query: "https://x.com/huntharo/status/1905678901234567890",
});
// Basic search
await web_search({ query: "OpenClaw plugin SDK" });
// German-specific search
await web_search({ query: "TV online schauen", country: "DE", language: "de" });
// Recent results (past week)
await web_search({ query: "AI developments", freshness: "week" });
// Date range
await web_search({
query: "climate research",
date_after: "2024-01-01",
date_before: "2024-06-30",
});
// Domain filtering (Perplexity only)
await web_search({
query: "product reviews",
domain_filter: ["-reddit.com", "-pinterest.com"],
});

If you use tool profiles or allowlists, add web_search, x_search, or group:web:

{
tools: {
allow: ["web_search", "x_search"],
// or: allow: ["group:web"] (includes web_search, x_search, and web_fetch)
},
}
  • Web Fetch — fetch a URL and extract readable content
  • Web Browser — full browser automation for JS-heavy sites
  • Grok Search — Grok as the web_search provider