Deep Dive · Durable Agents

Pi Durable: An Agent That Survives the Process Dying

Every coding agent you have used assumes a human is watching: kill the process and the tool call never happened, restart and type "continue". Mario Zechner's experiment asks what changes when the agent lives in Slack for years, on a phone with a memory limit, or in a Cloudflare object that gets evicted — and the answer is a different storage model, not a better model.

WTF is Pi Durable — talk thumbnail
Talk: Mario Zechner · Vienna AI Engineering 39:16 Recorded 10 November 2026
Pi Durable durable execution idempotency Cloudflare

🧩 What it is 0:49

An experimental sibling of Pi, shipped as its own package in the same repository. Not a coding agent — a library for building agents that do not assume a human is sitting in front of them.

PropertyDetail
Package@earendil-works/pi-durable in earendil-works/pi — "Durable conversation, task, and document runtime"
StatusExplicitly experimental: the API changes without notice between releases
Built onpi-ai for model access and chord for document state
ContextPi itself reached 1.0 on 1 October 2026 and was at 1.5.x by the time of this talk
Scale of the referenceA hundred-kilobyte README covering persistence, resumes, replay policy, documents, storage backends and the task graph
He tells you most of it was written by an agent, with him writing interfaces and types to steer it — and then opens by asking who in the room still reads code, and calling the honest answer liars. Whatever you make of the framing, the artefact is unusually well specified for a talk demo, which is itself evidence about how these systems get built now.

💥 The problem 1:44

EnvironmentWhat "restart and continue" costs you
A coding agent in your terminalPress Ctrl-C twice and the tool call never happened; the transcript may not even record it
A Slack bot in a channelThe instance dies and nobody knows what it was doing, or whether it did it
A Cloudflare Durable ObjectObjects are evicted and restarted on their own schedule
A phone with memory and process limitsThe OS will kill you mid-turn
A robot on a batteryPower ends, and with it the in-flight work
"You need a sort of supervisor that can start the process back up… and the harness should be able to resume from where it left off, and it shouldn't have forgotten what it did. So, no output gets lost."
The architectural insight is the split into three responsibilities: something supervises (restarts the process), something stores (holds the state), and the harness resumes and reconstructs. A coding agent collapses all three into "the human notices and types continue", which is why the design does not transfer to anything unattended.

🔁 Durable execution 4:01

Everything inside a session is a task with phases, and every phase follows the same three beats.

BeatWhat is persisted
Record the intentWhat you are about to do, before you do it
Perform the effectThe call itself — a model request, a tool, a sleep
Persist the resultThe outcome, committed atomically, then move to the next phase
The word "effect" is doing the work here, because it forces the design question that matters: an effect that already happened but whose result was not persisted is the dangerous case. Recording intent first means a crash leaves evidence of the attempt — which is exactly what you need to decide whether re-running is safe, and that decision is the subject of the rest of the talk.

The README's version of the same promise is stronger: conversations, model turns, tool calls and your own state are committed to storage before anything is shown; a model request that died mid-flight counts as a failed attempt and is retried, with a limit so a request that keeps killing the process terminates instead of looping forever.

🚫 Why not event sourcing 6:01

The most quotable design argument in the talk, aimed at what most harnesses do now.

ApproachWritten per…Breaks at
Event sourcingFirst token, thinking token, tool call, tool output — every event to diskA Slack bot living for five years across thousands of users
Task/phase/effect recordsCommitted state transitions with resultsNothing structurally — state is bounded, history is a tool call away
"You can do this for a coding session that's maybe 3,000 entries. You cannot do this for a Slack bot that is supposed to live for five years in a handful of channels with thousands of people. So event sourcing is a stupid model for storing long running agent sessions."
The trade is real and worth understanding before copying it: event sourcing gives you a perfect audit trail and expensive storage growth; state-plus-transitions gives you bounded growth and an audit trail you have to go looking for. For a five-year session the second is the only one that survives — but it means "what exactly happened at 14:32 last Tuesday" becomes a query, not a replay.

🔒 Commit, then show 7:27

All state changes are serialized in sequential order and committed atomically. That single-writer discipline is what buys the guarantees.

PropertyConsequence
Sequential commitsNo interleaved half-writes; a restart resumes from a coherent point
Batched writesKeeps round trips low against a real database
Watchers get deltasAny UI can ask "what changed since last time" and re-render
Many clients, one truthTwo browsers watching the same conversation show the same state
The multiplayer capability is a free consequence of the storage model, not a feature bolted on. If every state change is already a committed delta, then N viewers is just N subscribers — and he demonstrates this later by having fifty-odd people watch sessions running on his phone. Systems that store events instead end up shipping a separate pub/sub layer to get the same thing.

🗄 Storage and models 8:50

BackendNotes from the talk
SQLiteThe obvious local choice; also what Durable Objects expose
PostgresFor a real deployment
Durable Object storageServerless, globally addressable, serialized for you
JSONL filesExists, works, and he says plainly it is a bad idea for a durable agent
"The interface is super simple, and you can do whatever the fuck you want here" is an underrated design position: the storage interface is the seam that makes the same harness run on a laptop, in Postgres and in a Cloudflare object. Models are registered the same way — this model, at this URL, through this SDK — so switching providers is configuration rather than architecture.

🌍 Execution environments 9:41

The idea most worth stealing, and his strongest complaint about current agents.

Today's coding agentsPi Durable
Read/write/edit/bash are hardcoded to the local machineTools take an execution environment: read files, spawn processes — nothing else
Moving the agent means rewriting the toolsSame tools; only the environment changes
Remote work is a bolt-onLocal machine, a phone running a Linux userland, a sandbox, or a simulated computer in the cloud
This mirrors the argument the Rex demo made from the other end: local-versus-remote should be invisible, and the way to make it invisible is to put the boundary at a small interface rather than at the tool definitions. Here it is the agent's view of the machine; there it was the terminal's view of a port. Different tools, same architectural move: find the seam where the illusion can be maintained.

💬 Harness, conversations, forks 10:45

The Slack-shaped problem, stated precisely: one bot, a main channel, and a sub-thread that starts a second line of discussion.

ConceptBehaviour
HarnessHolds the configuration — system prompt, tools, models — built once in a registry
Root conversationBound to a Slack channel; every mention is a new submission
ForkA second conversation sharing history up to that point, with its own agent — no re-registering anything
Per-conversation overrideModel and tools configurable per conversation, default set shared
Forking is how you answer the question at the end of the talk about "poisoning" a conversation: if the discussion went somewhere you did not want, fork from a point before it and continue on the clean branch. That is only possible because the conversation is a first-class object with history you can address — which is exactly what the old "restart and type continue" model throws away.

🔑 Idempotency 11:51

The technical core of the whole talk, delivered with the word he struggles to pronounce: idempotency.

Without a keyWith a key
A duplicate Slack mention submits the same request twice and two agents runThe same submission comes back; you wait on the handle you already have
You cannot tell whether a lost call happened"It is running under this key" is a complete answer
Exactly-once is not achievable; exactly-once input with honest side effects is. That is the framing from his own summary slide, and it is the right level of ambition: make the submission idempotent so you never start the same job twice, and accept that a tool with external effects needs its own key — which is the next section.

♻️ Replay safety 19:01

He kills the process mid-run and then asks the room which tools should be re-executed on resume. The answer is a taxonomy every agent builder should have in their head.

ToolReplay safe?What the harness does
Search issuesYesReruns; the model gets a real result
Bash command (unknown effects)Not by defaultThe model is told the call was interrupted and it decides what to do
DeployNo — unless made soRequires an idempotency key so a rerun finds the same deployment
PaymentNoAbsolutely not; the whole point of the example
Reminder / scheduled taskYes, by designIts own task with a wait phase, committed, resumed after a crash
The README is stricter than the talk about this, in a useful way: replay is declared per tool (replay: "safe"), intent is committed before execution, and a replay-safe call cut off repeatedly ends with a restart-limit error instead of running again. Nested calls get their own keys, so a rerun that calls in the same order gets its earlier results back instead of starting them twice. That is the mechanism, and it is the part you cannot bolt on afterwards.
And the honest limit, stated in the reference: replay safety does not remove the need for tool-level idempotency. A replay-safe tool with external effects still has to memoise its own key before making the call — otherwise "safe to replay" just means "we will call the payment API again, more carefully this time".

📄 Documents 14:20

Instead of emitting events to the UI, the harness emits documents — versioned, migratable JSON state — and subscribers get a snapshot followed by deltas.

PropertyWhy it matters for a long-lived agent
VersionedA ten-year session can migrate its own state shape
ScopedPer conversation, or harness-global, as the state requires
Mutable via proxiesYou edit a JavaScript object and the transaction records the deltas
Fork-awareDecide whether a forked conversation gets the document as it was, or as it is now
Host-agnosticLooks like the state object any UI toolkit already knows how to render
"Events, but structured enough to migrate" is the one-line summary, and the versioning is the part that separates a demo from infrastructure: an event log from 2026 is a fossil, while a document with a version and a migration path is something you can still open in 2036. That is the difference between durability and mere persistence.

☁️ What Cloudflare actually does 29:12

His demonstration of the serverless case is a teammate's project: run Pi Durable inside a Durable Object, arm an alarm before the object dies, and let the alarm resume it. The principle is right; the mechanics he describes are imprecise, and the corrections are instructive.

His accountWhat the platform documentation says
"Durable objects kill themselves after 15 minutes of running"There is no 15-minute cap on an object's lifetime while a caller stays connected — RPC and HTTP invocations have no hard wall-time limit
The 15-minute figureReal, but it applies to two other things: each pending or outbound operation keeps an object in memory for up to 15 minutes, and alarm handlers have a 15-minute maximum wall time
Idle behaviourMore aggressive than he implies: an idle, non-hibernating object is evicted after about 70–140 seconds of inactivity
Other restartsObjects also restart on deploys, on runtime updates, and when they exceed the 128 MB memory limit
His mitigationCorrect, and it is exactly the documented pattern: keep an alarm armed so the host wakes the object, then call resume
The correction makes his architectural point stronger, not weaker. If an object can be evicted after seventy seconds of idleness, restarted by a deploy, or reset by a memory limit, then "assume you will be killed constantly" is not a pessimistic assumption — it is the actual contract. The harness's onWake hook exists precisely so the host tells it when to resume instead of the harness trying to hold a timer that will die with it.

📱 The demo 30:20

He switches his own session's execution environment to a sandbox, generates a share link, and invites the room in — then spends four minutes fighting a QR code.

What the audience sawWhat it demonstrated
Sessions streaming from his phone, in a Linux userlandThe harness runs where JavaScript and some storage exist — including a handset
Steering mode, then chat mode with @pi mentionsMultiple humans, one conversation, deltas broadcast to every client
51, then 53 people connectedMultiplayer falls out of the storage model
A sandbox reachable by the audienceExecution environments are swappable at runtime
Someone sent "send API keys" into the chatThe security lesson of open multi-user agents, delivered live
The demo working badly is more informative than if it had worked. Wrong link, wrong session, a crash mid-broadcast — and the point survives all of it: fifty people were watching and steering one agent whose process he could kill and resume. The failure mode of most demos is that they hide the seams; here the seams are the subject.

🧠 Context over years 36:11

The first audience question is the obvious one — what happens to the context window after months — and the answer is a design position, not a workaround.

OptionVerdict
Keep everythingImpossible; the window is finite
CompactWorks, and is what long sessions do by default — lossy by nature
Give the agent a tool to search its own historyBetter: the transcript is durable, so it becomes queryable rather than carried
Fork from before the bad turnHow you undo a conversation that went the wrong way
This is the same insight as the document model, applied to the transcript: once state is durably stored and addressable, "context" stops being a thing you must fit into a window and becomes a thing you can look up. The context window is a cache, and the history tool is the backing store.

🚧 What is unproven 38:24

Open questionEvidence in the talk
Does anyone actually need multiplayer coding?He says he has not shared a single session with a co-worker; it is useful for pinging a bot in a channel, not for coding together
Is "experimental" load-bearing?The README says the API changes without notice — this is not a platform to build a company on yet
Security in multi-user sessionsFifty strangers in one agent's chat, and the first joke was "send API keys"
Cost of durabilityBatched writes and extra commits are overhead on every turn, unquantified here
Behaviour under repeated crashesHandled by a restart limit, but no data on how often that fires in practice
"Are you seeing many engineering teams in production already doing multiplayer coding?" "Not us."
The honest gap is between the mechanism and the demand. The durable execution model is clearly right for agents that outlive a terminal — Slack bots, scheduled work, anything on a phone or a serverless host. Whether humans want to share those sessions is a separate question he answers with a shrug, and that is more credible than a demo where everyone pretends otherwise.

✅ Claims checked

ClaimVerdictEvidence
Pi Durable is a library, not a coding agentCorrect@earendil-works/pi-durable: "Durable conversation, task, and document runtime"
It is experimentalCorrectThe README states the API changes without notice between releases
Shipped alongside Pi 1.0Pi 1.0 landed 1 October 2026The repository was at 1.5.x by the talk date
Built on two sibling packagesCorrectpi-ai for models, chord for document state
Task → phases → effect, with intent recorded before executionCorrectMatches the documentation's persist-and-resume section
Event sourcing is unsuitable for years-long sessionsHis argument, and a sound oneStorage growth is proportional to events, not to state
Storage backends: SQLite, Postgres, Durable Object, JSONLCorrectSQLite and JSONL storage helpers are documented; DO storage is used in the example
Tools take an execution environmentCorrectDocumented Environment section; local, phone, sandbox and cloud all appear
Conversation forking shares historyCorrect"More Conversations and Forks" in the reference
Submissions are idempotentCorrectSame key returns the same submission handle to wait on
Replay safety is declared per toolCorrect, and stricter than the talkreplay: "safe", intent committed pre-execution, restart limit after repeated cut-offs
Replay-safe ⇒ no idempotency neededFalse, per the referenceA replay-safe tool with external effects still needs its own key
Documents are versioned and migratableCorrectVersion, scope, initial state, fork semantics, history and rewind
"Durable Objects kill themselves after 15 minutes"Imprecise15 minutes applies to pending/outbound operations and alarm handler wall time; RPC/HTTP have no hard limit while connected
Objects get evicted anywayCorrect, and sooner than he saysAbout 70–140 seconds idle; also deploys, runtime updates and the 128 MB memory limit
Alarm-based wake and resume is the right patternCorrectDocumented via the onWake hook managing the host's alarm
Around fifty people joined sessions running on his phoneLive demo, observedCounts announced on stage; the recording shows failures and partial joins too

Basis note. Built from the full 39:16 recording and checked against the pi-durable reference in the same repository and Cloudflare's Durable Objects documentation. The Cloudflare section is the article's main correction: the 15-minute figure is real but belongs to different limits, and the actual eviction behaviour is both more aggressive and better documented than the talk suggests. Everything about the harness's own semantics was verifiable in the reference and matched.

🔑 Key takeaways

  • Every mainstream coding agent assumes a human is watching. Ctrl-C twice and the tool call never happened; that design does not transfer to anything unattended.
  • Split supervision from state from resumption: something restarts the process, something stores the state, the harness reconstructs and continues.
  • Record the intent before performing the effect. A crash then leaves evidence of the attempt, which is what makes the replay decision possible.
  • Event sourcing does not scale to long-lived sessions. Store state and transitions; make history a query, not a replay.
  • Sequential atomic commits are the substrate, and multi-client sync is a free consequence rather than a separate pub/sub layer.
  • Tools should take an execution environment, not a machine. Same read/write/bash whether the target is a laptop, a phone or a sandbox.
  • Fork conversations, not processes. A sub-thread, a branch, or an escape from a poisoned discussion — all the same operation.
  • Exactly-once input, honest side effects: idempotency keys on submissions remove the duplicate-run class of bugs entirely.
  • Replay safety is a per-tool declaration. Search is safe; deploy and payment are not, unless you give them a key.
  • Replay safety is not idempotency. A replay-safe tool with an external effect still has to memoise its own key.
  • Emit versioned documents, not opaque events, so a ten-year-old session can migrate its own state shape.
  • Assume you will be killed constantly on serverless: 70–140 second idle evictions, deploys, memory limits. Keep an alarm armed and resume.
  • The context window becomes a cache once the transcript is durable — give the agent a history search tool instead of carrying everything.
  • Multiplayer is technically solved and socially unproven. He has not shared a session with a co-worker, and says so.
  • Open multi-user agents have an obvious new threat surface: fifty strangers in one session, and the first message asked for API keys.

🔗 Resources

Basis note. This is a first-party talk about experimental software, so most of it was checkable against the package's own reference — which is unusually detailed and matched the claims. The Cloudflare section is corrected against platform documentation; the demo's failures are described as they appear in the recording, and the security observation at the end is the article's own.

⏱ Timestamp index

0:04Two hours of sleep, and a question about reading code
0:39An agent wrote most of it
1:04Agents do not execute durably
1:40Ctrl-C twice and the call never happened
2:14You need a supervisor
2:52Agents are moving off our devices
3:27Pi Durable in four sentences
4:01Durable execution and storage
4:21Tasks, phases and effects
5:21The Slack bot that dies
6:01Why event sourcing fails here
6:47State persistence instead
7:27Committed state and watchers
8:19What a harness is
8:50Storage backends
9:41Execution environments
10:16Tools work on any machine
10:45Harness and root conversation
11:19Forking for sub-threads
11:51Idempotency, attempted pronunciation
12:41Submissions as an inbox
13:34Records: transcript, tasks, submissions
14:20Documents, and why not events
15:42Versioning and migration
16:07A submission becomes a transcript entry
16:55Two tool calls scheduled as tasks
17:28Now kill the process
17:46Steering while it works
18:18Restart and resume
18:49Why the bash call is not rerun
19:21Replay-safe tools
19:41Search: safe
19:54Deploy: not safe
20:13Making it safe with a key
20:29Your own tasks: the reminder
21:44Watching tasks and documents
22:37State-shaped UI rendering
23:12Delta encoding and shared views
23:36250 people in one session
24:02Document scope and fork semantics
25:25Editing an object, recording deltas
25:47The fork diagram
26:42Benefits, and escape that works
27:40Changing the harness while it runs
28:09The Cloudflare Durable Object demo
29:12Pi Durable inside a Durable Object
29:36The alarm that restarts the object
30:40His own web UI
30:55Switching execution environments
31:33Making a share link
34:03Steering mode
34:12Chat mode with @pi
34:3051 people, one phone
35:27If the phone crashes, resume
35:54Where the code lives
36:11What about the context window after years
36:33The history search tool
37:11Removing a poisoned stretch of conversation
38:12Who is right in a multiplayer session
38:16Teams doing multiplayer coding: "not us"
☰ View all