Skip to content
AI Primer
workflow

Pi Durable demonstrates durable code execution for agent workflows

Mario Zechner reports internal durable codemode support in Pi Durable and demonstrates inspectable, steerable subagent workflows. The demonstrated application has not yet been published.

4 min read
Pi Durable demonstrates durable code execution for agent workflows
Pi Durable demonstrates durable code execution for agent workflows

TL;DR

  • Durable codemode now works internally, Pi creator Mario Zechner reported in his announcement.
  • Dynamic subagent workflows can be inspected and steered during execution, according to the workflow demo.
  • Pi Durable is already public; the demonstrated application remains unpublished, Zechner said in a reply.

Pi’s codemode sandbox has no timers; the restart test sleeps through Bash instead. The durable harness can store its state in SQLite or JSONL and run its tools on a different machine.

Durable codemode

Codemode lets the model compose tool calls in JavaScript. Pi’s existing coding-agent documentation describes the interface:

  • Async scripts: raw JavaScript runs as an async function body, supporting top-level await and return.
  • Filtered results: scripts can run calls in parallel and aggregate their results; only the script’s output reaches the model.
  • Sandboxed execution: QuickJS has no Node APIs, direct filesystem access, or network access. External operations go through exposed tools and models.

Zechner’s announcement extends that programming pattern to Pi Durable, with support described as achieved internally.

Checkpoints and tool replay

Pi Durable records model requests and tool calls as tasks, with checkpoints between steps. Reopening the same storage lets a new process continue unfinished work, according to Earendil’s crash-recovery description.

Recovery differs by operation:

  • Model requests: interrupted requests are sent again; partial answers remain in the transcript, marked aborted.
  • Replay-safe tools: calls declared replay: "safe" can rerun after a crash.
  • Other tools: interrupted calls produce an error result containing output stored so far, leaving the model to decide what happens next.
  • Client submissions: retrying the same requestId returns the original submission rather than admitting another input.

Replay safety is the sharp edge: Earendil’s payment example uses a per-task idempotency key to prevent a repeated charge.

Inspectable subagent workflows

Zechner demonstrated dynamic workflows whose subagents remain inspectable and can receive steering messages while working.

Dynamic workflow with inspectable subagent activity

Applications build subagent tools from Pi Durable’s conversation and task primitives. In Earendil’s subagent example:

  • Each child runs in its own conversation, with a separate transcript and cost accounting.
  • The parent tool exposes the child’s conversation ID through api.details(), letting a UI display it beneath the call.
  • Task ownership connects cancellation: aborting the owning tool also aborts its subagent.

Framework and app availability

Earendil released Pi Durable as an experimental package alongside Pi 1.0 on October 1. The public package is @earendil-works/pi-durable; its README warns that the API can change without notice between releases.

Zechner gave “soon” as the publication timing for the app shown in the demos.

Mention-triggered chat

Chat mode lets humans converse without delivering every message immediately to the agent. Mentioning the agent sends a steering message containing all chat messages not yet delivered.

The harness API inserts steering messages after the current tool round. Follow-up messages wait until the current run answers, then start another run.

Networked plugins

Zechner also announced a pi-mobile plugin update with these properties:

  • Networked plugins.
  • Multi-user and multi-surface awareness.
  • Hot reloading.
  • Participation in durability.

He clarified in a reply that the plugin system is separate from Pi Durable. Future applications built on it may or may not use the durable framework.

Prime Agent and Rust

Prime Agent’s original implementation was based on Pi; its team then used a swarm to rewrite it in Rust, Zechner explained in a reply. His “pi goes rust” post joked about that lineage.

Further reading

Discussion across the web

Where this story is being discussed, in original context.

On X· 4 threads
TL;DR1 post
Inspectable subagent workflows1 post
Networked plugins1 post
Prime Agent and Rust1 post
Share on X