Menu

Summaries > SaaS > Pi > You need to check out Pi Durable...

You Need To Check Out Pi Durable

https://www.youtube.com/watch?v=BLRReTwV8Fc

TLDR Pi Durable is a JavaScript library for building long-running agents that save their state, recover from crashes, and resume safely without repeating risky actions. It works across platforms and model providers, lets agents decide their next steps, and can automate workflows like diagnosing bugs, fixing and testing code, and opening pull requests.

Key Insights

Choose a durable agent framework for long-running work

For agents that may run for hours or days, choose infrastructure that saves their state as they work. Pi Durable records conversation history, tool calls, pending approvals, and other progress, allowing a restarted process to resume where it left off. This reduces the need to rebuild fragile recovery logic yourself. It can run in JavaScript environments ranging from browsers to Node.js and supported cloud platforms.

Make tool retries safe before enabling recovery

A restarted agent may need to revisit a tool call, so define which tools are safe to run again. For actions with external effects—such as sending an email or creating a pull request—use safeguards to prevent duplicates or unintended repetition. Persist pending approvals so the agent can wait for authorization rather than silently proceeding. These practices help recovery avoid turning an interruption into a costly mistake.

Trigger agents with clear boundaries and checks

A practical agent workflow can start from an event, such as a Sentry alert or webhook, then investigate the issue, propose a fix, run tests, and open a pull request. Add explicit checks so the agent does not act on untracked issues or create duplicate pull requests. Keep consequential changes subject to human review and merge approval. This makes automation useful while preserving control over production changes.

Resume and steer the same agent run

Durable agents can preserve a run’s full history so you can stop work and return later without losing context. You can inspect what the agent did, discuss its reasoning, and revise the fix from another client. This is especially useful when debugging takes longer than one session or requires collaboration. Shared access can also make it easier to fork work or delegate tasks to sub-agents.

Keep your model and hosting options flexible

Pi Durable can connect to models from OpenAI or local providers and run on JavaScript-capable systems, including platforms such as Cloudflare Durable Objects or Deno Cell. This flexibility helps avoid tying an agent system to a single model vendor or runtime. Choose hosting based on your needs for persistence, deployment, and data location. Test the setup in the environment where the agent will actually run.

Explore examples before building custom infrastructure

Before writing a large custom agent harness, review Pi Durable’s examples for features such as restarting, tool overrides, compaction, and child tasks. Adapt a small example to one real workflow, then test interruptions and retries to verify that state is restored correctly. The speaker reports replacing roughly 8,000 lines of brittle custom code with Pi Durable, illustrating the potential to simplify maintenance. Use measured results from your own prototype to decide whether it fits your project.

Questions & Answers

What is Pi Durable?

Pi Durable is a JavaScript library for building agents that can keep working through crashes, interruptions, and long runtimes. It saves conversation history, tool calls, pending approvals, and other state so an agent can resume where it left off.

How does Pi Durable help agents recover safely?

Tools can declare whether they are safe to run again. This lets a restarted agent resume without repeating unsafe actions, such as sending an email.

How does Pi Durable differ from rigid workflow engines?

Rather than prescribing every step in a fixed workflow, Pi Durable lets the agent decide what to do next.

Where can Pi Durable run, and which models can it use?

It runs wherever JavaScript runs, including browsers, Node.js systems, Android phones, and platforms such as Cloudflare Durable Objects or Deno’s Cell. It can connect to OpenAI models or local providers, helping avoid vendor lock-in.

What self-healing workflow does the speaker demonstrate?

A Sentry report triggers an agent to triage a bug, investigate its root cause, fix and test the code, and create a GitHub pull request. After the change is reviewed and merged, the agent marks the issue resolved in the internal system and Sentry.

What bug did the example agent fix?

The cart total tried to read a discount percentage from full-price items, where the discount value was undefined.

What safeguards and collaboration features does Pi Durable support?

Agents can be accessed and steered from different clients, and the example setup prevents the agent from handling untracked issues or creating duplicate pull requests. A run can also be stopped and resumed with its full history available for discussion or revision.

What does the speaker recommend exploring?

The speaker recommends exploring Pi Durable’s examples, which demonstrate features such as restarting, tool overrides, compaction, and child tasks, and says durable agents are worth investigating for anyone building agents.

Summary of Timestamps

Pi Durable is a JavaScript library for building agents that can keep working through crashes, interruptions, and long runtimes. It comes from the team behind Pi, an extensible agent harness.
The library saves an agent’s conversation history, tool calls, pending approvals, and other state as it works. If the process restarts, the agent can pick up where it left off without repeating unsafe actions, such as sending an email.
Tools can specify whether they are safe to run again, and agents can be accessed and steered from different clients. This supports shared use and collaboration, as well as easier forking and creating sub-agents.
Rather than following a rigid workflow, Pi Durable lets the agent decide what to do next. It can run anywhere JavaScript runs—for example, in a browser with IndexedDB, on a Mac Mini with Node.js and SQLite, on an Android phone, or even on a low-cost photo frame.
The speaker says Pi Durable replaced about 8,000 lines of brittle custom agent code, making it much easier to build long-running, triggered agents that recover reliably.
Durable agents can run on platforms such as Cloudflare Durable Objects or Deno’s Cell and connect to models from OpenAI or local providers. This flexibility helps avoid locking an agent system to a single vendor.
The speaker demonstrates a self-healing bug-fix process: Sentry reports a bug, a webhook triggers an agent to investigate the root cause, and the agent fixes and tests the code before opening a GitHub pull request. After the change is reviewed and merged, the agent marks the issue resolved in both the internal system and Sentry.
In the example, the cart total calculation tries to read a discount percentage from full-price items, where the discount is undefined. The agent identifies this as the cause and works on a fix.
Because the workflow is durable, it can be stopped and resumed. The speaker can return to the same agent run, review its full history, and discuss or revise the proposed fix.
The setup includes safeguards to avoid acting on untracked issues or creating duplicate pull requests. The speaker also says their documents, chats, and to-dos run on Pi Durable agents locally.
The speaker recommends exploring Pi Durable’s examples, which demonstrate features such as restarting, tool overrides, compaction, and child tasks. The broader takeaway is that durable agents are worth considering when building systems that need to run reliably over time.

Related Summaries

Stay in the loop Get notified about important updates.