Skip to main content
OpenHarness is an open-source framework for building general-purpose AI agents programmatically. Built on Vercel’s AI SDK, it provides the building blocks inspired by Claude Code, Codex, and similar advanced agent harnesses — but in a lightweight, composable form you can use in your own applications.

Why OpenHarness?

Agent harnesses like Claude Code, Codex, and OpenCode are powerful general-purpose agents. While their creators offer SDKs (Claude Agent SDK, Codex App Server, etc.), these are heavy to use programmatically. OpenHarness gives you the same building blocks — multi-step tool loops, subagent delegation, context compaction, streaming UI integration — as composable primitives you control entirely in code.

Key Features

Stateless Agents

Agents are pure executors: pass in history, get back events. Full control over conversation state.

Composable Middleware

Add compaction, retry, persistence, and hooks as independent, composable layers.

Subagent Delegation

Agents can spawn child agents for subtasks, with configurable nesting depth and background execution.

Provider Abstraction

Filesystem and shell access through swappable providers — run locally, in sandboxes, or in the cloud.

MCP Integration

Connect to Model Context Protocol servers for external tools via stdio, HTTP, or SSE transports.

AI SDK 5 UI Streaming

Stream agent sessions directly to React or Vue chat UIs with typed data parts.

Quick Example

import { Agent, createFsTools, createBashTool, NodeFsProvider, NodeShellProvider } from "@openharness/core";
import { openai } from "@ai-sdk/openai";

const agent = new Agent({
  name: "dev",
  model: openai("gpt-5.4"),
  tools: {
    ...createFsTools(new NodeFsProvider()),
    ...createBashTool(new NodeShellProvider()),
  },
  maxSteps: 20,
});

for await (const event of agent.run([], "Refactor the auth module")) {
  if (event.type === "text.delta") process.stdout.write(event.text);
}