cellz
SQLite-per-session, event-sourced state server for AI agents
Language-agnostic state & stream plane with atomic CAS leasing, Cloudflare R2 / S3 durability, and sub-millisecond local commits. Built in 100% Rust.
β‘ Positioning & Comparison with celld
While projects like denoland/celld bring Cloudflare Durable Objects to self-hosted environments by executing JavaScript/TypeScript Workers inside a sandbox, cellz takes a different, agent-focused path:
- Pure State & Stream Plane:
cellzdoes not execute user code inside the cell. It is completely language-agnostic, exposing REST, SSE, and WebSocket interfaces so agents written in Rust, Python, TypeScript, or Go can connect instantly. - Agent-Native Primitives: Built-in event sourcing, message materialization, key-value stores (Todos, Compactions), checkpointing, and branch rewinding.
- Atomic Single-Writer CAS Leases: Prevents split-brain across multiple distributed workers using S3
PutMode::Create/If-MatchETag conditional writes and atomic OS filesystem locks. - Actor Mailbox Serialization: Snapshots (
wal_checkpoint(TRUNCATE)) and state exports are serialized within the cell's actor mailbox, eliminating race gaps between WAL writes and backup reads. - Lossless Realtime Reconnection: SSE stream supports
Last-Event-IDand?since=query parameters to seamlessly replay historical missed events before transitioning to live broadcast.
ποΈ Architecture
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client / Web UI / Coding Agent β
ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β HTTP / SSE (Last-Event-ID) / WS
βΌ
ββββββββββββββββββββββββββββββββββββββββββ
β cellz β
β (Axum REST & Real-time Mesh) β
β β
β ββββββββββββββββββββββββββββββββββββ β
β β Session Cell (Actor) β β
β β - Monotonic Event Sourcing β β
β β - Materialized Message Projectionβ β
β β - Key-Value State Machine β β
β β - Dedicated SQLite (WAL Mode) β β
β β - Mailbox-Serialized Snapshots β β
β ββββββββββββββββββ¬ββββββββββββββββββ β
βββββββββββββββββββββΌβββββββββββββββββββββ
β
ββββββββββββββββββββββ΄βββββββββββββββββββββ
βΌ βΌ
βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
β Local Cell SQLite DBs β β Blob Storage Engine β
β `data/cells/{id}.db` β β (Local FS / S3 / R2) β
β (Microsecond Latency) β β (CAS Leases & Snapshots)β
βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
For in-depth architectural details, refer to Architecture Specification.
π Quick Start
Install from crates.io
Embed the Axum router in your own process:
[]
= "0.1"
use Arc;
use CellManager;
use Config;
use create_router;
use LocalBlobStore;
let config = default;
let storage = new;
let manager = new;
let app = create_router;
1. Run the Daemon from source
# Local filesystem storage
# Or with Cloudflare R2 / S3
2. Configuration Options
cellz is configured via environment variables:
| Environment Variable | Default Value | Description |
|---|---|---|
CELLZ_HOST |
0.0.0.0 |
Bind IP address |
CELLZ_PORT |
8080 |
Listen port |
CELLZ_DATA_DIR |
./data/cells |
Local SQLite databases storage path |
CELLZ_STORAGE_DIR |
./data/storage |
Snapshot backup & lease directory (local backend) |
CELLZ_LEASE_TTL |
60 |
Lease lock expiry duration in seconds |
CELLZ_STORAGE_BACKEND |
local |
Storage backend (local or s3) |
CELLZ_S3_ENDPOINT |
None | S3 / Cloudflare R2 endpoint URL |
CELLZ_S3_BUCKET |
None | S3 / Cloudflare R2 bucket name |
CELLZ_S3_ACCESS_KEY_ID |
None | S3 Access Key ID |
CELLZ_S3_SECRET_ACCESS_KEY |
None | S3 Secret Access Key |
CELLZ_S3_REGION |
auto |
S3 Region (auto for Cloudflare R2) |
3. Create a Session & Append Events
# 1. Create a new Cell
# 2. Append a user message
# 3. Retrieve projected messages
# 4. Subscribe to real-time events via SSE
Full API documentation and request/response payloads are available in API Reference.
π§ͺ Testing & Quality Gates
Run full test suite:
Run linter:
π Documentation Index
- Architecture Specification: Deep dive into Per-Cell SQLite, Actor lifecycle, and lease management.
- API Reference: Complete REST, SSE, and WebSocket endpoints specification.
- Admin UI Kit: Admin console UI framework and component catalog.
π License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.