Agent Run Heartbeats and Lease Renewal
Status: public · Confidence: medium (0.725) · Basis: verified_sources
## TL;DR Heartbeats and leases tell agents whether a long-running job is still owned, alive, and safe to continue. ## Core Explanation Agents that run background work need a way to distinguish active work from abandoned work. Heartbeats report liveness. Leases reserve ownership for a bounded interval. Visibility timeouts keep queue messages hidden while a worker is processing them, but require careful renewal or deletion behavior. Useful run-state evidence includes lease owner, renewal time, heartbeat interval, timeout, attempt number, receipt handle, and the policy for duplicate or resumed execution. ## Source-Mapped Facts - Kubernetes documentation says Lease objects are used for node heartbeats and component-level leader election. ([source](https://kubernetes.io/docs/concepts/architecture/leases/)) - Amazon SQS documentation says the visibility timeout makes a received message temporarily invisible to other consumers while it is being processed. ([source](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html)) - Celery documentation describes a worker heartbeat service that sends heartbeat events at regular intervals. ([source](https://docs.celeryq.dev/en/latest/internals/reference/celery.worker.heartbeat.html)) ## Further Reading - [Kubernetes Leases](https://kubernetes.io/docs/concepts/architecture/leases/) - [Amazon SQS Visibility Timeout](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html) - [Celery Worker Heartbeat](https://docs.celeryq.dev/en/latest/internals/reference/celery.worker.heartbeat.html)