← All KinPapers
2The LocalKin Team · April 2026

Heart: A Zero-Token Autonomous Agent Heartbeat Architecture

The LocalKin Team

April 2026

Abstract

We present Heart, a three-chamber autonomous agent heartbeat architecture that enables continuous 24/7 operation of large language model (LLM) agents with zero token cost for keepalive. Heart decomposes the agent lifecycle into three independent chambers -- Pulse, Schedule, and Idle -- each operating at a different timescale and with distinct resource profiles. The Pulse chamber maintains liveness through MQTT keepalive signals at 10-second intervals, consuming no LLM tokens whatsoever. The Schedule chamber orchestrates periodic LLM wakeups governed by a daily atomic counter that hard-caps invocations to prevent budget runaway. The Idle chamber enables autonomous exploration after periods of user inactivity. A novel [IDLE] ghost mode allows an LLM to signal "nothing to do" upon wakeup, triggering immediate message rollback that eliminates both token cost and memory pollution. We report on a production deployment of 75 agents running continuously, achieving 315 million heartbeats per year at $0 token cost, and describe two case studies in which the daily cap and circuit breaker mechanisms prevented pathological wakeup storms.

Keywords: autonomous agents, heartbeat architecture, zero-token keepalive, LLM orchestration, multi-agent systems

1. Introduction

The rise of autonomous LLM-based agents has introduced a fundamental tension: agents must remain alive to be responsive, yet every interaction with an LLM incurs token cost. Existing frameworks such as CrewAI, AutoGen, and LangGraph address agent scheduling through various mechanisms -- cron-triggered pipelines, human-in-the-loop gates, and cyclic graph traversals -- but all of them treat the LLM as the substrate for liveness itself.

Heart resolves this tension through architectural separation. By decomposing the agent lifecycle into three independent chambers, each with its own failure domain and resource profile, we achieve a system where:

  1. Liveness is free. The Pulse chamber uses MQTT keepalive, a pure I/O mechanism with zero LLM involvement.
  2. Intelligence is budgeted. The Schedule chamber invokes the LLM on configurable intervals with a hard daily cap.
  3. Curiosity is bounded. The Idle chamber enables autonomous exploration only after confirmed user inactivity, and the [IDLE] ghost mode ensures that unproductive wakeups leave no trace.

2. Problem Statement

Consider an agent framework that must keep N agents alive and responsive over a 24-hour period. The naive approach -- polling the LLM every t seconds to check for work -- incurs the following cost:

Daily token cost = N * (86400 / t) * C_poll

For 75 agents polling every 30 seconds: 75 * 2880 * 100 tokens = 21.6M tokens/day = ~$43/day at $2/M tokens.

This amounts to roughly $15,700 per year spent on asking the LLM if it has anything to do.

FrameworkLiveness MechanismToken CostLimitation
CrewAICron-triggered tasksPer-invocationNo continuous presence
AutoGenHuman-in-the-loopPer-messageRequires human to initiate
LangGraphGraph cycle detectionPer-cycleCycles are execution paths, not heartbeats
HeartMQTT keepalive$0None for liveness

3. Architecture

Heart is organized as three independent chambers, each responsible for a distinct aspect of agent lifecycle management.

3.1 Pulse Chamber

The Pulse chamber is responsible solely for agent liveness. It operates as a pure I/O loop with no LLM involvement:

  1. Every 10 seconds, the agent publishes a keepalive message on its MQTT topic.
  2. The Mizpah dashboard subscribes to these topics and maintains a liveness map.
  3. If three consecutive keepalive messages are missed (30 seconds), the agent is marked offline.

Over one year of continuous operation, 75 agents produce approximately 315 million heartbeats per year, all at zero token cost.

3.2 Schedule Chamber

The Schedule chamber is responsible for periodic LLM invocations. Configuration is specified per-agent in the soul file's YAML frontmatter:

heart:
  schedule:
    interval: 30m
    prompt: |
      Check for new GitHub trending repos in AI/ML.
      If nothing notable, respond with [IDLE].
    daily_cap: 48

The daily cap is the critical safety mechanism. Without it, an agent configured with a 5-minute interval could wake 288 times per day.

3.3 Idle Chamber

The Idle chamber enables autonomous exploration. It fires when the agent detects that no user input has been received for a configurable duration (default: 2 hours).

3.4 Chamber Independence

A key design principle of Heart is that the three chambers are fully independent. If the MQTT broker goes down, agents continue to wake up on schedule. If the LLM provider experiences an outage, the Pulse chamber continues to report liveness.

4. Ghost Mode: The [IDLE] Protocol

Ghost mode is the mechanism by which Heart achieves zero cost for unproductive wakeups. When the LLM determines there is nothing to do, it responds with [IDLE], triggering:

  1. Zero memory pollution. Both the prompt and response are rolled back from conversation history.
  2. Zero effective token cost. The daily cap bounds ghost-mode round-trips to negligible amounts (~$0.004/day).

5. Daily Atomic Counter

The daily atomic counter is a 64-bit integer that tracks the total number of LLM invocations across both the Schedule and Idle chambers. It is implemented using Go's sync/atomic package and resets at midnight. The counter is checked before the LLM is invoked.

6. Circuit Breaker Pattern

Heart implements a dual-trigger circuit breaker to prevent pathological loops. The circuit breaker tracks LLM response failures and tool call failures independently. When the circuit is open, the Schedule and Idle chambers skip wakeups silently while the Pulse chamber continues.

7. Evaluation

7.1 Production Deployment

MetricValue
Total agents75
Heartbeats per year~315,000,000
Token cost for heartbeats$0
Ghost mode activation rate~78% of scheduled wakeups
Mean daily LLM invocations per agent31.4
Circuit breaker activations per week2-5
System uptime99.2%

7.2 Case Study: travel_rescue Wakeup Storm

The travel_rescue agent was initially configured with a 5-minute interval and no daily cap, producing 288 wakeups per day. The fix: increase interval to 30 minutes and set daily cap to 48 --- an 83% reduction.

7.3 Case Study: Seed Tool Call Cap

A stock price agent entered retry loops consuming the daily cap in under an hour. Resolved by adding a per-wakeup tool call cap (seed_tool_cap: 5).

8. Mizpah Dashboard Integration

The Mizpah dashboard provides real-time 2D visualization of the agent fleet in 344 total lines of code. Each agent is represented as a floating circle whose visual behavior reflects its Heart state. The dashboard is driven entirely by the zero-cost heartbeat stream.

9. Design Principles

Principle 1: Liveness is not intelligence. The question "is the agent alive?" should never require an LLM call.

Principle 2: Absence is information. When an LLM wakes up and finds nothing to do, that is a successful determination, not a failed invocation.

Principle 3: Caps are not optional. Any system that invokes an LLM on a timer without a hard cap will eventually experience runaway costs.

10. Conclusion

Heart demonstrates that autonomous agent liveness can be achieved at zero token cost through architectural separation of concerns. The key insight is simple: an agent's heartbeat should not require a brain.

References

[1] J. Moura, "CrewAI: Framework for orchestrating role-playing autonomous AI agents," 2024.

[2] D. Wu, et al., "AutoGen: Enabling next-gen LLM applications via multi-agent conversation," Microsoft Research, 2023. arXiv:2308.08155.

[3] W. Chase, "LangGraph: Building language agents as graphs," LangChain, 2024.