Execution
This skill ships with a batch JSON file scripts/search.json.
Call run_tool_batch strictly in the format below, using file_path
to load the file. Do not construct your own actions list inline.
run_tool_batch requires an absolute path for file_path. Use the
absolute directory path you see when reading this SKILL.md (the {dir}
shown in your system prompt) to construct the full path.
run_tool_batch(
file_path="<this skill dir>/scripts/search.json",
args={
"skill_dir": "<this skill dir>",
"query": "搜索词",
"search_type": "web",
"count": 10
}
)
The batch runs scripts/doubao_search.py once and prints structured
markdown to stdout (step 0 .text). Present that markdown to the user
directly, or distill it into a natural-language answer. Each web result
includes Title / URL / Site / Authority / Snippet (short) / Summary (long,
good for follow-up reasoning) / optional Content.
Batch Parameters
skill_dir: this skill's absolute directory (from your system prompt{dir}). Always pass it; the batch uses it to locate the script. Example:/mnt/workspace/.qwenpaw/workspaces/default/skills/doubao-search.query: the search query, 1–100 chars. Single phrase only (the API does not support multi-term search). Example:"火山引擎 豆包搜索".search_type:web(default) orimage.webreturns page results;imagereturns image results (max 5).count: number of results. web ≤ 50 (default 10), image ≤ 5. Example:10.
When calling run_tool_batch, pass all parameters listed above. Do not
pass args={} or omit args — the batch JSON contains ${args.*}
references and an empty args will leak a literal placeholder into the
command, causing a parse failure.
Advanced parameters (not in the batch)
For sites / time-range / industry / format / authority-level etc., do
NOT use the batch — call the script directly with execute_shell_command
so you control quoting and can add any flag:
python3 <skill_dir>/scripts/doubao_search.py \
--query "搜索词" \
--type web --count 10 \
--sites "a.com|b.com" \
--block "c.com" \
--time OneWeek \
--content-format markdown \
--industry finance \
--auth-level 1 \
--query-rewrite \
--need-content \
--show-content
Key flags: --time (OneDay/OneWeek/OneMonth/OneYear or
YYYY-MM-DD..YYYY-MM-DD), --industry (finance/game/gov),
--auth-level (0 unlimited / 1 very-authoritative-only),
--content-format (text/markdown), --show-content (also dump a
Content snippet, length controlled by --content-chars, default 500),
--need-content (only results with body text), --need-url (only results
with a URL, filters out 火山如意 cards), --raw (print full JSON for
debugging).
Batch failure handling
- Verify you passed real values for
skill_dir,query,search_type,count— especially that you did not passargs={}. - If it still fails, run the script directly with
execute_shell_command(see "Advanced parameters") — this also lets you pass sites/time/etc. - If the script reports
找不到 API Key, the key file is missing at~/.config/doubao_search/api_key. Tell the user to provide a new key (see Notes), do NOT hardcode a key into the script. - After completing the task, tell the user: "The batch execution hit an issue so I completed the task manually. Would you like me to use edit_file to adjust this skill's batch script?"
Step-by-step reference
- Read API key: the script reads
DOUBAO_SEARCH_API_KEYenv var first, then--key-file, then~/.config/doubao_search/api_key. The key is NOT in the source — skill files stay shareable. - Build payload:
{"Query", "SearchType", "Count", "Filter"?, "QueryControl"?, "ContentFormats"?, "Industry"?}per the Doubao Custom API (SearchType=web/image). - Call API:
POST https://open.feedcoopapi.com/search_api/web_searchwithAuthorization: Bearer <key>+Content-Type: application/json. On HTTPError it prints status + body and exits non-zero. - Format: web → markdown list (Title/URL/Site/Authority/PublishTime/
Summary-or-Snippet/optional Content); image → per-field dump.
--rawprints the untouched JSON.ResponseMetadata.Erroris surfaced as an error and exits non-zero.
Notes
- Auth & key rotation: the key lives at
~/.config/doubao_search/api_key(recommend mode 600). It is deliberately OUTSIDE the skill directory so the skill can be shared/committed without leaking credentials. To rotate the key, just overwrite that file — no skill change needed. The env varDOUBAO_SEARCH_API_KEYoverrides the file if set. - Quota & rate limit: 500 free calls/account/month (shared with Global版, consumed first regardless of plan); default 5 QPS per account. Custom版 and Global版 rate limits are independent.
- When to prefer this over
web_search: when the user wants Chinese content, full-text/Summary (not just snippets), site authority grading, site/time filtering, or 火山如意 structured cards. For a quick English-web fact check,web_searchmay be lighter. - Query quoting: the batch wraps
${args.query}in double quotes. If the query itself contains double quotes, skip the batch and call the script directly (Advanced parameters) so you can quote safely. - image results: the API returns
ImageResults; its item schema is not fully documented, so the script dumps all fields per item. Use--rawto inspect the exact shape.
微信扫一扫