agentbay-monitor-skills
정보
이 스킬은 데이터 크롤링, 감정 분석, 보고서 생성을 포함한 전과정 여론 모니터링을 수행합니다. 사용자가 특정 주제에 대해 '舆情分析'(여론 분석)을 요청하거나 '舆论'(여론)에 대해 질문할 때 자동으로 작동합니다. 워크플로우는 엄격하게 정의되어 있으며, 크롤링은 내부적으로 처리되고 메인 에이전트는 제공된 프롬프트를 사용해 감정 분석을 수행한 후 최종적으로 보고서를 생성합니다.
빠른 설치
Claude Code
추천npx skills add agentbay-ai/agentbay-skills -a claude-code/plugin add https://github.com/agentbay-ai/agentbay-skillsgit clone https://github.com/agentbay-ai/agentbay-skills.git ~/.claude/skills/agentbay-monitor-skillsClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
AgentBay 舆情监控 Skill
⚠️ 舆情分析 = 全流程(必读)
用户说「运行舆情分析」「做舆情分析」「舆情分析 主题是 XXX」时,必须执行完整三步,不能只跑爬取就结束。
| 步骤 | 动作 | 说明 |
|---|---|---|
| 1. 爬取 | crawl.py 或 crawl_for_sentiment(...) | 得到 raw_output_path(爬取结果 JSON) |
| 2. 情感分析 | 读 scripts/sentiment/sentiment_instruction.md → 对爬取 JSON 逐条判定 → 写情感结果小 JSON → 运行 write_processed.py | 得到 processed JSON(如 output/processed.json) |
| 3. 生成报告 | report.py --input <processed 路径> 或 generate_report(...) | 得到 Markdown/JSON(及可选 PDF) |
禁止行为:只运行 crawl.py 后就说「爬取完成,情感分析由主 Agent 完成」并结束。这是错误用法——主 Agent 就是你自己,你必须继续完成步骤 2 和 3,直到产出最终报告文件。
何时使用
用户出现以下任一意图时,必须使用本技能并执行全流程(爬取→情感分析→生成报告):
- 问「某事件/话题舆情如何」「XX 舆论怎么样」「想了解 XX 的舆情」
- 「运行舆情分析」「做舆情分析」「舆情分析 主题是 XXX」
- 舆情监控、情感分析、舆情报告、按关键词/平台爬取并生成报告(中英文场景均可)
意图为舆情相关即默认使用本技能,不可仅用联网搜索代替。
重要约定:凡提到「舆情分析」(或「运行舆情分析」「做舆情分析」等等价表述),即视为执行全流程——爬取 → 情感分析 → 生成报告。必须按该完整流程执行,不可只做爬取;最终产出须包含 Markdown/JSON(及可选 PDF)报告。
前置条件
工作目录为技能目录(本 SKILL 所在目录);已安装依赖;已配置 AGENTBAY_API_KEY。
依赖
pip install wuying-agentbay-sdk pandas numpy pyyaml markdown
可选(PDF 报告):brew install cairo pango gdk-pixbuf 后 pip install weasyprint。不装则仅无 PDF,.md/.json 正常。
API Key
仅需配置 AGENTBAY_API_KEY。环境变量:export AGENTBAY_API_KEY=你的key(Windows PowerShell:$env:AGENTBAY_API_KEY="你的key")。或直接写文件:mkdir -p ~/.config/agentbay && echo -n '你的key' > ~/.config/agentbay/api_key。获取:https://agentbay.console.aliyun.com/service-management 。未配置时运行脚本会报错。其余参数由主 Agent 传参/命令行传入。
整体流程
舆情分析 = 全流程:爬取 → 情感分析 → 生成报告(见上文「⚠️ 舆情分析 = 全流程」)。用户要求「舆情分析」时,三步都必须执行,不能只做第 1 步。
- 爬取:
crawl.py或crawl_for_sentiment(...)→ 得到raw_output_path(爬取结果 JSON)。 - 情感分析:主 Agent 读提示词
scripts/sentiment/sentiment_instruction.md,对爬取 JSON 逐条判定情感,产出情感结果小 JSON;再运行write_processed.py合并得到 processed JSON(如output/processed.json)。提示词可定制。 - 生成报告:
report.py --input <processed 路径>或generate_report(processed_results, ...)→ Markdown/JSON(及可选 PDF)。
运行方式
步骤 0:登录(仅非搜索引擎)
xhs/weibo/douyin/zhihu 须先登录;百度、Bing 不需要。python scripts/login.py --platform xhs [--context-name sentiment-analysis] → 浏览器中登录后终端按 Enter,状态持久化。非搜索引擎爬取时 --context-name 须与登录一致。
步骤 1:爬取
python scripts/crawl.py --keywords "关键词1,关键词2" [--platform baidu] [--max-results N] [--output-dir output]
参数:-k 必需;-p 默认 baidu(可选 xhs/weibo/douyin/zhihu/bing);--max-results、-o、--report-title、--context-name、--crawl-timeout。百度/Bing 仅抓资讯列表页(不点进链接),百度用资讯 URL(tn=news)。
爬取超时(必读):执行环境(如 run_terminal_cmd)的超时须 ≥ 10 分钟(600 秒或 600000 毫秒),否则会中断。约 1 条/分钟,10 条约 10 分钟;建议超时略大于估算(如 15 分钟)。脚本内 --crawl-timeout 不传时会自动按条数计算,一般无需手传。
步骤 2:情感分析
主 Agent 读 scripts/sentiment/sentiment_instruction.md,对爬取 JSON 逐条判定情感并按规定格式写 processed JSON(无需在技能中配置 LLM)。
步骤 3:生成报告
python scripts/report.py --input <processed JSON 路径> [--output-dir output] [--title "报告标题"]
输出
爬取 → raw_output_path、crawl_results。情感分析 → processed JSON(含 sentiment_statistics、每条 sentiment,格式见提示词)。报告 → markdown_path、json_path、可选 pdf_path。
Agent 调用要点
舆情分析必跑全流程:用户说「舆情分析」「运行舆情分析」或类似意图时,必须完成「爬取 → 情感分析 → 合并(write_processed.py)→ 生成报告」,产出最终报告文件。不可只运行爬取后就说「情感分析由主 Agent 完成」并结束——主 Agent 即当前 Agent,必须由你继续完成情感分析与报告。
- 登录:非搜索引擎前先
login.py --platform <平台>;百度/Bing 免登录。 - 爬取:
crawl.py或crawl_for_sentiment(...),默认平台 baidu;执行超时 ≥ 10 分钟(见上文「爬取超时」);非搜索引擎时context_name与登录一致。 - 情感分析:读
scripts/sentiment/sentiment_instruction.md;对爬取 JSON(raw_output_path)逐条判定情感;写情感结果小 JSON(如output/sentiment_only.json);运行python scripts/sentiment/write_processed.py --raw <爬取JSON> --sentiment <情感结果JSON> --output output/processed.json。 - 报告:
report.py --input output/processed.json或generate_report(...)。 - 失败:未配置 Key、未登录或执行失败 →
success: False、error。
代码示例
import asyncio, sys, json
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent / "scripts"))
from crawl import crawl_for_sentiment, generate_report
async def main():
result = await crawl_for_sentiment(platform="baidu", keywords=["产品名"], max_results_per_keyword=10, output_dir="output")
if not result.get("success"): return
raw_path = result.get("raw_output_path")
# 主 Agent:读 sentiment_instruction.md → 对 raw_path 做情感分析 → 写 output/processed.json(或先用 write_processed.py 合并)
processed_path = Path("output") / "processed.json"
with open(processed_path, "r", encoding="utf-8") as f:
report = generate_report(json.load(f), output_dir="output", title="舆情报告")
print("报告:", report.get("markdown_path"))
asyncio.run(main())
常见问题
- 只跑了爬取怎么办:若已运行
crawl.py得到raw_output_path,必须继续做情感分析(读sentiment_instruction.md、写情感结果 JSON、运行write_processed.py)再运行report.py --input <processed路径>,直到产出报告。 - processed JSON:title/content 常含未转义双引号,手写易导致
report.pyJSON 解析失败。主 Agent 只产出「情感结果」小 JSON,再运行python scripts/sentiment/write_processed.py --raw <爬取JSON> --sentiment <情感结果JSON> --output <processed路径>。详见sentiment_instruction.md第 4 节。 - 登录失效:重跑
python scripts/login.py --platform <平台> [--context-name ...]。 - 爬取超时:执行环境超时须 ≥ 10 分钟(见上文);需更长时显式传
--crawl-timeout(秒)。
文件结构
SKILL.md · scripts/:crawl.py(爬取/报告入口)、report.py、login.py、crawler/、sentiment/(sentiment_instruction.md、write_processed.py)、reporter/ · output/
GitHub 저장소
연관 스킬
content-collections
메타이 스킬은 콘텐츠 콜렉션(Content Collections)을 위한 프로덕션 검증된 설정을 제공합니다. 콘텐츠 콜렉션은 Markdown/MDX 파일을 Zod 검증이 포함된 타입 안전한 데이터 콜렉션으로 변환해주는 TypeScript 최우선 도구입니다. 블로그, 문서 사이트 또는 콘텐츠 중심의 Vite + React 애플리케이션을 구축할 때 타입 안전성과 자동 콘텐츠 검증을 보장하기 위해 사용하세요. Vite 플러그인 구성과 MDX 컴파일부터 배포 최적화 및 스키마 검증에 이르기까지 모든 것을 다룹니다.
polymarket
메타이 스킬은 개발자들이 Polymarket 예측 시장 플랫폼을 활용한 애플리케이션을 구축할 수 있도록 지원하며, 거래 및 시장 데이터를 위한 API 통합 기능을 포함합니다. 또한 WebSocket을 통한 실시간 데이터 스트리밍을 제공하여 실시간 거래와 시장 활동을 모니터링할 수 있습니다. 이를 통해 거래 전략을 구현하거나 실시간 시장 업데이트를 처리하는 도구를 생성하는 데 활용할 수 있습니다.
creating-opencode-plugins
메타이 스킬은 개발자들이 명령어, 파일, LSP 작업 등 25개 이상의 이벤트 유형에 연결되는 OpenCode 플러그인을 만들 수 있도록 돕습니다. JavaScript/TypeScript 모듈을 위한 플러그인 구조, 이벤트 API 명세, 구현 패턴을 제공합니다. OpenCode AI 어시스턴트의 라이프사이클을 사용자 정의 이벤트 기반 로직으로 가로채거나, 모니터링하거나, 확장해야 할 때 사용하세요.
sglang
메타SGLang은 RadixAttention 프리픽스 캐싱을 활용하여 JSON, 정규식, 에이전트 워크플로우를 위한 고속 구조화 생성에 특화된 고성능 LLM 서빙 프레임워크입니다. 특히 반복되는 프리픽스가 있는 작업에서 상당히 빠른 추론 속도를 제공하여 복잡한 구조화 출력 및 다중 턴 대화에 이상적입니다. 제약 디코딩이 필요하거나 광범위한 프리픽스 공유가 있는 애플리케이션을 구축할 때는 vLLM과 같은 대안보다 SGLang을 선택하십시오.
