FraktalDeFiDAOIf you are building autonomous agents, you eventually hit the same operations problem: your agent can...
If you are building autonomous agents, you eventually hit the same operations problem: your agent can do tasks, but it is hard to know whether it is still healthy, whether peers are alive, and how to recover when one node goes down. Beacon addresses that gap.
Beacon is an AI agent coordination protocol focused on presence, trustable signaling, and recovery flows. Instead of only asking "can this agent do work?", Beacon adds a social layer: "is this agent alive?", "is it degraded?", and "can it announce migration before disappearing?".
Project link: https://github.com/Scottcjn/beacon-skill
In this tutorial, we will use Beacon from Python and implement two runnable flows:
heartbeat) for liveness trackingmayday) for controlled agent migration signalsBoth examples were tested locally with beacon-skill==2.11.1.
Most agent stacks have good primitives for prompts, tools, and memory, but weak primitives for agent-to-agent operations. In practice, teams need:
Beacon packages these concerns into a protocol and SDK, so each team does not need to rebuild liveness and recovery from scratch.
Use a clean Python virtual environment:
python3 -m venv .venv
source .venv/bin/activate
pip install beacon-skill
Check install:
python -c "import beacon_skill; print(beacon_skill.__version__)"
The first example creates an agent identity, builds a heartbeat envelope, processes it, and inspects peer status.
Create heartbeat_demo.py:
from pathlib import Path
from beacon_skill.heartbeat import HeartbeatManager
from beacon_skill.identity import AgentIdentity
def main() -> None:
data_dir = Path(".beacon-demo-data")
data_dir.mkdir(parents=True, exist_ok=True)
identity = AgentIdentity.generate()
heartbeat = HeartbeatManager(data_dir=data_dir)
envelope = heartbeat.build_heartbeat(
identity,
status="alive",
health={"cpu": 12, "memory": 34},
)
processed = heartbeat.process_heartbeat(envelope)
peer = heartbeat.peer_status(identity.agent_id)
print("agent_id:", identity.agent_id)
print("kind:", envelope.get("kind"))
print("status:", envelope.get("status"))
print("processed_assessment:", processed.get("assessment"))
print("peer_assessment:", peer.get("assessment") if peer else "unknown")
if __name__ == "__main__":
main()
Run it:
python heartbeat_demo.py
Typical output:
agent_id: bcn_95afee47968f
kind: heartbeat
status: alive
processed_assessment: healthy
peer_assessment: healthy
What is happening here:
AgentIdentity.generate() creates an Ed25519-backed Beacon identitybuild_heartbeat(...) builds the heartbeat payload with status and health metadataprocess_heartbeat(...) records the beat and computes liveness assessmentpeer_status(...) gives a current view of that agent from local heartbeat stateThis is enough to wire a basic liveness monitor for local and peer agent processes.
Now we add a mayday flow. This is the "do not silently die" path. If an agent is shutting down, moving hosts, or losing resources, it can emit a structured mayday signal with urgency and reason.
Create mayday_demo.py:
from pathlib import Path
from beacon_skill.identity import AgentIdentity
from beacon_skill.mayday import MaydayManager
def main() -> None:
data_dir = Path(".beacon-demo-data")
data_dir.mkdir(parents=True, exist_ok=True)
identity = AgentIdentity.generate()
mayday = MaydayManager(data_dir=data_dir)
payload = mayday.build_mayday(
identity,
urgency="planned",
reason="migrating to a new host",
config={"beacon": {"agent_name": "demo-agent"}},
)
print("agent_id:", payload.get("agent_id"))
print("kind:", payload.get("kind"))
print("urgency:", payload.get("urgency"))
print("reason:", payload.get("reason"))
print("content_hash:", payload.get("content_hash"))
if __name__ == "__main__":
main()
Run it:
python mayday_demo.py
Typical output:
agent_id: bcn_1f2e3d4c5b6a
kind: mayday
urgency: planned
reason: migrating to a new host
content_hash: 7f4c2d...
What this gives you:
planned, emergency)For real deployments, pair these examples with:
mayday with emergency
Even if you start with one host, these patterns become critical as soon as you have multiple agents or background workers.
Beacon is useful because it operationalizes agent coordination, not just agent capability. Heartbeats make liveness visible. Mayday makes failure and migration explicit. Together they reduce silent failure modes and improve recoverability in agent systems.
If you want to explore more, start with the Beacon repository and README:
If you are already running autonomous workflows, adding heartbeat + mayday is a practical first upgrade that pays off quickly.