Skip to main content

Topics: fleet-coordination agent-herding synchronization task-routing distributed-agents cocapn


BorderCollie — Fleet Herding Agent

Fleet herding at scale — keeping 10,000+ agents aligned and heading in the same direction.

BorderCollie is a fleet coordination agent that keeps distributed AI agents synchronized and heading toward shared goals. Like a border collie managing sheep, it manages, groups, and directs tasks across distributed systems — ensuring no agent drifts off course while the herd moves together.

Part of the Cocapn fleet — lighthouse keeper architecture.


What It Does

BorderCollie manages the alignment problem in distributed agent fleets:

  • Alignment — Ensures all agents see consistent goals and constraints
  • Synchronization — Keeps agent state and configuration in sync across the fleet
  • Herding — Detects drift and nudges agents back on course
  • Grouping — Organizes agents into working groups (teams, roles, specializations)

Key Features

  • Goal propagation — Push goals to all agents in the herd
  • Drift detection — Monitor agent behavior against expected baseline
  • Priority routing — High/medium/low priority task distribution
  • Status tracking — Real-time view of aligned vs. drifting agents

Quick Start

Install

pip install cocapn-bordercollie

Basic Usage

from bordercollie import Herd

# Create a herd
herd = Herd()

# Register agents with roles
herd.add("oracle1", {"role": "coordinator", "capacity": 100})
herd.add("jetson1", {"role": "worker", "capacity": 60})
herd.add("ccc1", {"role": "worker", "capacity": 40})

# Herd toward a goal
herd.herd_toward(goal="sync-config", priority="high")

# Check status
status = herd.status()
print(f"Aligned: {status['aligned']}")
print(f"Drifting: {status['drifting']}")

Advanced Usage

from bordercollie import Herd, Priority

# Create herd with configuration
herd = Herd(
    drift_threshold=0.15,      # Flag agents >15% off baseline
    sync_interval=30,          # Re-sync every 30 seconds
    priority=Priority.HIGH
)

# Add agents with metadata
herd.add("agent-1", {"role": "orchestrator", "specialization": "code"})
herd.add("agent-2", {"role": "worker", "specialization": "research"})
herd.add("agent-3", {"role": "worker", "specialization": "docs"})

# Broadcast a goal to a subset
herd.herd_subset(
    goal="audit-fleet",
    filter={"role": "worker"},
    priority=Priority.MEDIUM
)

# Get drift report
drift_report = herd.drift_report()
for agent, drift_score in drift_report.items():
    if drift_score > 0.5:
        print(f"ALERT: {agent} is drifting ({drift_score:.0%})")

Architecture

bordercollie/
├── README.md
├── CHARTER.md
├── DOCKSIDE-EXAM.md
├── LICENSE
└── tests/
    └── test_bordercollie_docs.py   # Documentation contract tests

Component Overview

Component Role
Herd Main class. Manages agent registry, tracks status
Drift Detector Compares agent behavior against expected baseline
Goal Propagator Broadcasts goals to agents, tracks acknowledgment
Priority Router Routes tasks based on priority and agent capacity
Status Monitor Real-time aligned/drifting counts

Herding Flow

Goal Input
    │
    ▼
Priority Router
    │
    ├── High priority ──► Immediate broadcast to all agents
    │
    ├── Medium priority ──► Batch broadcast, wait for ack
    │
    └── Low priority ──► Deferred, batch with other goals
    │
    ▼
Drift Detector ◄── Agent Responses
    │
    ├── Agent on target ──► Mark "aligned"
    │
    └── Agent drifted ──► Mark "drifting", send correction
    │
    ▼
Status Report ──► Dashboard / fleet monitor

Demo: Herding a Fleet

from bordercollie import Herd, Priority

# Simulate a fleet herding session
herd = Herd()

# Register 5 agents
agents = [
    ("oracle1", {"role": "coordinator"}),
    ("jetson1", {"role": "worker"}),
    ("ccc1", {"role": "worker"}),
    ("forgemaster", {"role": "trainer"}),
    ("scout1", {"role": "explorer"}),
]

for name, meta in agents:
    herd.add(name, meta)

# Herd the fleet toward a configuration sync
result = herd.herd_toward(
    goal="sync-fleet-config-v2",
    priority=Priority.HIGH
)

print("=== Herding Result ===")
print(f"Goal: {result['goal']}")
print(f"Agents targeted: {result['targeted']}")
print(f"Acknowledged: {result['acknowledged']}")
print(f"Drift detected: {result['drift_count']}")
print()
print(herd.status())

Expected output:

=== Herding Result ===
Goal: sync-fleet-config-v2
Agents targeted: 5
Acknowledged: 4
Drift detected: 1

=== Fleet Status ===
Aligned: 4 (oracle1, jetson1, ccc1, forgemaster)
Drifting: 1 (scout1 — last seen 3 sync cycles ago)

Fleet Context

Part of the Cocapn fleet. Related repos:

Repo Role
cudaclaw GPU-accelerated agent orchestration
ai-character-sdk Unified AI character SDK with memory
crab-traps Lure collection for fleet learning
capitaine The Lucineer flagship repo-agent
fleet-orchestrator Stateless edge coordination hub

🦐 Cocapn fleet — lighthouse keeper architecture

Metadata

Release files for bordercollie 1.0.0

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

Source distribution (sdist)

Source distribution for bordercollie 1.0.0
File Size Uploaded Provenance Actions
bordercollie-1.0.0.tar.gz 11.2 kB Without provenance Details for bordercollie-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bordercollie 1.0.0
File Interpreter ABI Platform Actions
bordercollie-1.0.0-py3-none-any.whl Python 3 none any Details for bordercollie-1.0.0-py3-none-any.whl

Total release size: 17.3 kB

Release files / bordercollie-1.0.0.tar.gz

Download URL bordercollie-1.0.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b92a81d2a499a1ac36be6009b0c123b95557b1c235d64dcb669ff7342864e696
BLAKE2b-256 checksum
How to use checksums
34ea7c7ad1816ba7c23fbc5cdad20b6fd5cf9e213ab0cd162e3b3dfd0c4ab9fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / bordercollie-1.0.0-py3-none-any.whl

Download URL bordercollie-1.0.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6b9d2747baccbd1d80441f20612c074154bd43185df2adce5836e784d1883e2
BLAKE2b-256 checksum
How to use checksums
89b51a50eb826c16c3a9efe1993ff0eda205b400fb3c97c9c54b869a06583d96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for bordercollie 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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