Agent frameworks#Coding agent#Runtime
durable-harness: durable coding agents that resume after a crash
durable-harness lets teams run Pi, OpenCode, fx, Claude Code or Codex as durable coding agents that resume from their log after a crash.
Project facts
GitHub Ecosystem- License
- Apache-2.0
- Language
- TypeScript
- Stars
- 90
- Data checked
- 2026-10-21
Snapshot figures reflect the check date and may change over time.

Your coding agent’s process can die halfway through a reply, and Vercel’s docs say most harnesses keep an unfinished turn in that process’s memory, so the turn dies with it. durable-harness turns Pi, OpenCode, fx, Claude Code and Codex into durable coding agents that run on a Workflow SDK World. Each session is one workflow run, and its event log holds the conversation, the turn in flight and every model and tool call, so another machine can pick up the turn after a crash. The WeChat account AI工程化 introduced it on October 21.
Core features
durable-harness has one core job: let a session survive a crash, and keep any tool that must not repeat from running twice.
- Resume from the log: Each turn has a message on Vercel Queues behind it. When its function dies, a new function reads the session log and continues where the last one stopped. A call that already has an outcome in the log is read back, not run again.
- A replay rule per tool: Each tool is marked
safeornever. Asafetool, such as a read-only lookup, can run again after a crash. Pi reruns it, while Claude Code, Codex and OpenCode tell the model it is safe to repeat. Anevertool, such as a refund or an email, never runs a second time. The model only learns that the call may or may not have happened, so it can check before it retries. - Which harnesses need a sandbox: Pi, OpenCode and fx run inside your function. Claude Code and Codex run only in a Vercel Sandbox that belongs to one session, even on a server you run yourself, because the docs describe them as single-user command-line tools that keep state on disk.
- Three file locations:
virtual()keeps files in the session log, so they move with the session.virtual({ durable: false })keeps them in memory and clears them at the end of each turn.sandbox()runs commands in the session’s own Vercel Sandbox, with files on a Drive. - Storage you can swap: The World is the Workflow SDK’s storage and queue interface. Local development writes to
.workflow-databy default, sessions show up in Agent Runs on Vercel, and self-hosting can switch to the Postgres World. - Documents: typed JSON state, such as a to-do list, kept in the session log. Each document is capped at 64 KB.
| Harness | Package in the README | Where it runs |
|---|---|---|
| Pi | durable-harness/pi-durable (recommended) or durable-harness/pi | Your function, with files in a virtual workspace or a Sandbox |
| OpenCode | durable-harness/opencode | Your function, with files in a virtual workspace or a Sandbox |
| fx | durable-harness/fx, agent from libfx | Your function, with files in a virtual workspace or a Sandbox |
| Claude Code | durable-harness/claude-code | Vercel Sandbox only (experimental) |
| Codex | durable-harness/codex | Vercel Sandbox only (experimental) |
Package names come from the README. Run locations come from Vercel’s harness table.
Typical use cases
durable-harness fits a turn that has already done real work when the process dies.
- A support team with a refund tool: Mark the refund tool
never. The docs give one example: a function dies while writing a reply, and the new function reruns only the interrupted model call, so the customer is refunded once. - A product team that puts an agent in a web chat: A turn can outlive one function’s maximum duration, and a client that disconnects reconnects to the turn still running. The README’s quick start is a Next.js chat route.
- A team that keeps sessions in its own database: Use the Postgres World. It needs
@workflow/world-postgres5.0.4 or later, Node.js 22 or later, and theWORKFLOW_TARGET_WORLDandWORKFLOW_POSTGRES_URLvariables. Outside Vercel, model calls also needAI_GATEWAY_API_KEY.
Quick start
The README’s example pairs Pi with a Next.js app. Install the dependencies first:
npm install durable-harness @earendil-works/pi-durable @earendil-works/chord @earendil-works/pi-ai just-bash
Then add three files: lib/agent.ts, which opens Pi’s durable Harness; app/api/chat/route.ts, which exports chatRoute; and next.config.ts, which wraps the config in withDurableHarness. Local development needs no extra setup. The README shows no UI or sample output, and its authorize function is a placeholder comment. The docs say a chat route without authorize returns 401 to every request in production, so you write that check yourself.
Summary
durable-harness suits a team that already runs Pi, OpenCode or fx and wants long turns to survive crashes, especially one that is happy to deploy on Vercel or run its own Postgres. It is a poor fit for a production system that needs a stable API. The README says the project is experimental and on 0.0.x, and npm’s latest release is 0.0.1-beta.6. Teams that want Claude Code or Codex on their own servers still need Vercel Sandbox, because the docs say those two run only there.
Several limits matter. A Sandbox allows all outbound traffic by default (network: 'deny-all' turns that off), runs for at most four hours, and has no model-spend cap unless you set one with sandbox({ budget }). Pi (durable-harness/pi) and OpenCode run a turn inside the chat request for up to 60 seconds before the queue takes over. A command still running at that handover is stopped, not rerun, so a long install or build early in a turn can be cut off. The docs list this as a current Vercel Queues limit. A virtual workspace holds about 500 files, with no network and no real binaries such as node or python. The docs also call the Postgres World a reference implementation that does not authenticate its routes or encrypt its data.
The license is Apache-2.0, and the main language is TypeScript. The repository was created on October 16, 2026. On October 21 it had 90 stars and six open issues or pull requests, and its last push was on October 19. If you want one interface for several coding agents, see Paseo. durable-harness covers how a single session recovers after a crash.
We read the README, the license, the repository metadata, the npm package information and Vercel’s docs. We did not install or run it. The README has no benchmarks, screenshots, sample output or pricing, so this entry has none either.