Skip to main content

Heartbeat

Heartbeat is the resident runtime check that records Anyy liveness and watches for failed cron jobs. It runs inside the gateway while the resident runtime is active.

It does not call the model. It reads local state, updates the heartbeat meta record, and can publish a notification when it sees a new cron failure signature.

Heartbeat Status

Use:

anyy heartbeat status
anyy heartbeat status --json

The status payload includes:

FieldMeaning
enabledWhether heartbeat is enabled in config.
statusok, degraded, disabled, or unknown.
tick_intervalHow often the gateway heartbeat loop runs.
failure_cooldownStored cooldown value for failure notifications.
delivery_targetsNotification targets, defaulting to gateway.
actor_idAlways heartbeat.
role_id / workspace_idScope used for heartbeat notifications.
last_tick_atLast successful heartbeat tick timestamp, when present.
last_notification_atLast cron-failure notification timestamp, when present.
cron_failed_jobsCount of enabled cron jobs whose last status is failed.

anyy status --json and gateway status RPC include heartbeat status beside cron, channels, MCP, storage, and gateway listener summaries.

Configuration

Configure heartbeat under heartbeat:

heartbeat:
enabled: true
tick_interval: 1m
failure_cooldown: 15m
delivery_targets:
- gateway
role_id: home
workspace_id: default

Defaults:

FieldDefaultMeaning
enabledtrueStarts heartbeat while the gateway is running.
tick_interval1mInterval between ticks.
failure_cooldown15mCooldown value stored with failure notification state.
delivery_targets["gateway"]Delivery targets for heartbeat notifications.
role_idhomeRole scope for heartbeat events.
workspace_iddefaultWorkspace scope for heartbeat events.

Durations accept Go duration strings such as 30s, 1m, or 15m. The compatibility fields tick_interval_seconds and failure_cooldown_seconds are also accepted.

Runtime Events

On each tick, heartbeat:

  1. Loads the previous heartbeat state record.
  2. Scans enabled cron jobs for last_status: failed.
  3. Publishes one notification when a new failure signature appears.
  4. Saves updated heartbeat state with liveness and failure metadata.

The notification title is Anyy heartbeat. The message identifies the cron job that last failed.

Heartbeat notifications are scoped with:

MetadataValue
sourceheartbeat
actor_idheartbeat
role_idConfigured role id, default home.
workspace_idConfigured workspace id, default default.

Heartbeat removes legacy user_id, agent_id, and deliver fields from its stored state when it writes the current record.

Observability

Use anyy doctor when heartbeat status is missing, stale, or degraded. The doctor output includes a heartbeat probe based on the same status payload.

Common checks:

SymptomCheck
status is unknownThe gateway may not have ticked yet, or the state database may be new.
status is disabledheartbeat.enabled is false.
status is degradedCron failure scanning or notification delivery returned an error.
last_tick_at is staleConfirm the resident gateway is running for the expected home/profile.

Heartbeat is profile-local. If you use multiple profiles or --home values, run the status command against the same home that runs the resident gateway.