AgentSkillsCN

baidu-search

使用百度 AI 搜索引擎(BDSE)进行网络搜索。当您需要实时资讯、权威文档,或是在内置网页搜索功能无法满足需求时,这款工具将是您的理想之选。

SKILL.md
--- frontmatter
name: baidu-search
description: Search the web using Baidu AI Search Engine (BDSE). Use this when you need live information, documentation, or to research topics and the built-in web_search is unavailable.
metadata: { "openclaw": { "emoji": "🔍︎",  "requires": { "bins": ["python"], "env":["BAIDU_API_KEY"]},"primaryEnv":"BAIDU_API_KEY" } }

Baidu Search Skill

This skill allows OpenClaw agents to perform web searches via Baidu AI Search Engine (BDSE).

Setup

  1. API Key: Ensure the BAIDU_API_KEY environment variable is set with your valid API key.
  2. Environment: The API key should be available in the runtime environment.
  3. BAIDU_API_KEY: BAIDU_API_KEY available, need to go to the baidu cloud platform(https://login.bce.baidu.com) registered account, if you already have account will go to get the API KEY (https://console.bce.baidu.com/qianfan/ais/console/apiKey)

Workflow

  1. The skill executes the Python script located at scripts/search.py
  2. The script makes a POST request to the Baidu AI Search API
  3. The API returns structured search results with titles, URLs, and content snippets

Parameters

request body structure

paramtyperequireddefaultdescription
querystryesuser query content
editionstrnostandardOptional value: standard: Full version. lite: Standard version.
resource_type_filterlist[obj]no[{"type": "web","top_k": 20},{"type": "video","top_k": 0},{"type": "image","top_k": 0},{"type": "aladdin","top_k": 0}]Support setting web pages, videos, images, and Aladdin search modes. The maximum value of top_k for web pages is 50, for videos it is 10, for images it is 30, and for Aladdin it is 5
search_filterlist[obj]noSearch and filter based on the sub-conditions under SearchFilter. For the usage method, please refer to the details of the SearchFilter table.
block_websiteslist[str]noList of sites that need to be blocked. Filter the search results belonging to this site and its sub-sites in the site list. Example: ["tieba.baidu.com"]
search_recency_filterstrnoFilter based on the publication time of the web page. Enumeration values: week: The last 7 days month: The last 30 days semiyear: The last 180 days, year: The last 365 days
safe_searchboolnofalseWhether to enable secure search or not, if it is enabled, a stricter risk control strategy will be adopted, and some queries that may involve pornography or terrorism will not return search results.

SearchFilter table

paramtyperequireddefaultdescription
matchobjnofilter site condition
match.sitestrnoSupport setting search conditions for specified sites, that is, only conduct content search within the set sites. Currently, it supports setting up 100 sites. Example: ["tieba.baidu.com", "baike.baidu.com"] Note: This is a paid feature and is currently free for a limited time.
rangeobjnoRange query. It can be used for numeric and date-type fields. The grammar format is as follows: "range" : { "{field}" : { "gte" : " {lowerBound}" , "gt" : "{lowerBound}" , "lte" : "{upperBound}" , "lt" : "{upperBound}" }} Entity (field) pageTime: The name of the entity representing the publication time, indicating a range query for pageTime. Here, pageTime corresponds to the page_time field in the response data. The filtering function for web page publication time is only applicable to available and displayable libraries. Other results such as videos will not be recalled.

SearchFilter example

json
{
    "match": {
        "site": ["tieba.baidu.com", "baike.baidu.com"]
    },
    "range": {
        "pageTime": {
            "gte": "now-1w/d",
            "lt": "now/d"
        }
    }
}

range usage description

Query range (lowerBound\upperBound)

  1. Specify date Specify search date range, format: YYYY-MM-DD, for example: quot; range" : { " page_time" : { " gte" : " 2025-11-01" , " lte" : " 2025-11-04"
  2. Time units supported by fixed packages: y (year), M (month), w (week), d (day). Currently, the following fixed packages are provided. Any other packages are illegal. Among them, "now" To represent the current time, a mathematical expression can be added after "now" : "-1w" indicates minus one week. "-1M" indicates minus one month; "-1y" indicates minus one year; "/d" indicates the start/end time normalized to the current day. the fixed time unit enums: now/d now-1w/d: One week now-2w/d: Two weeks now-1M/d: One month now-3M/d: Three months now-6M/d: Six months now-1y/d: One year

Parameter limitation description: 1.lte usage note: The range range will participate in the calculation of the cache key in the retrieval system. After the lte performs upward rounding and rounding, due to cache, the result timeliness may lag behind the lte value specified by match. 2. The lowerBound and upperBound times must exist simultaneously; otherwise, this function will not take effect. 3. Only one of gte and gt needs to be passed. If both are passed, only gt will take effect

Example Usage

bash
BAIDU_API_KEY=xxx python3 skills/baidu-search/scripts/search.py '{"query":"北京有哪些旅游景区","resource_type_filter":[{"type":"web","top_k":20}],"search_filter":{"match":{"site":["www.weather.com.cn"]}},"search_recency_filter":"year"}'

Current Status

The Baidu search skill is fully functional and can be used to retrieve current information from the web. As demonstrated, it successfully retrieved weather information for Beijing, showing current conditions and forecasts.