Jorge Turbica / blog · Blog ← All articles ES · Leer en español
AI

Repo of the day: durable-harness, coding agents that survive a crash without paying twice

Vercel Labs logs every Claude Code, Codex or OpenCode call and resumes the turn on another machine without paying twice. Experimental, Apache-2.0.

If the machine driving your coding agent dies mid-turn, that turn's work is gone. durable-harness, from Vercel Labs, writes every model and tool call to a log before and after it runs, and resumes the turn on another machine without paying again for what already finished. The repository, created on October 16, 2026, has 299 stars and saw commits on November 9.

What it is and how it works

durable-harness wraps existing coding-agent harnesses (Claude Code, Codex, OpenCode, Pi and libfx's fx) and runs them on a Vercel Workflow SDK World. Each session is a workflow run: the conversation, the turn in flight and every model and tool call land in that run's event log.

The mechanism, as described in the October 19, 2026 launch post:

  • An intent is recorded before each call, and the outcome after it finishes.
  • Each turn is backed by a queue message. If the function dies, the queue hands the turn to a new one, which reads the log and carries on.
  • Completed calls are read from the log instead of being re-run, so a model response that was already generated isn't billed twice.
  • Interrupted tools marked replay: 'safe' run again. Those marked replay: 'never' don't: the model is told the call may have happened so it can check first.
  • For harnesses that keep their own state on disk (Claude Code's transcript, Codex's rollout, OpenCode's event store), those records are mirrored into the log.

It is written in TypeScript, licensed Apache-2.0 and published on npm; the latest version is 0.0.2.

How to use it

The README starts with Pi and its durable harness inside a Next.js app:

bash
npm install durable-harness @earendil-works/pi-durable @earendil-works/chord @earendil-works/pi-ai just-bash

You then expose a chat route with chatRoute({ open, agent, authorize }) and wrap your Next config with withDurableHarness(nextConfig), which discovers the modules that export agents. Locally it uses the Workflow SDK's local World with zero configuration. On Vercel, storage, queuing and scaling are managed, and every session shows up in Agent Runs. Off Vercel you can use Postgres, MongoDB, Redis or Turso; for Postgres it takes two variables, WORKFLOW_TARGET_WORLD and WORKFLOW_POSTGRES_URL.

Two security details matter in a real deployment. Agents start with no tools, and the commands and files the model picks run in a virtual workspace (just-bash on a virtual filesystem) or in a per-session Vercel Sandbox, never on the machine driving the session. And in production, a chat route without authorize refuses every request with a 401: whoever can reach the route runs your agent on your credits.

What I like and what I don't

I like that it goes after the right problem. A coding agent working for hours in the cloud fails for boring reasons (a timeout, a redeploy, a recycled node), and that means re-running the whole turn and paying for the tokens again. The intent-and-outcome log, with its split between replayable and non-replayable tools, is the classic durable-workflow pattern applied to agents. And the security docs are unusually candid: a Sandbox allows all outbound traffic by default (you need network: 'deny-all' or an allowlist), and Codex can end up running commands with full access inside its Sandbox when it can't start its own.

What I don't: the README itself warns that it is experimental, on 0.0.x, with an API that may change between releases. There are 24 open issues. And portability has a hard edge: Claude Code and Codex only run in a Vercel Sandbox, and durable-harness refuses to launch them anywhere else, your own servers included. The reason is sound (they are single-user CLIs that keep state on disk), but it means self-hosting on Postgres only covers Pi, OpenCode and fx. If you want a durable Claude Code, the compute is Vercel's.

durable-harness vs an agent on a cloud VM

There is no established open-source equivalent; the usual move so far has been to take the agent off the laptop and onto a cloud VM. Vercel's post explains why that isn't enough: the VM doesn't know which model and tool calls finished, and it can't resume an interrupted turn.

durable-harnessAgent CLI on a VM
After a crashResumes the turn from the log on another machineTurn lost, re-run from scratch
Model calls already madeRead from the log, not billed twicePaid for again
Side effectsreplay: 'never' prevents repeatsNo protection
IsolationVirtual workspace or per-session SandboxWhatever the VM gives you, shared
DeploymentVercel or your own World (Postgres, MongoDB, Redis, Turso)Any VM
MaturityExperimental, 0.0.xThat of the CLI itself

When to use which. If you are building a product where coding agents work for many users at once, with long turns and tools that touch real systems (a PR, a refund, an email), durable-harness handles the part nobody wants to write. If you just need an agent to keep working while your laptop is closed, a VM is still simpler and doesn't tie you to a 0.0.x API.

Sources

Jorge Turbica

Software Engineer and SRE. I write about the real challenges I run into in production.

See portfolio ↗