Temporal

The immortal life of Pi: Running the Pi coding agent on Temporal.

Oct 8, 2026Moe Abadi
The immortal life of Pi: Running the Pi coding agent on Temporal.
SummaryAI, from the source post

This post details the integration of the Pi coding agent with Temporal Workflows to provide durable execution and automatic recovery across machine failures. It describes how Temporal Workflows act as the execution engine, with each turn of the agent's interaction (model call + tool calls) mapped to Activities. The session file serves as the conversation state, and Git bundles preserve project snapshots. The post highlights the handling of 'unknown outcomes' for tool calls that may have partially executed before a worker failure, and the mechanism for preventing stale attempts from corrupting the session state using a write guard and lease. The core rules for recovery are: transcript as the sole conversation state, `sealStep` as the sole writer of tool results, pre-invocation claims for tools, a write guard rejecting appends from workers that lost their lease, and configurable token/time budgets.

More from the Sandbox Orchestration Harness trail