Skip to content
Durable runs

Durable runs

The lifecycle, loop, and SQLite storage contracts are experimental. They help a host record recoverable progress; they do not run an agent, provider, or tool in the background.

Identity and admission

The host supplies RunIdentity, including run, thread, and turn IDs, an idempotency key, scope, and capabilities. Rust validation checks version and shape, but does not authenticate a user or verify declared permissions. SqliteRunLifecycleStore provides scoped admission and transitions using idempotency keys and expected versions.

Events and checkpoints

SqliteLedger records domain events with per-aggregate sequence numbers, idempotency keys, and version checks. Lifecycle, loop, and policy stores maintain their own snapshots/events, with atomicity inside the corresponding SQLite transaction. There is no single transaction across SQLite, PostgreSQL, a provider, and tool effects.

ResilientLedger commits locally to SQLite first and keeps an outbox to project events to PostgreSQL. A remote outage can leave the projection pending; a projection conflict must be handled as a conflict, not as permission to overwrite the local ledger.

Restart and external effects

Recovery restores state and identifies results that need reconciliation. It does not replay tools and does not provide exactly-once delivery. If the process stopped after an external effect but before recording its result, the host queries the external system with trusted credentials and context, authenticates the reconciliation decision, and only then submits a known or uncertain result to the engine.

Plan retention, SQLite file permissions, backups, and payload redaction in the host application. See the lifecycle, loop, SQLite ledger, and resilient ledger contracts.