Fleet Formation Protocol — self-organizing agent groups for the Cocapn fleet
Project description
Fleet Formation Protocol
Self-organizing agent groups for the Cocapn fleet.
Install
pip install fleet-formation-protocol
Usage
from fleet_formation_protocol import (
FormationProtocol, FormationType, AgentProfile,
FormationMessage, VickreyAuction,
)
# Create agents
agents = [
AgentProfile("scout-1", capabilities=["navigation", "sensing"], trust_score=0.8),
AgentProfile("worker-1", capabilities=["execution", "building"], trust_score=0.7),
AgentProfile("scout-2", capabilities=["navigation"], trust_score=0.6),
]
# Form a scout party
protocol = FormationProtocol()
formation = protocol.negotiate(agents, FormationType.SCOUT_PARTY, required_capabilities=["navigation"])
print(f"Formation {formation.formation_id}: {len(formation.agents)} agents, leader: {formation.leader.agent_id}")
# Send a formation message (binary format, max 1024 bytes)
msg = FormationMessage(
msg_type=3, # FORM
formation_id=1,
agent_id=42,
formation_type=FormationType.WORK_CREW,
payload={"task": "explore sector 7"},
)
data = msg.serialize() # → bytes
restored = FormationMessage.deserialize(data) # → FormationMessage
# Resolve conflicts (Vickrey auction)
result = protocol.resolve_conflict("formation_a", "formation_b", "contested_agent")
print(f"Winner: {result['winner_formation']}, price: {result['price']}")
Formation Types
| Type | Size | Purpose |
|---|---|---|
| SCOUT_PARTY | 2-4 | Exploration |
| WORK_CREW | 3-8 | Task execution |
| WAR_ROOM | 4-6 | Strategic planning |
| RELAY_CHAIN | 2-10 | Communication |
| COUNCIL | 5-12 | Governance |
Binary Message Format
16-byte header + JSON payload (max 1024 bytes total):
| version (1B) | type (1B) | formation_id (4B) | agent_id (4B) | formation_type (1B) | payload_len (2B) | checksum (3B) |
CRC-24 checksum over payload. Zero dependencies.
License
MIT
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 fleet_formation_protocol-0.2.1.tar.gz.
File metadata
- Download URL: fleet_formation_protocol-0.2.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ee52b32ca81668e8efea31a45d05fe8f1e8304b68badb5e82a56e12c4a6b1e1
|
|
| MD5 |
65e4e1b4cc01ff9ea6d6e68039c899d2
|
|
| BLAKE2b-256 |
16a993f09d19be6ddb409322309dca92ab91127f6160724a2997d2cd4305b0da
|
File details
Details for the file fleet_formation_protocol-0.2.1-py3-none-any.whl.
File metadata
- Download URL: fleet_formation_protocol-0.2.1-py3-none-any.whl
- Upload date:
- Size: 8.4 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 |
c52f6e1cf8c6ca00b93a9512bf647cf93f2b3bb794e859bc5823642a61e41a25
|
|
| MD5 |
146ad9b3f085eaf9efef9c26b5cccfe0
|
|
| BLAKE2b-256 |
406720613e1bf0c40cc2c3da362d6c92501d997201c6d9b8c4df703fa68b7ac2
|