Cocapn Fleet v3.1 — Async fleet engine with Pydantic v2, batch ops, SSE
Project description
cocapn-core
Maximum capability in minimum lines. Single-process, async, self-evolving.
Cocapn Fleet v3.1 — a fully async coordination system for multi-agent knowledge crystallization.
Architecture
One import. One port. One truth.
cocapn/
├── models.py — Pydantic v2 models (Agent, Tile, Stream, Task, Rule)
├── engine.py — Fleet engine (connect, submit, batch, evolve, monitor)
├── storage.py — JSONL persistence with field indexing
├── grammar.py — Sanitized rule engine (safe eval, action whitelist)
├── server.py — FastAPI endpoints (/connect, /submit, /interact, /task)
├── evolve.py — Grammar-driven evolution
├── monitor.py — Stream divergence detection
└── validation_loop.py — Assertion-based tile quality scoring
Install
pip install cocapn
Quick Start
from cocapn import Fleet
fleet = Fleet(storage_dir="./plato")
await fleet.connect("my_agent", "scout")
tile = await fleet.submit("my_agent", "What is DPDK?", "DPDK is...", domain="networking")
status = await fleet.status()
API Endpoints
# Start server
uvicorn cocapn.server:app --port 4042
# Connect agent
curl -X POST http://localhost:4042/connect -H "Content-Type: application/json" \
-d '{"agent": "bot1", "job": "critic"}'
# Submit tile
curl -X POST http://localhost:4042/submit -H "Content-Type: application/json" \
-d '{"agent": "bot1", "question": "Q?", "answer": "A!", "domain": "code"}'
# Batch submit
curl -X POST http://localhost:4042/submit/batch -H "Content-Type: application/json" \
-d '{"agent": "bot1", "tiles": [...]}'
# Health check
curl http://localhost:4042/health
Performance
| Operation | Throughput |
|---|---|
| Stream observe | 800K ops/s |
| Batch submit (100) | 535K ops/s |
| Grammar eval | 232K ops/s |
| Tile submit | 128K ops/s |
| Agent connect | 61K ops/s |
Tools
tools/import_tiles.py— Import PLATO tile corpus into cocapn-coretools/plato_ask.py— Query tiles from CLI (pip install plato-ask)tools/swiss_tournament.py— ELO-based tile quality rankingtools/fix_pypi_packages.py— Mass-fix broken PyPI packagestools/bench_cocapn.py— Performance benchmarks
Testing
pip install cocapn[dev]
pytest tests/ -v
19 extended tests + 21 original tests = 40 total, all passing.
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cocapn-0.3.0.tar.gz
(51.5 kB
view details)
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
cocapn-0.3.0-py3-none-any.whl
(18.5 kB
view details)
File details
Details for the file cocapn-0.3.0.tar.gz.
File metadata
- Download URL: cocapn-0.3.0.tar.gz
- Upload date:
- Size: 51.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8096cb549a88939e73044252334ea603a53e25639ef917c1cc693319ca86c582
|
|
| MD5 |
a4c7b9e1b0b82778760268931a1cb77a
|
|
| BLAKE2b-256 |
0de65c2122dd7936d822d5a61d752aa0ea611363e6c2dfe6d28151c5afa82708
|
File details
Details for the file cocapn-0.3.0-py3-none-any.whl.
File metadata
- Download URL: cocapn-0.3.0-py3-none-any.whl
- Upload date:
- Size: 18.5 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 |
ffa9c77901bc379d59a334320802ba3bde46e0a1f53e84b2d97fe2ce6efca426
|
|
| MD5 |
58f1b0c11d8f6d1ee05e324f3261737e
|
|
| BLAKE2b-256 |
1bf6b4d41dfd2395c069250e7c5413579a86a5ff8cec2c5deb6d70cd4b091236
|