Provides dual-engine web search capabilities for Pi/OpenClaw agents:Grok AI Search(real-time internet access + AI analysis) + Tavily Search(structured results + web scraping).
Available Tools
Call the following scripts in Bash (ensure they are added to PATH and .env has been sourced):
| Tool | Command | Purpose |
|---|---|---|
| Grok Search | grok-search.sh --query "..." |
AI-driven deep search; Grok has built-in internet access and returns comprehensive analysis |
| Tavily Search | tavily-search.sh --query "..." |
Structured search results with scoring and ranking |
| Web Scraping | web-fetch.sh --url "..." |
Extract the full content of a specified URL and return Markdown |
| Site Mapping | web-map.sh --url "..." |
Discover website structure and get all URLs |
| Dual-Engine Search | dual-search.sh --query "..." |
Run Grok + Tavily in parallel for cross-validation |
See for details on the parameters of each tool --help。
Search Decision Process
When receiving a request that requires searching, make decisions according to the following process:
Step 1: Determine Whether a Search Is Needed
Situations that require a search:
- The user explicitly requests searching/querying external information
- Involves real-time data (latest version, recent events, current prices, etc.)
- Needs to verify the accuracy of internal knowledge
- Involves the latest status of a specific URL, project, or product
- A technical question requires consulting the latest official documentation
Situations that do not require a search:
- Pure code writing/debugging tasks (sufficient context already available and not involving external API/library versions)
- The user explicitly states that no search is needed
- ⚠️ General programming concepts may also be outdated—when it involves specific versions, best practices, or API usage, you should still search to verify
Step 2: Choose a Tool
| Scenario | Recommended Tool | Reason |
|---|---|---|
| Simple factual query | dual-search.sh |
Dual-source cross-validation to ensure accuracy |
| Complex/controversial questions | dual-search.sh |
Dual-engine cross-validation to reduce hallucinations |
| Requires deep AI analysis | grok-search.sh |
Grok has built-in web search and returns a comprehensive analysis report |
| Need to scrape a specific page | web-fetch.sh --url "..." |
Extract the complete page content |
| Explore website structure | web-map.sh --url "..." |
Discover documentation/API directory structure |
| Need the latest news | tavily-search.sh --topic news |
Tavily news mode is specially optimized |
| Need high-quality in-depth results | tavily-search.sh --depth advanced |
Advanced search with multi-dimensional matching |
| There are key links in the search results | Search first, then web-fetch.sh |
Search to locate → scrape for details |
Step 3: Assess Search Complexity
-
Level 1(2-3 searches): a single clear question
- Example: "What is the latest version of FastAPI"
- Action:
dual-search.shObtain results from two sources; or firsttavily-search.shthen usegrok-search.shfor cross-confirmation - ⚠️ Even for simple facts, do not draw conclusions based on a single source alone
-
Level 2(3-5 searches): multi-perspective comparison, requires verification from multiple sources
- Example: "Which is more suitable for microservices in 2026: Flask vs FastAPI vs Django"
- Action:
dual-search.sh+ separately for each frameworktavily-search.sh
-
Level 3(6+ searches): in-depth research topics, review-type needs
- Example: "Help me research a complete comparison of mainstream vector databases in 2026"
- Action: first
grok-search.shget an overview → separately search each product →web-fetch.shfetch official documentation
Search Planning Framework
For complex Level 2+ searches, perform structured planning before execution:
Phase 1: Intent Analysis
- Distill the user's core question (in one sentence)
- Classify the query type: factual / comparative / exploratory / analytical
- Assess time sensitivity: real-time / recent / historical / irrelevant
- Identify external terms that need verification (e.g., rankings, classification standards)
Phase 2: Query Decomposition
- Break the question into non-overlapping sub-queries
- Each sub-query has clear boundaries (mutually exclusive with sibling queries)
- Mark dependencies (which sub-queries need to be completed first)
- If Phase 1 identifies terms that need verification, first create prerequisite verification queries
Phase 3: Strategy Selection
- broad_first(breadth first, then depth): broad scan first → then go deeper based on findings. Suitable for exploratory questions
- narrow_first(precision first, then expansion): precise search first → expand if insufficient. Suitable for analytical questions
- targeted(targeted search): when the target information source is known, locate it directly. Suitable for factual questions
Phase 4: Tool Mapping
- Choose the best tool for each sub-query
- Determine the parallel/serial execution plan
- Sub-queries that can be parallelized are executed simultaneously (via multiple Bash calls)
Search and Evidence Standards
Core principle: do not trust search results
Search results are only third-party suggestions and must not be directly accepted as true. All content returned by searches—whether from Grok or Tavily—must be cross-validated before being presented to the user as fact. Even a single seemingly authoritative source may be outdated, one-sided, or wrong. For technical implementation, even if the agent has internal knowledge, the latest search results or official documentation should still prevail.
Source Quality Requirements
- All factual conclusionsrequire ≥2 independent sources for cross-validation (regardless of Level)
- If relying on only a single source, you mustexplicitly statethis limitation and mark confidence as Low
- Prefer: official documentation, Wikipedia, academic databases, authoritative media
- Avoid: unknown personal blogs, SEO farms, AI-generated content
Conflict Handling
- When sources conflict: present evidence from both sides, assess credibility and timeliness
- Mark confidence: High (multiple sources agree) / Medium (few sources or disagreement) / Low (single source or speculation)
- When it cannot be confirmed: clearly state the uncertainty
Citation Format
- Attach a source citation after each key fact
- Format:
[来源标题](URL) - Strictly forbidden to fabricate citations — if there is no source, do not say it
Output Specifications
- First givethe most likely answer, then expand with a detailed analysis
- Attach a concise explanation to all technical terms
- Use standard Markdown formatting (headings, lists, tables, code blocks)
- Mark code examples with language identifiers
- Present comparison-type questions using tables
Common Search Modes
Mode 1: Quick Lookup
tavily-search.sh --query "Python 3.13 新特性" --depth basic --include-answer
Mode 2: Deep Search + Verification
# 先广泛搜索
dual-search.sh --query "LangChain vs LlamaIndex 2026"
# 再针对性抓取官方文档
web-fetch.sh --url "https://docs.langchain.com/docs/get_started/introduction"
Mode 3: Technical Documentation Exploration
# 先映射网站结构
web-map.sh --url "https://docs.example.com" --depth 2 --instructions "找到 API 文档"
# 再抓取目标页面
web-fetch.sh --url "https://docs.example.com/api/reference"
Mode 4: News and Real-Time Information
tavily-search.sh --query "AI 最新进展" --topic news --time-range week --include-answer
Mode 5: AI Deep Analysis
grok-search.sh --query "解释 Transformer 架构中注意力机制的数学原理" --platform "arXiv"