docs: add activeHours to heartbeat field notes and examples (#9366)

Co-authored-by: unisone <unisone@users.noreply.github.com>
This commit is contained in:
Alex Zaytsev
2026-02-05 21:18:57 -05:00
committed by GitHub
parent 717129f7f9
commit d2aee7da68
2 changed files with 30 additions and 0 deletions

View File

@@ -137,6 +137,30 @@ Example: two agents, only the second agent runs heartbeats.
}
```
### Active hours example
Restrict heartbeats to business hours in a specific timezone:
```json5
{
agents: {
defaults: {
heartbeat: {
every: "30m",
target: "last",
activeHours: {
start: "09:00",
end: "22:00",
timezone: "America/New_York", // optional; uses your userTimezone if set, otherwise host tz
},
},
},
},
}
```
Outside this window (before 9am or after 10pm Eastern), heartbeats are skipped. The next scheduled tick inside the window will run normally.
### Multi account example
Use `accountId` to target a specific account on multi-account channels like Telegram:
@@ -183,6 +207,11 @@ Use `accountId` to target a specific account on multi-account channels like Tele
- `accountId`: optional account id for multi-account channels. When `target: "last"`, the account id applies to the resolved last channel if it supports accounts; otherwise it is ignored. If the account id does not match a configured account for the resolved channel, delivery is skipped.
- `prompt`: overrides the default prompt body (not merged).
- `ackMaxChars`: max chars allowed after `HEARTBEAT_OK` before delivery.
- `activeHours`: restricts heartbeat runs to a time window. Object with `start` (HH:MM, inclusive), `end` (HH:MM exclusive; `24:00` allowed for end-of-day), and optional `timezone`.
- Omitted or `"user"`: uses your `agents.defaults.userTimezone` if set, otherwise falls back to the host system timezone.
- `"local"`: always uses the host system timezone.
- Any IANA identifier (e.g. `America/New_York`): used directly; if invalid, falls back to the `"user"` behavior above.
- Outside the active window, heartbeats are skipped until the next tick inside the window.
## Delivery behavior