Skip to main content

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-core
  • tools/plato_ask.py — Query tiles from CLI (pip install plato-ask)
  • tools/swiss_tournament.py — ELO-based tile quality ranking
  • tools/fix_pypi_packages.py — Mass-fix broken PyPI packages
  • tools/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

Metadata

Release files for cocapn 0.3.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 cocapn 0.3.0
File Size Uploaded Provenance Actions
cocapn-0.3.0.tar.gz 51.5 kB Without provenance Details for cocapn-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 70.0 kB

Release files / cocapn-0.3.0.tar.gz

Download URL cocapn-0.3.0.tar.gz
Size 51.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8096cb549a88939e73044252334ea603a53e25639ef917c1cc693319ca86c582
BLAKE2b-256 checksum
How to use checksums
0de65c2122dd7936d822d5a61d752aa0ea611363e6c2dfe6d28151c5afa82708
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / cocapn-0.3.0-py3-none-any.whl

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

Security for cocapn 0.3.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.

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