跳到主要内容
Claw101
第8章 · 免费预计阅读 1 分钟

自动化

自动化

OpenClaw 通过 cronheartbeat 实现自动执行任务。

启用 Cron

{
  cron: {
    enabled: true,
    maxConcurrentRuns: 2,
  },
}

常用命令

# 新增任务(每天 9 点)
openclaw cron add --schedule "0 9 * * *" \
  --message "总结昨天的邮件并发到 Telegram" \
  --channel telegram --target <你的ChatID>

# 查看任务
openclaw cron list

# 删除任务
openclaw cron remove <cron-id>

Heartbeat(周期检查)

{
  agents: {
    defaults: {
      heartbeat: {
        every: "30m",
        target: "last",
        model: "openai/gpt-5-mini",
      },
    },
  },
}

在工作空间写 HEARTBEAT.md,定义检查清单(邮箱、日历、通知等),减少重复配置。

何时用 Cron,何时用 Heartbeat

  • 需要精确时刻触发:用 cron
  • 需要批量检查并复用上下文:用 heartbeat

下一步

结合《浏览器控制》,把网页检查、截图和日报做成自动流程。

学完这章想实战?加入社群获得 $50 算力额度 + 实时答疑

加入社群 ¥99