Skip to content

About

Durable coding-agent harnesses (Claude Code, Codex, OpenCode, Pi, fx) on a Workflow SDK World

Topics

Resources

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

durable-harness

Vercel logo npm version License

durable-harness runs coding-agent harnesses (Pi, OpenCode, libfx's fx, Claude Code and Codex) as durable agents on a Workflow SDK World. Each session is a workflow run: its conversation, the turn in flight and every model and tool call are in the run's event log, so a crash anywhere resumes the turn from the log on another machine, and a tool call that isn't safe to repeat is never run twice.

Note

durable-harness is experimental: it's on 0.0.x, and its API may change between releases.

Quick start

Install it with a harness, here Pi with pi-durable, in a Next.js app:

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

Open Pi's own durable Harness on a World-backed storage. Agents are tool-less by default; Pi's coding tools go on a virtual workspace, whose files live in the session's log:

// lib/agent.ts
import { BACKGROUND_CONTEXT as ctx } from '@earendil-works/chord/context';
import { createRegistry, Harness, type Storage } from '@earendil-works/pi-durable';
import { CodingTools, GATEWAY_PROVIDER, gatewayModels, resumeWith, virtualEnv } from 'durable-harness/pi-durable';

const models = gatewayModels();
const registry = createRegistry();
registry.install(CodingTools);

export const agent = { model: { provider: GATEWAY_PROVIDER, modelId: 'anthropic/claude-sonnet-4.5' } };
export const open = resumeWith((storage: Storage) => Harness.open(storage, { models, registry, env: virtualEnv() }, ctx));

Serve it from a chat route, and configure the integration:

// app/api/chat/route.ts
import { chatRoute } from 'durable-harness/pi-durable';
import { agent, open } from '@/lib/agent';

export const { GET, POST } = chatRoute({ open, agent, authorize: async (request) => { /* your auth */ } });
// next.config.ts
import type { NextConfig } from 'next';
import { withDurableHarness } from 'durable-harness/next';

const nextConfig: NextConfig = {
  // your existing config
};

export default withDurableHarness(nextConfig);

Choose your harness and framework in the agent harnesses docs.

Harnesses

  • Pi: durable-harness/pi-durable (recommended: Pi's own durable Harness on a World), or durable-harness/pi.
  • OpenCode: durable-harness/opencode.
  • fx: durable-harness/fx, libfx's kernel tools for its own durable agents.
  • Claude Code and Codex: durable-harness/claude-code and durable-harness/codex. They run only in the session's own Vercel Sandbox, never in a shared Function (why).

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. See tools and security.

Run anywhere

Local development uses the Workflow SDK's local World with no configuration. Deploy to Vercel for managed storage, queuing and scaling, with sessions in Agent Runs. To self-host, use the Postgres World or any other World: see self-hosting.

Contributing

Contributions are welcome. Use issues to collaborate with the team, and read CONTRIBUTING.md before opening a pull request.

Security

If you find a security vulnerability in durable-harness, disclose it responsibly instead of opening a public issue.

To participate in our Open Source Software Bug Bounty program, please email responsible.disclosure@vercel.com. We will add you to the program and provide further instructions for submitting your report.

About

Durable coding-agent harnesses (Claude Code, Codex, OpenCode, Pi, fx) on a Workflow SDK World

Topics

Resources

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages