Heartbeat System
The heartbeat system automatically re-engages contacts who have not responded within a configurable time interval.
How It Works
When a conversation enters WAITING_FOR_REPLY and the contact does not respond within the configured heartbeat interval, the system:
- Transitions the instance to
HEARTBEAT_SCHEDULED - The agent composes and sends a follow-up message
- The instance transitions back to
WAITING_FOR_REPLY - The cycle repeats until the contact responds or max follow-ups are reached
Configuration
Set heartbeat parameters when creating a conversation:
relay create \
--contact="+56912345678" \
--objective="confirm delivery" \
--todos="ask ETA" \
--heartbeat-interval=1800000 \
--max-followups=5| Parameter | Default | Description |
|---|---|---|
--heartbeat-interval | 1800000 (30 min) | Time in milliseconds to wait before sending a follow-up |
--max-followups | 5 | Maximum number of follow-up attempts |
The agent can also override the next heartbeat delay dynamically using the schedule_next_heartbeat(delay_ms) tool during a conversation.
Behavior
- Follow-up content: the agent decides the follow-up message based on conversation context and objective
- Abandonment: when max follow-ups are reached and the contact still has not responded, the instance transitions to
ABANDONED - Pausing: when an instance is paused, heartbeat timers are suspended. They resume when the instance is resumed.
Monitoring
Check heartbeat state for an instance:
relay get <instance-id>Output includes:
- Current follow-up count (e.g.,
2/5) - Heartbeat configuration (interval and max follow-ups)