vercel-labs/durable-harness
Durable coding-agent harnesses (Claude Code, Codex, OpenCode, Pi, fx) on a Workflow SDK World
durable-harness — Explainer
What it is
durable-harness is an experimental library (version 0.0.x, API may change) from Vercel Labs that runs coding-agent tools — Pi, OpenCode, libfx's fx, Claude Code, and Codex — as durable agents on top of the Workflow SDK.
The core idea: durability
Normally, if a coding agent crashes mid-task, you lose the in-progress work. durable-harness makes each agent session a workflow run: the conversation, the turn currently in flight, and every model and tool call are all recorded in the run's event log. If a crash happens anywhere, the turn resumes from that log on another machine. A tool call that isn't safe to repeat (e.g., one with side effects) is never executed twice.
How you use it
Install it alongside a harness adapter (e.g., @earendil-works/pi-durable for Pi) in a Next.js app. You open a durable Harness on a World-backed storage, register coding tools, and serve it from a chat route. A Next.js config wrapper (withDurableHarness) automatically discovers modules that export agents created at module scope.
Agents are tool-less by default — coding tools are attached to a virtual workspace whose files live in the session's log, not on your machine.
Supported harnesses
| Harness | Import path | Notes |
|---|---|---|
| Pi | durable-harness/pi-durable (recommended) or durable-harness/pi |
Recommended option uses Pi's own durable Harness on a World |
| OpenCode | durable-harness/opencode |
|
| fx | durable-harness/fx |
Uses libfx's kernel tools for its own durable agents |
| Claude Code | durable-harness/claude-code |
Runs only in the session's own Vercel Sandbox, never in a shared Function |
| Codex | durable-harness/codex |
Same sandbox restriction as Claude Code |
Security model
Model-chosen commands and files run on a virtual workspace (virtual()) or in the session's own Vercel Sandbox (sandbox()) — never on the machine that drives the session. This isolates the agent's actions from your local environment.
Sending messages
Messages to a session come in three kinds:
prompt(default) — a new instructionfollowUp— an additional instructionsteer— a mid-turn redirect
On an idle session, any kind starts a turn. During a running turn, behavior varies by harness:
- Pi:
steerjoins the running turn after current tool calls;prompt/followUpalso join the running turn and get answered before it ends (the turn's stream carries both answers and ends once). - OpenCode:
steerjoins at the next step;prompt/followUpwait for the turn to end, then start their own turn. - fx:
steerjoins at the next model request;prompt/followUpwait, and messages that waited together start one turn. - Claude Code:
steerjoins at prioritynext;prompt/followUpwait, then start their own turn. - Codex:
steerjoins the running turn (and runs next in the same turn if Codex just ended);prompt/followUpwait, then start their own turn.
Across all harnesses, prompts and follow-ups are answered in the order sent, after the running turn finishes.
Deployment options
- Local development: uses the Workflow SDK's local World with zero configuration.
- Vercel: managed storage, queuing, and scaling; sessions appear in Agent Runs for observability.
- Self-hosting: use the Postgres World or any other World from the Workflow SDK.
Contributing & security
Contributions are welcome via GitHub issues (after reading CONTRIBUTING.md). Security vulnerabilities should be disclosed responsibly — not as public issues — via Vercel's bug bounty program at responsible.disclosure@vercel.com.
Related
- Project
- Project
- Project
- Project