For anyone building autonomous AI agents or long-running coding workflows, there's one frustrating problem: what happens when everything crashes halfway through?

Well, this is exactly what Pi Durable from Earendil aims to solve.

It's an open-source TypeScript framework designed to help AI agents recover unfinished work after a crash or restart.

Prefer watching? Check out my full breakdown and live crash tests on YouTube:

How Does Pi Durable Actually Work?

Unlike traditional interactive coding agents, Pi Durable is a headless framework developers can use to build their own applications.

Think of it as giving your agent a memory of what it was doing.

Behind the scenes, Pi Durable saves conversations, task progress, and execution checkpoints to persistent storage like SQLite or JSONL.

If the process crashes, a new harness can reopen that storage and resume unfinished work.

But here's where things get interesting.

Repeating a file search is relatively harmless. Charging someone's credit card twice? Not so much.

Pi Durable distinguishes between operations declared safe to replay and potentially risky operations. Developers can also implement safeguards like idempotency keys to prevent duplicate actions.

So, does this actually work?

The Test Setup

I built two TypeScript scripts running on Node.js 24, using SQLite for persistent storage.

The first uses GPT-6 Sol through OpenAI Codex OAuth, while the second simulates payments without requiring an AI model.

Both scripts support three commands:

  • start — Launch the workflow.

  • inspect — Examine what's saved after a crash.

  • resume — Recover unfinished work.

Want to Try This Yourself?

I've packaged both TypeScript scripts, the shared helper files, project configuration, and a step-by-step setup guide into one ZIP.

Everything you need to follow along is included, except your own model credentials.

DOWNLOAD THE COMPLETE PI DURABLE DEMO ZIP HERE:

pi-durable-demos.zip

pi-durable-demos.zip

28.42 KB • X-ZIP-COMPRESSED File

Test 1: Background Subagents That Survive Restarts

For the first test, I had a main AI agent spawn a background analyst to complete a technical report.

While the analyst worked, the main agent could still respond to other requests.

Then I deliberately killed the entire Node.js process using SIGKILL.

Running inspect revealed that the original conversations and unfinished tasks were still recorded in SQLite.

After running resume, the analyst completed its report and delivered it back to the original conversation.

The result? One successful report delivery, with no duplicates detected.

Test 2: The Interrupted Checkout

For the second test, I simulated four payments processing simultaneously.

Just before they finished, I killed the process.

After restarting, all four payments completed successfully.

But I wanted to push things further.

The script deliberately submitted those same four payment requests again.

Here's what the separate payment ledger recorded:

Metric

Result

Total payment attempts

8

Unique simulated charges

4

Duplicate charges

0

Eight attempts, but only four unique simulated charges.

Stable idempotency keys allowed the simulated payment processor to recognize repeated requests.

The Catch

Pi Durable isn't magic.

It's still experimental, and Earendil warns that its APIs can change between releases.

You also need to build your own application around it. For real payments, the payment provider must enforce idempotency. Pi Durable alone cannot guarantee exactly-once external actions.

Final Thoughts

Both crash tests recovered successfully, and that's what makes Pi Durable interesting.

Durable execution isn't new. Systems like Temporal have been solving similar problems for years.

But bringing these building blocks into AI agent development opens up some interesting possibilities.

If you're experimenting with long-running agents, it's definitely worth exploring.

For more AI engineering experiments, benchmarks, and tutorials, subscribe to this newsletter and check out my YouTube channel.

Until next time, keep building!