research/durable-agent-runtime/index.md
hermes 686d02755f durable-agent-runtime: add pi-durable deep dive + crash/replay experiments
- new pi-durable.md: architecture (session/entry/document/task/submission),
  effect-sandwich semantics, structured concurrency, storage backends,
  maturity/adoption, taxonomy placement, implications for hermes-vm
- empirical tests on @earendil-works/pi-durable 1.3.0 (Node 22.22.2):
  kill -9 mid-phase (memo vs plain), kill -9 mid-tool (safe vs unsafe),
  SQLite schema; noted cold-open waitForTask race and the main-vs-1.3.0
  version gap (sleepUntil/onWake/restartLimit/sleeping not published)
- taxonomy: durable harness library added as a new primitive family
- sources + next-steps updated
2026-10-20 13:20:24 +00:00

6.7 KiB

title description status category tags draft created updated origin
Durable Agent Runtime State & durability lens of agent infrastructure — durable objects (celld), actors (rivet), multi-hypervisor VM runtimes (hypeman, E2B/Amp Orbs), durable harness libraries (pi-durable), scale-to-zero/hibernation — and what they mean for building a self-hosted orb-like runtime on hermes-vm. Sibling of harness-engineering under the agent-infra umbrella. active technical
durable-objects
actors
agent-runtime
agent-infra
sandbox
microvm
self-hosting
orbs
stateful
durable-execution
pi-durable
true 2026-08-07 2026-10-20 buzz://d8a718be-031f-4a6e-9f5c-a55466641654/4123d35532d0b2cbfb80a0a34f79fb3e4e63c16c25b77d43bc0f10bb178e4f1b

Durable Agent Runtime

Summary

Research into how modern agent execution environments achieve durability and statefulness — where agent state lives, what compute primitive runs the agent, and how the environment hibernates and wakes. Covers durable objects / durable execution (celld, rivet, Durable Objects), actor runtimes, durable harness libraries (pi-durable), and microVM sandboxes (hypeman, E2B/Amp Orbs). The harness/loop lens (nanocodex, pi, Code Mode) now lives in harness-engineering/index. Goal: derive a build plan for a self-hosted, orb-like runtime on our NixOS VM (hermes-vm) without overbuilding.

Research Question

What are the architectural primitives for a durable, stateful agent runtime (sandboxed or not), and which combination fits a single self-hosted NixOS dev VM?

Scope

  • Included: durable objects / durable execution (celld, rivet, Durable Objects), actor runtimes, sandbox/VM runtimes (hypeman, E2B, Cloudflare isolates), scale-to-zero/hibernation, orbs
  • Excluded (moved): agent harness/loop engineering → harness-engineering/index; model training/inference infra, prompt engineering, RLHF
  • Sufficient answer: a taxonomy of primitives + a recommendation for what to build (and what NOT to build) on hermes-vm

Key Findings

  • The 2026 pattern is unanimous: agent compute is disposable, agent state is durable elsewhere. Amp: sandbox is ephemeral, the thread (prompts, tool calls, results) lives on the server. celld: nodes are replaceable, the S3 bucket is the source of truth. Rivet: actor state persists while the process may hibernate.
  • Three primitive families emerged (harness libraries split out to harness-engineering/index):
    1. Durable object/execution stores — celld (each object = its own SQLite DB, S3 replication, no consensus)
    2. Actor runtimes — rivet (in-memory state + persistence, ~20ms cold start, scale to zero, queues/workflows/scheduling)
    3. Sandbox/VM runtimes — hypeman (multi-hypervisor OCI-in-VM), E2B (Firecracker microVMs, snapshot restore, used as Amp's orb substrate)
  • Scale-to-zero / hibernation is universal: Amp orbs pause after 5 min idle; celld cells hibernate; rivet actors hibernate when idle; hypeman standby = snapshot VM to disk, resume in milliseconds; E2B snapshot reuse gives sub-30ms cold starts.
  • Two hard problems everyone solves: (a) cold start latency (actor ~20ms vs VM ~30s, mitigated by snapshot/pooling), (b) state checkpointing and recovery (SQLite replication, thread JSONL, VM snapshots, actor state persistence).
  • For our stack: hermes-vm is already a durable compute host (systemd services, kanban DB, session DBs, herdr panes). The real gap is a per-task disposable environment contract + event wake, not a distributed state layer. celld/rivet solve problems we don't have on a single box; hypeman is interesting for per-task VMs but likely overkill.
  • A new primitive family emerged (2026-10-01): the durable harness library. @earendil-works/pi-durable commits the agent loop itself — transcript entries, documents, tasks, submissions — and resumes unfinished work on reopen. It is substrate-agnostic: Node + SQLite/JSONL, or one Session per Cloudflare Durable Object. Its semantics are the interesting part: phases are at-least-once, tool effects are opt-in replay (safe vs interrupted), and only submission admission is exactly-once (requestId). See durable-agent-runtime/pi-durable.

Sources

For the full reference list see durable-agent-runtime/sources.

Detail Files

Discussion

Triggered from the Amp Orbs thread (2026-08-07). User connected the dots: orbs, nanocodex, durable objects (celld), actors (rivet), multi-hypervisor VM runtimes (hypeman), and Cloudflare Code Mode all belong to one research area — "durable object, stateful machine, harness engineering either sandboxed or not." Asked for centralized structured research he can digest. Completed directly (all primary sources already extracted; delegation channel has known instability). On 2026-08-11 the topic was narrowed to the state/durability lens and placed under the agent-infra umbrella; harness engineering split out.

Next Steps

  • Decide Phase 1 scope: per-repo .agents/setup-style contracts + AGENTS.md per repo on hermes-vm
  • Evaluate hypeman as an opt-in per-task VM runtime (snapshot/standby) vs NixOS containers
  • Decide whether to prototype pi-durable (Node/SQLite) for one long-running multi-client agent service, or only borrow its semantics for Hermes core (see durable-agent-runtime/pi-durable §Implications)

Conclusion

The research area is durable, stateful agent runtime — sandboxed or not. Three primitive families cover the space; for a single self-hosted NixOS VM the right move is environment contracts + event wake on the existing durable host, not building a distributed durable-object layer. The tool-interface half of the original question now lives in harness-engineering/index.