All guides
By Kartik Sarangmath

How Vercel's durable-harness Works

How it keeps agents running through crashes, and which Claude Code and Codex features you lose

How Vercel's durable-harness Works cover

On October 19, Vercel released durable-harness, an open-source package that keeps coding agents like Claude Code, Codex, OpenCode, and Pi running when the server under them crashes or times out. Vercel's announcement calls these agents harnesses: the program that runs an agent's loop of model calls and tool calls. Run normally, they lose their work when their process dies.

durable-harness can only restore what it saved. Features that keep their progress anywhere else are disabled, including Claude Code's subagents, skills, and plan mode. The package is still experimental.

The Short Version

If you wantUse
Pi on Verceldurable-harness with Pi Durable
Claude Code or Codex running for your app's users on Verceldurable-harness, without subagents, skills, or project settings
Pi Durable on a single server of your ownPi Durable on its own
A ready-made agent platform with approvals that wait and subagentsOmnara

How It Works

When you send an agent a message, it works through a turn: it calls the model, runs the tools the model asks for, and repeats until it has an answer. Most harnesses keep that turn in the memory of the process running it, so if the process dies halfway through, the turn is lost.

durable-harness writes each step of a turn to a log. Before a model call or tool call runs, it records that the call is starting, and when the call finishes, it records the result. If the server running the turn dies, a queue hands the turn to a new server, which reads the log and carries on. Steps whose results reached the log are read back instead of run again, so you don't pay twice for an answer you already got. A call that finished just before the crash, before its result was saved, counts as interrupted. Only one server can write to a session at a time.

The log lives in Vercel's storage on Vercel, or in Postgres on your own servers. Vercel calls the Postgres version a reference implementation that "doesn't authenticate its routes or encrypt its data."

Features You Lose

Vercel's own harnesses, eve and fx, and Earendil's Pi Durable save their own progress as they go, so durable-harness only gives them somewhere to keep it. Claude Code, Codex, OpenCode, and plain Pi were built for one person's machine and keep their progress in memory and local files. durable-harness can only save the model calls and tool calls that pass through it, so it disables every feature whose progress lives somewhere else.

Claude Code runs in its own Vercel Sandbox per session, with its shell, file tools, and web fetch available. Every other tool is disabled. The todo list, background commands, worktrees, and scheduled tasks keep their state in the Claude Code process or its config directory, outside the transcript durable-harness saves. Plan mode and questions to the user wait for a person who isn't there. Subagents are off because resuming one on another machine hasn't been proven to work. Claude Code also loads no CLAUDE.md, settings, or skills, and runs without permission prompts.

Codex also runs in its own Sandbox, with its shell and patch tools. Image generation, web search, sub-agents, plugins, and hooks are disabled. durable-harness answers Codex's approval prompts itself: it approves ordinary commands and declines requests for more access, such as network access.

OpenCode runs inside your function with its shell and file tools. Web fetch, web search, skills, questions, and sub-agents are disabled, since a sub-agent's state lives outside the event log durable-harness saves. OpenCode also ignores the project's AGENTS.md.

No harness can run a command past the life of the server that started it, so background commands are refused. On Vercel, a command still running about a minute into a turn is cut off and marked interrupted, so an npm install or a build that starts 30 seconds in never finishes. Vercel says a fix is coming. Until then, running the whole turn through the queue avoids the cutoff and delays the first reply.

Claude Code and Codex reach models only through Vercel's AI Gateway, and durable-harness forwards only the request fields on its allowlist. Each harness is pinned to one version. Three days before launch, a Claude Code update began sending a new field, and every Claude Code turn failed on the model in Vercel's docs until the allowlist was updated. New Claude Code and Codex releases reach you only when durable-harness ships them.

The sandbox per session is a safety requirement: Vercel's security docs note that Claude Code and Codex keep their state on disk. Vercel's CEO, Guillermo Rauch, described both as "not (currently) designed for embedding, which makes them less efficient, less portable, and brings an extra sandbox requirement compared to Pi or Fx."

What Happens When a Server Dies

For Claude Code, Codex, and OpenCode, durable-harness rebuilds the session from the log, restarts the harness, and adds a note telling the model its last turn was interrupted. The reply in progress starts over, so you pay for it again, plus about one more model request for the note. No tool runs again on its own: the model is told which calls may have happened and decides what to do. Pi is the exception and reruns interrupted tools you've marked as safe to repeat. OpenCode also replays the session's whole history on every restart, so recovery slows as a session grows.

On Vercel, the queue detects a dead server and redelivers the turn. On your own servers with Postgres, each server only checks turns started on its own machine, so a turn on a server that dies waits for that machine to come back. No other server picks it up.

In both setups, a tool that sends or changes something, like an email or a refund, needs its own way to check whether it already ran.

Pi Durable on durable-harness

Pi Durable saves and recovers its own progress, so durable-harness disables nothing. On Vercel it lacks three things: storage that outlasts a Vercel Function, something to restart it after a crash, and a guarantee that only one server works on each session. durable-harness supplies all three, and Vercel recommends it over its plain Pi adapter because Pi Durable keeps its extensions and compaction.

Pi Durable saves often, including the answer in progress several times a second. On durable-harness, each save is a network write the turn waits on, so turns run slower. Off Vercel, if one server is enough, Pi Durable with a SQLite file keeps every save local. Our Pi Durable guide covers the options.

Harnesses Built to Survive Crashes

Adding crash recovery to a harness that wasn't built for it runs into the same limits outside Vercel. When Temporal's team ran Pi on Temporal, they couldn't tell from Temporal alone whether a tool had started before a crash, and ended up adding records inside a fork of Pi. "Everything here was a retrofit," they wrote. Our Temporal guide covers that path.

A harness designed to save its own progress doesn't need features turned off to survive a crash, because it already records what it needs to continue. It still needs something to store that record and restart it, which is what durable-harness does for Pi Durable. Omnara, the open-source agent platform we build, is both: a harness that saves every step and the service that runs it, with an API. Each finished step is saved to Postgres as it happens. Each agent is claimed by one worker at a time, and if that worker dies, another continues from the last saved step.

Omnara has its own versions of the Claude Code features durable-harness turns off, and they survive a crash: approvals that wait for someone to answer, and subagents with their own logs. Custom tools can wait on your system for as long as it takes, commands run on your machines rather than in the worker, and streams resume after a reconnect. We wrote more about the design in The Log Is the Agent.

Omnara also restarts a cut-off model call, has no option to rerun a tool marked safe, and runs its own agent loop, so it isn't a way to run Claude Code or Codex.

Which One to Pick

  • On Vercel with Pi: durable-harness with Pi Durable.
  • Need Claude Code or Codex on Vercel: durable-harness, if you can live without subagents, skills, and project settings. Test it first.
  • Pi Durable on one server: no durable-harness needed.
  • A ready-made agent platform, with approvals, subagents, schedules, and roles, hosted or in your own cloud: Omnara.

For how harnesses, frameworks, and platforms fit together, see Four Ways to Build an AI Agent.

FAQ

What is Vercel's durable-harness?

An open-source package from Vercel that runs coding agents like Claude Code, Codex, OpenCode, and Pi so their work survives a crash or timeout. It saves each model call and tool call to a log and resumes the turn on a new server when the old one dies.

Does it work with Claude Code and Codex?

Yes, experimentally. Each session runs in its own Vercel Sandbox, with models through AI Gateway. Their shell and file tools work, but subagents, skills, plugins, project settings, and permission prompts are disabled.

Does durable-harness help Pi Durable?

It gives it a place to run on Vercel. Pi Durable already recovers its own steps, and durable-harness gives it storage that outlasts a function, something to restart it, and a guarantee that only one server works on each session, at the cost of slower turns.

What are the alternatives to durable-harness?

If you need Claude Code or Codex running on Vercel, durable-harness is built for that, with the limits above. For Pi on a single server of your own, run Pi Durable on its own with a SQLite file. If you're writing your own agent loop, a durable execution engine like Temporal or Vercel's Workflow SDK saves each step for you. If you'd rather use a ready-made agent platform with approvals, subagents, and users built in, Omnara is open source, and its agents save each step as they go, hosted or on your own servers.

What does it cost?

The package is free. On Vercel you pay for workflow events and their stored data, functions, queues, and model tokens, plus a Sandbox for each Claude Code or Codex session. A lightly loaded ten-minute Claude Code turn is roughly a few cents in infrastructure before tokens, and more CPU, memory, or idle time raises that.