hn.today

The immortal life of Pi (Running the Pi coding agent on Temporal)

temporal.io14 points0 comments
Screenshot of The immortal life of Pi (Running the Pi coding agent on Temporal)

pi-temporal is an experiment that runs the Pi coding agent on a fleet of Temporal Workers so an agent session can survive a host failure without changing Pi’s session format. Each Pi session is treated as a Workflow and each unit of work in a turn is an Activity: runModelCall, runToolCall, and sealStep. The transcript in the shared session file is the single source of truth; Activities reconstruct state from that file, Workers snapshot project directories into Git bundles beside the session, and a new Worker can apply missed bundles and continue. A chaos demo repeatedly kills the active Worker; turns continue on other Workers and interrupted tool calls are recorded as “outcome unknown” rather than being retried blindly. Before invoking a tool the system writes a claim (.jsonl.pending/), so retries that find a result return it, while retries that find only a claim report uncertainty to the model, which inspects the current state and decides whether to redo the work.

Recovery depends on a few strict rules: the transcript is the only conversation state, sealStep is the sole writer of a step’s tool results to preserve order, claims precede tool execution, and a lease/write guard prevents a Worker that lost ownership from appending late results. Attempts may time out without proving a Worker stopped, so the system closes abandoned steps and relies on the claim/guard mechanism to avoid duplicate effects. The experiment shows Pi Durable’s programming model fits durable-execution goals, while Temporal supplies cross-machine failover; the team retrofitted Pi with a small fork and provides an experimental Temporal Agent Harness as a starting point.

Read on temporal.io0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in AI

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.