--- name: l2-web-research description: "L2 复合技能:多源网络调研。组合搜索引擎 + 网页抓取 + 数据提取,对给定主题进行自动化信息收集,返回结构化调研数据。" layer: 2 domain: research keywords: - research - investigate - survey - collect - sources dependencies: - l1-search-engine - l1-web-fetch - l1-data-extract input_schema: "{ topic: string, num_sources?: number }" output_schema: "{ sources: [{ title, url, key_points }], summary: string }" --- # L2: Web Research(多源网络调研复合技能) ## 能力 给定一个调研主题,自动执行"搜索→抓取→提取"流水线,从多个来源收集结构化信息。 ## 依赖的原子技能 | 步骤 | 调用技能 | 作用 | |------|---------|------| | Step 1 | `l1-search-engine` | 搜索相关页面 | | Step 2 | `l1-web-fetch` | 抓取搜索结果页面内容 | | Step 3 | `l1-data-extract` | 从页面中提取关键信息 | ## 执行流程 ``` 用户提供调研主题 │ ▼ ┌─────────────────────────────┐ │ Step 1: l1-search-engine │ │ 输入: 主题关键词 │ │ 输出: 搜索结果列表 (URL+标题) │ │ 数量: 5-10 条结果 │ └─────────┬───────────────────┘ │ ▼ (循环每个搜索结果) ┌─────────────────────────────┐ │ Step 2: l1-web-fetch │ │ 输入: 搜索结果 URL │ │ 输出: 页面正文 (Markdown) │ └─────────┬───────────────────┘ │ ▼ ┌─────────────────────────────────┐ │ Step 3: l1-data-extract │ │ 输入: 页面正文 │ │ 字段: title, author, date, │ │ key_points, category, │ │ data_quality │ │ 输出: 结构化 JSON │ └─────────┬───────────────────────┘ │ ▼ ┌────────────────────────────────┐ │ Step 4: 汇总 │ │ - 按 data_quality 排序 │ │ - 合并 key_points │ │ - 输出结构化调研数据集 │ └────────────────────────────────┘ ``` ## 使用方法 ### Step 1: 搜索 使用 `l1-search-engine` 搜索主题关键词: ```bash curl -sL "https://html.duckduckgo.com/html/?q=$(python3 -c "import urllib.parse; print(urllib.parse.quote('主题关键词'))")" \ -H "User-Agent: Mozilla/5.0" | python3 -c " import sys, re html = sys.stdin.read() results = re.findall(r']*>(.*?)', html, re.DOTALL) for i, (url, title) in enumerate(results[:10], 1): title = re.sub(r'<[^>]+>', '', title).strip() print(f'{i}. {title}') print(f' URL: {url}\n') " ``` ### Step 2: 逐个抓取 对每个搜索结果 URL,使用 `l1-web-fetch` 抓取页面内容。 ### Step 3: 提取关键信息 使用 `l1-data-extract`,提取字段: - `title`: 文章标题 - `author`: 作者 - `date`: 发布日期 - `key_points`: 3-5 个关键要点(数组) - `category`: 信息类别(新闻/教程/论文/报告/论坛) - `data_quality`: 信息质量评级(elite/average/low) ### Step 4: 汇总输出 ```markdown ## 调研数据摘要 共收集 X 个来源 (Elite: X, Average: X) ### Elite 级来源 | # | 标题 | 来源 | 关键要点 | |---|------|------|---------| | 1 | ... | ... | ... | ### 关键发现 1. ... 2. ... 3. ... ``` ## 输入 | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | topic | string | ✅ | 调研主题 | | num_sources | number | ❌ | 收集来源数,默认 5 | ## 输出 结构化调研数据:来源列表 + 关键要点 + 质量分级。 ## 约束 - 最多处理 10 个来源(避免超时) - 如果某个 URL 抓取失败,跳过并记录 - 自动去重(同一域名的多篇文章只保留最相关的一篇)