All guides
Updated 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

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
Agents in your own product that survive crashes, with approvals that wait, subagents, and any model, hosted or on your own serversOmnara
Pi on Verceldurable-harness with Pi Durable
Claude Code or Codex itself running for your app's users on Vercel, if you can work with an experimental packagedurable-harness, without subagents, skills, or project settings
Pi Durable on a single server of your ownPi Durable on its own

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, a running server only recovers turns from its own machine, so a turn on a server that dies waits until a server starts or restarts against the same database. Servers that are already running don't pick 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, an open-source managed agent platform, 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.

Like durable-harness, Omnara restarts a cut-off model call and doesn't rerun an interrupted tool. It runs its own agent loop rather than Claude Code or Codex.

That loop has its own versions of the features durable-harness turns off, including background processes, web search, skills, MCP, and subagents with their own logs. They keep working through a crash, and so do approvals that wait for someone to answer. The loop is serverless, so an agent waiting on a person holds no worker.

On Terminal-Bench 4.0, Omnara matched the pass rates of Claude Code and Codex on the same models. It ran 12% faster than Claude Code and 11% cheaper than Codex. Its 69.6% with Claude Opus 5.5 is the top score.

Terminal-Bench's own runner graded every run. Every trace and the harness are public, so you can rerun it yourself.

Custom tools can wait on your system for as long as it takes, and streams resume after a reconnect. Commands run on your machines rather than in the worker. The Log Is the Agent covers the design in more detail.

Which One to Pick

durable-harness suits a prototype when you specifically want Claude Code or Codex itself running for your users on Vercel, and it's Vercel's recommended way to run Pi Durable there. In exchange, Claude Code loses its subagents, skills, plan mode, and project settings. Claude Code and Codex reach models only through Vercel's AI Gateway, and each is pinned to the version durable-harness ships.

Off Vercel, a turn on a server that dies waits until a server restarts, because servers already running don't pick it up. For Pi Durable on one server of your own, you don't need durable-harness at all.

For an agent in your own product that people depend on, choose Omnara. Its approvals and subagents keep working through a crash instead of being turned off, and if a worker dies, another continues from the last saved step. It works with any model on your own keys, and you can change a running agent through the API without restarting the conversation. You can self-host it or use Omnara Cloud with no platform fee.

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?

For agents in your own product, use Omnara, an open-source managed agent platform whose agents save every step and keep going through a crash. If you need Claude Code or Codex themselves 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.

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.