Cocapn Fleet module — bordercollie
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bordercollie-1.0.0.tar.gz.
File metadata
- Download URL: bordercollie-1.0.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b92a81d2a499a1ac36be6009b0c123b95557b1c235d64dcb669ff7342864e696
|
|
| MD5 |
2e0ec8936d7ffa2e04a17551557062c0
|
|
| BLAKE2b-256 |
34ea7c7ad1816ba7c23fbc5cdad20b6fd5cf9e213ab0cd162e3b3dfd0c4ab9fe
|
File details
Details for the file bordercollie-1.0.0-py3-none-any.whl.
File metadata
- Download URL: bordercollie-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6b9d2747baccbd1d80441f20612c074154bd43185df2adce5836e784d1883e2
|
|
| MD5 |
3ab9229a6e8aaa9e5affa985ed454024
|
|
| BLAKE2b-256 |
89b51a50eb826c16c3a9efe1993ff0eda205b400fb3c97c9c54b869a06583d96
|