跳到主要内容

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

在本教程中,你将构建一个个人简报机器人,它每天早晨自动启动,研究你关心的主题,汇总发现,并将简洁的简报直接推送到你的 Telegram 或 Discord。

完成后,你将拥有一个完全自动化的工作流,结合了 网页搜索cron 调度委托(delegation)消息推送 — 无需编写代码。

我们要构建什么

流程如下:

  1. 上午 8:00 — cron 调度器触发任务
  2. AigenLabs 启动一个全新的 agent 会话,使用你的 prompt(提示词)
  3. 网页搜索拉取你关注主题的最新新闻
  4. 汇总将内容提炼为简洁的简报格式
  5. 推送将简报发送到你的 Telegram 或 Discord

整个流程无需人工干预。你只需在早晨喝咖啡时阅读简报即可。

前提条件

开始之前,请确保:

  • 已安装 AigenLabs Agent — 参见安装指南
  • Gateway 正在运行 — gateway 守护进程负责处理 cron 执行:
    aigenlabs gateway install   # Install as a user service
    sudo aigenlabs gateway install --system # Linux servers: boot-time system service
    # or
    aigenlabs gateway # Run in foreground
  • Firecrawl API 密钥 — 在环境变量中设置 FIRECRAWL_API_KEY 以启用网页搜索
  • 已配置消息推送(可选但推荐)— 已设置 Telegram 或 Discord 并配置了 home channel
没有消息推送?没关系

你仍然可以使用 deliver: "local" 跟随本教程。简报将保存至 ~/.aigenlabs/cron/output/,你可以随时查阅。

第一步:手动测试工作流

在自动化之前,先确认简报功能正常。启动聊天会话:

aigenlabs

然后输入以下 prompt:

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

AigenLabs 将搜索网页、阅读结果,并生成类似以下内容:

☀️ 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 AigenLabs Agent

如果运行正常,你就可以开始自动化了。

反复调整格式

尝试不同的 prompt,直到得到你满意的输出。可以添加诸如"使用 emoji 标题"或"每条摘要不超过 2 句话"之类的指令。最终确定的内容将写入 cron 任务。

第二步:创建 Cron 任务

现在让我们将其设置为每天早晨自动运行。有两种方式可以实现。

在创建 cron 任务之前,请确保 AigenLabs 已全局配置了默认模型和 provider。如果你希望某个任务使用不同的值,可在创建时设置该任务专属的 model/provider 覆盖项。

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

直接告诉 AigenLabs 你想要什么:

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.

AigenLabs 将使用统一的 cronjob 工具为你创建 cron 任务。

方式 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."

黄金法则:自包含的 Prompt

关键概念

Cron 任务在全新会话中运行 — 不保留之前对话的任何记忆,也不了解你"之前设置"的任何内容。你的 prompt 必须包含 agent 完成任务所需的一切信息

糟糕的 prompt:

Do my usual morning briefing.

好的 prompt:

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.

好的 prompt 明确说明了搜索什么多少篇文章什么格式以及什么语气。它在一次输入中包含了 agent 所需的全部信息。

第三步:自定义简报

基础简报运行正常后,你可以进一步发挥创意。

多主题简报

在一份简报中涵盖多个领域:

/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."

使用委托进行并行研究

若要加快简报生成速度,可以告诉 AigenLabs 将每个主题委托给子 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 将所有内容合并为一份精美的简报。详见委托文档了解其工作原理。

仅工作日调度

不需要周末简报?使用针对周一至周五的 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 添加个人上下文

如果你启用了 memory(记忆),可以存储跨会话持久保留的偏好设置。但请记住 — cron 任务在全新会话中运行,不保留对话记忆。若要添加个人上下文,请直接将其写入 prompt:

/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."
定制受众角色

在 prompt 中加入简报受众的详细信息,能显著提升内容相关性。告诉 agent 你的角色、兴趣以及需要跳过的内容。

第四步:管理你的任务

列出所有已调度任务

在聊天中:

/cron list

或在终端中:

aigenlabs 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.

AigenLabs 将使用 cronjob(action="list") 查找任务,并使用 cronjob(action="remove") 将其删除。

检查 Gateway 状态

确认调度器正在运行:

aigenlabs cron status

如果 gateway 未运行,你的任务将不会执行。将其安装为后台服务以确保可靠性:

aigenlabs gateway install
# or on Linux servers
sudo aigenlabs gateway install --system

进一步探索

你已经构建了一个可运行的每日简报机器人。以下是一些可以继续探索的方向:

还能调度什么?

简报机器人的模式适用于任何场景:竞争对手监控、GitHub 仓库摘要、天气预报、投资组合追踪、服务器健康检查,甚至每日笑话。只要你能用 prompt 描述它,就能调度它。