Skip to main content

keeper-beacon

PyPI Python License: MIT

Fleet discovery and registry — agents appear on radar, get tracked and routed.

The lighthouse keeper needs to know where every agent is. Keeper Beacon provides fleet discovery, registration, and proximity tracking.

What It Does

  • Discovery — Agents register with the beacon on startup
  • Registry — Central directory of active fleet members
  • Proximity — Track which agents are near each other (same task, same room)
  • Matcher — Route agents to tasks based on capabilities and proximity

The Lighthouse Metaphor

The Cocapn brand IS the architecture. The lighthouse (keeper) monitors agent proximity. Radar rings represent fleet discovery. Each ring is an agent appearing on the radar, being tracked, authenticated, and routed.

Installation

pip install keeper-beacon

Usage

Agent Registry

Register fleet agents, track heartbeats, and monitor status.

from keeper_beacon import AgentRegistry, AgentRecord, AgentStatus

registry = AgentRegistry(stale_threshold=300.0)

# Register an agent
oracle = AgentRecord(
    agent_id="oracle1",
    name="Oracle1",
    capabilities=["reading", "synthesis", "coding"],
    endpoint="keeper:8900",
    trust_score=0.9,
    load=0.3,
)
registry.register(oracle)

# Heartbeat to keep agent active
registry.heartbeat("oracle1")

# List active agents
print(registry.active_agents)  # Only agents with ACTIVE status

# Get fleet stats
print(registry.stats())
# {"total": 1, "by_status": {"active": 1}}

Capability Matching

Find the best agents for a task based on required capabilities, load, and trust.

from keeper_beacon import CapabilityMatcher

matcher = CapabilityMatcher()

# Find all agents that have ALL required capabilities
required = ["python", "rust"]
results = matcher.fully_capable(registry.active_agents, required)

# Get best match with scoring
best = matcher.best_match(registry.active_agents, required)
if best:
    print(f"Agent: {best.agent.name}, Score: {best.score}")
    print(f"Matched capabilities: {best.matched_capabilities}")
    print(f"Missing: {best.missing_capabilities}")

Proximity Scoring

Score agents by capability overlap, latency, and trust for task routing.

from keeper_beacon import ProximityScorer

scorer = ProximityScorer(
    latency_weight=0.3,
    overlap_weight=0.4,
    trust_weight=0.3,
)

# Score and rank agents for a task
ranked = scorer.score_agents(
    registry.active_agents,
    required_capabilities=["python", "vision"],
)
for agent, score in ranked:
    print(f"{agent.name}: {score:.2f}")

Beacon Discovery

Broadcast and receive agent presence signals.

from keeper_beacon import BeaconDiscovery, BeaconSignal

discovery = BeaconDiscovery(ttl=120.0)

# Receive a beacon signal
signal = BeaconSignal(
    agent_id="scout1",
    name="Scout",
    capabilities=["vision", "navigation"],
    endpoint="scout:9100",
    ttl=60.0,
)
discovery.receive(signal)

# Find agents by capability
coders = discovery.discover(capability="navigation")
print(f"Found {len(coders)} agents with navigation")

# Prune expired signals
discovery.prune()

print(f"Active signals: {discovery.active_count}")

Part of the Cocapn Fleet

Powers the Keeper service on port 8900.

Architecture

                    ┌─────────────┐
                    │   Keeper    │
                    │  (port 8900)│
                    └──────┬──────┘
                           │
              ┌────────────┴────────────┐
              │     Keeper Beacon      │
              │   (keeper_beacon)       │
              ├─────┬──────┬──────┬─────┤
              │ Disc│Reg   │Prox  │Match│
              │ overy│istry │imity │er   │
              └──┬──┴──┬──┴──┬───┴──┬──┘
                 │     │     │      │
           ┌─────┘  ┌──┘  ┌──┘   ┌──┘
           ▼        ▼     ▼      ▼
        Agent   Agent  Agent   Agent

Changelog

0.2.3 (current)

  • Fixed license metadata on PyPI (setuptools 59.x compat)
  • Added CONTRIBUTING.md with development setup, code style, and testing guidance
  • Added code examples to README (AgentRegistry, CapabilityMatcher, ProximityScorer)
  • Added architecture diagram to README

0.2.2

  • Improved README with code examples and architecture diagram
  • Added CONTRIBUTING.md
  • Fixed license format for setuptools compat

0.2.1

  • Minor fixes and improvements

0.2.0

  • Expanded README with usage examples and architecture docs
  • Added CI workflow (test + publish to PyPI)
  • Added MIT license and PyPI badges
  • Fixed long description rendering on PyPI

0.1.0

  • Initial release: fleet discovery, registry, capability matching, proximity scoring
  • 14/14 tests passing

License

MIT

Metadata

Release files for keeper-beacon 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keeper-beacon 0.2.3
File Size Uploaded Provenance Actions
keeper_beacon-0.2.3.tar.gz 9.4 kB Without provenance Details for keeper_beacon-0.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for keeper-beacon 0.2.3
File Interpreter ABI Platform Actions
keeper_beacon-0.2.3-py3-none-any.whl Python 3 none any Details for keeper_beacon-0.2.3-py3-none-any.whl

Total release size: 17.8 kB

Release files / keeper_beacon-0.2.3.tar.gz

Download URL keeper_beacon-0.2.3.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4a9881bcadfe1f652e61b7002ccfa9c3c8abc11eafe5acaa58a4d29fa839fc54
BLAKE2b-256 checksum
How to use checksums
2ab7f943b6162eaf659c21e267655637a461f5c8b9504649b86b5f345afb57d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / keeper_beacon-0.2.3-py3-none-any.whl

Download URL keeper_beacon-0.2.3-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1dd58cd1b0a20916a0d6844120df25afa77098aecf88829d30abbe1a4d6a6233
BLAKE2b-256 checksum
How to use checksums
e7a036452a347cfae3ced8eb75e86b89be55a5f522d9da52258263f6c49b7059
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for keeper-beacon 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page