Skip to main content
Heartbeat runs an agent on a recurring schedule and delivers the results via callbacks. Standalone — does NOT modify the Agent class.
The user configures a schedule; the heartbeat runs the agent and delivers results via callback.

How It Works

Quick Start

1

Basic Heartbeat

2

With Callback

3

Background Thread


Schedule Expressions

Heartbeat uses the same schedule parser as Schedule Tools:

Configuration


Error Handling


Best Practices

Call hb.start(blocking=False) to run in a daemon thread alongside your web server or bot.
Without on_result, results are only logged. Connect it to Slack, email, or a database for production use.
For long-running heartbeats, enable loop_detection=True on the agent to prevent stuck states.

Schedule Tools

Agent-centric scheduling via tool calls

Background Tasks

BackgroundRunner and ScheduleLoop