Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help


教程:构建一个每日简报机器人

在这篇教程里,你会搭建一个属于自己的简报机器人。它会在每天早上自动醒来,调研你关心的话题,总结结果,然后把一份简洁的简报直接发到你的 Telegram 或 Discord。

完成后,你将拥有一个完全自动化的流程,把 网页搜索cron 调度任务委派消息投递 串起来,而且不需要写代码

我们要做什么

整体流程如下:

  1. 早上 8:00,cron 调度器触发你的任务
  2. Hermes 启动 一个带着你提示词的全新 agent 会话
  3. 网页搜索 拉取你关注主题的最新消息
  4. 摘要整理 将结果压缩成结构清晰的简报
  5. 消息投递 将简报发送到你的 Telegram 或 Discord

整个流程都无需你手动参与。你只需要在早上喝咖啡时读一眼简报即可。

前置条件

开始之前,请确认你已经具备:

  • 已安装 Hermes Agent,可参考 安装指南
  • Gateway 正在运行,因为 cron 任务由 gateway 守护进程负责执行:
    hermes gateway install   # 安装为用户级服务
    sudo hermes gateway install --system   # Linux 服务器:开机即启动的系统服务
    # or
    hermes gateway           # 前台运行
    
  • Firecrawl API key,用于网页搜索,请在环境变量中设置 FIRECRAWL_API_KEY
  • 消息平台已配置(可选但强烈建议),例如 Telegram 或 Discord,并设置好 home channel
:::tip 没有消息平台也没关系 你依然可以用 deliver: "local" 跟着这篇教程做。这样简报会保存在 ~/.hermes/cron/output/ 中,你随时都可以自己查看。
::

第 1 步:先手动验证这套流程

在自动化之前,先确认简报本身能跑通。启动一个聊天会话:

hermes

然后输入下面这段提示词:

Search for the latest news about AI agents and open source LLMs.
Summarize the top 3 stories in a concise briefing format with links.

Hermes 会去搜索网页、阅读结果,并生成类似下面的内容:

☀️ Your AI Briefing — March 8, 2026

1. Qwen 3 Released with 235B Parameters
   Alibaba's latest open-weight model matches GPT-4.5 on several
   benchmarks while remaining fully open source.
   → https://qwenlm.github.io/blog/qwen3/

2. LangChain Launches Agent Protocol Standard
   A new open standard for agent-to-agent communication gains
   adoption from 15 major frameworks in its first week.
   → https://blog.langchain.dev/agent-protocol/

3. EU AI Act Enforcement Begins for General-Purpose Models
   The first compliance deadlines hit, with open source models
   receiving exemptions under the 10M parameter threshold.
   → https://artificialintelligenceact.eu/updates/

---
3 stories • Sources searched: 8 • Generated by Hermes Agent
如果这一步能正常工作,就可以开始自动化了。

::tip 先把输出格式调满意 在正式做成 cron 任务前,可以先多试几种 prompt,找到你最喜欢的输出格式。比如加上“用 emoji 标题”或“每条摘要不要超过两句话”。等你满意后,再把这份提示词放进 cron 任务。

::

第 2 步:创建 Cron 任务

现在把它安排成每天早上自动运行。你有两种方式可以做。

方式 A:自然语言(在聊天中)

直接告诉 Hermes 你的需求:

Every morning at 8am, search the web for the latest news about AI agents
and open source LLMs. Summarize the top 3 stories in a concise briefing
with links. Use a friendly, professional tone. Deliver to telegram.

Hermes 会使用统一的 cronjob 工具为你创建任务。

方式 B:CLI 斜杠命令

如果你想要更多控制,可以使用 /cron

/cron add "0 8 * * *" "Search the web for the latest news about AI agents and open source LLMs. Find at least 5 recent articles from the past 24 hours. Summarize the top 3 most important stories in a concise daily briefing format. For each story include: a clear headline, a 2-sentence summary, and the source URL. Use a friendly, professional tone. Format with emoji bullet points and end with a total story count."

黄金法则:提示词必须自包含

:::warning 关键概念 Cron 任务运行在完全全新的会话里,不会记得你之前说过什么,也不知道你“前面已经配置过什么”。因此提示词里必须包含 Agent 完成任务所需的全部信息
::

不好的提示词:

Do my usual morning briefing.

好的提示词:

Search the web for the latest news about AI agents and open source LLMs.
Find at least 5 recent articles from the past 24 hours. Summarize the
top 3 most important stories in a concise daily briefing format. For each
story include: a clear headline, a 2-sentence summary, and the source URL.
Use a friendly, professional tone. Format with emoji bullet points.

好的提示词明确说明了搜什么找多少篇输出成什么格式采用什么语气。Agent 一次就能拿到所需全部信息。

第 3 步:定制你的简报

基础版跑通后,就可以开始扩展玩法了。

多主题简报

你可以在一份简报里同时覆盖多个领域:

/cron add "0 8 * * *" "Create a morning briefing covering three topics. For each topic, search the web for recent news from the past 24 hours and summarize the top 2 stories with links.

Topics:
1. AI and machine learning — focus on open source models and agent frameworks
2. Cryptocurrency — focus on Bitcoin, Ethereum, and regulatory news
3. Space exploration — focus on SpaceX, NASA, and commercial space

Format as a clean briefing with section headers and emoji. End with today's date and a motivational quote."

用 Delegation 做并行调研

如果你想让简报生成得更快,可以让 Hermes 把每个主题委派给一个子 Agent:

/cron add "0 8 * * *" "Create a morning briefing by delegating research to sub-agents. Delegate three parallel tasks:

1. Delegate: Search for the top 2 AI/ML news stories from the past 24 hours with links
2. Delegate: Search for the top 2 cryptocurrency news stories from the past 24 hours with links
3. Delegate: Search for the top 2 space exploration news stories from the past 24 hours with links

Collect all results and combine them into a single clean briefing with section headers, emoji formatting, and source links. Add today's date as a header."

每个子 Agent 都会独立并行地搜索,最后由主 Agent 把结果整合成一份打磨好的简报。更多机制可见 Delegation 文档

只在工作日运行

如果你周末不需要简报,可以使用只覆盖周一到周五的 cron 表达式:

/cron add "0 8 * * 1-5" "Search for the latest AI and tech news..."

一天两次

既想看早报,也想看晚间回顾,可以这样:

/cron add "0 8 * * *" "Morning briefing: search for AI news from the past 12 hours..."
/cron add "0 18 * * *" "Evening recap: search for AI news from the past 12 hours..."

用“用户画像”增强相关性

如果你启用了 memory,很多偏好可以长期保存。但要注意,cron 任务运行在新会话里,不带对话上下文记忆。要加入个人背景,更稳妥的方式是直接把它写进提示词:

/cron add "0 8 * * *" "You are creating a briefing for a senior ML engineer who cares about: PyTorch ecosystem, transformer architectures, open-weight models, and AI regulation in the EU. Skip stories about product launches or funding rounds unless they involve open source.

Search for the latest news on these topics. Summarize the top 3 stories with links. Be concise and technical — this reader doesn't need basic explanations."
:::tip 明确“这份简报是给谁看的” 只要告诉 Agent 读者是谁、关注什么、哪些内容应跳过,输出相关性通常会显著提升。
::

第 4 步:管理你的任务

列出所有定时任务

在聊天中:

/cron list

或者在终端里:

hermes cron list

你会看到类似输出:

ID          | Name              | Schedule    | Next Run           | Deliver
------------|-------------------|-------------|--------------------|--------
a1b2c3d4    | Morning Briefing  | 0 8 * * *   | 2026-03-09 08:00   | telegram
e5f6g7h8    | Evening Recap     | 0 18 * * *  | 2026-03-08 18:00   | telegram

删除任务

在聊天中:

/cron remove a1b2c3d4

或者直接用自然语言:

Remove my morning briefing cron job.

Hermes 会先用 cronjob(action="list") 找到任务,再用 cronjob(action="remove") 删除它。

检查 Gateway 状态

确认调度器确实在运行:

hermes cron status

如果 gateway 没启动,任务就不会执行。为了保证稳定性,建议把它安装成后台服务:

hermes gateway install
# 或者在 Linux 服务器上
sudo hermes gateway install --system

更进一步

你现在已经搭好了一个可用的每日简报机器人。接下来你还可以继续探索:

:::tip 还可以定时做什么? 每日简报只是一个模板。你也可以把这套模式用在竞品监控、GitHub 仓库摘要、天气预报、投资组合跟踪、服务器健康检查,甚至每天一条笑话。只要你能把任务描述清楚,就可以把它排进日程。
::