█

AI/TLDR

Buy me a coffee
Buy me a coffee

HarnessRouter

One self-hosted API that runs Codex, Claude Code, Hermes and other agent harnesses as product backends

Coding-Agent Harnesses & RuntimesOpen core
Language
Python
License
Apache-2.0
$docker run -d --name harnessrouter \
IN SHORT

What is HarnessRouter?

HarnessRouter is an infrastructure layer that turns existing agent harnesses such as Codex and Claude Code into plug-and-play backends for your own product. Instead of integrating each harness separately and rebuilding sessions, streaming, file handling, cancellation and failure handling for every one, your product makes one integration and picks the harness per request. It sits in the Coding-Agent Harnesses & Runtimes category of the AI Coding tools and is open-source, written in Python and licensed Apache-2.0.

Overview

HarnessRouter is an infrastructure layer that turns existing agent harnesses such as Codex and Claude Code into plug-and-play backends for your own product. Instead of integrating each harness separately and rebuilding sessions, streaming, file handling, cancellation and failure handling for every one, your product makes one integration and picks the harness per request. The Community Edition in this repository is the self-hosted, Apache-2.0 edition: you run it on your own infrastructure with your own model-provider keys, and no HarnessRouter account is needed.

Animated diagram comparing separate integrations with four harnesses against a single HarnessRouter integration
Without HarnessRouter, each harness multiplies the infrastructure work; with it, the product keeps one integrationHarnessRouter README ↗

It ships as a single Docker container holding three services. The Console (the only published port, 3000) is the web UI and the API entry point; the Gateway serves the OpenAI Responses-compatible API and the harness lifecycle; and the Runner executes harnesses in per-session workspaces with separate operating-system users. A /data volume keeps the database, files, secrets, installed harness CLIs and workspaces between restarts. On first launch it installs the enabled harness CLIs; its setup guide lists backends including Claude Code, Codex, Hermes, Pi, DeepSeek Harness, OpenCode, Qwen Code, Gemini CLI, Cline, Oh My Pi, goose and Kimi Code CLI.

The API follows the Unified Harness Protocol (UHP), an open, versioned standard whose task surface is deliberately compatible with the OpenAI Responses API, so existing Responses SDKs and streaming parsers can talk to it. You select a harness with metadata.harness_id, continue a session with previous_response_id, stream progress as server-sent events, attach input files and retrieve outputs. The repository also contains the UHP specification, its OpenAPI and JSON Schemas, and a conformance suite. A managed HarnessRouter Cloud offers the same API contract with serverless sandboxes, and custom harnesses built locally can be uploaded to it.

What it does

  • One OpenAI Responses-compatible API for many agent harnesses, chosen per request with metadata.harness_id
  • Persistent sessions, streaming progress, input files and generated artifacts, cancellation, structured errors and execution traces
  • Web Console to connect model providers (bring your own key), run tasks, and create custom harnesses with instructions, MCP tools and skills
  • Self-hosted single Docker container: Console, Gateway and Runner, with separate session workspaces and native filesystem, shell and Git
  • Per-request environment variables resolved from request headers or stored secrets, redacted from responses, streams and traces
  • Reference implementation of the Unified Harness Protocol, with schemas and a conformance suite

Getting started

The Community Edition runs from one Docker image. You need Docker, about 4 GB of disk and an API key from a model provider; no HarnessRouter account is required.

Start the container

The named volume preserves the database, files, installed harness CLIs and workspaces between restarts. Do not add --user: the entrypoint and Runner need root to manage per-session users.

bashbash
docker run -d --name harnessrouter \
  -p 127.0.0.1:3000:3000 \
  -v harnessrouter:/data \
  harnessrouter/harnessrouter

Wait for the first launch

The first launch installs the enabled harness CLIs. Continue when the logs show "[harnessrouter] ready on :3000", then press Ctrl+C to stop following them.

bashbash
docker logs -f harnessrouter

Open the Console

Go to http://localhost:3000 and sign in with username harnessrouter and password harnessrouter. Change the default password in Profile, and keep the instance local until you do.

The Add Integration dialog in the HarnessRouter Console, choosing a model provider and entering its API key
Connecting a model provider with your own keyHarnessRouter README ↗

Connect a model provider

Open Bring Your Own Key in the sidebar, press Add Integration, choose a provider, name the integration and add its API key. Its supported models become available in the Console.

Run your first task

Open Agent harnesses, choose a harness and select New task. Pick a model, give the agent a concrete task, and follow its progress and output files in the same session.

The HarnessRouter Console running a Hermes task that reviews a fictional NDA and opens the redlined output files
A Hermes task in the Console, from prompt to the files it producedHarnessRouter README ↗

Call it from your backend

Create a key under API Keys in the Console, store it as HARNESSROUTER_API_KEY in your backend (never in browser code), and call the Responses-compatible endpoint with a harness id. Set "stream": true for server-sent events. The full API is described at $HARNESSROUTER_BASE_URL/v1/openapi.json.

bashbash
export HARNESSROUTER_BASE_URL=http://localhost:3000/api/harness

curl --fail-with-body -sS "$HARNESSROUTER_BASE_URL/v1/responses" \
  -H "Authorization: Bearer ${HARNESSROUTER_API_KEY:?}" \
  -H 'content-type: application/json' \
  -d '{
    "input":"Reply with exactly: it works.",
    "metadata":{"harness_id":"codex"},
    "model":"gpt-5.4-mini",
    "stream":false
  }'

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Reach for it when your product needs agentic features and you want Codex, Claude Code or another harness as the backend without writing session, streaming and file plumbing for each
  • Reach for it to compare or switch harnesses and models for a task behind one API, trading off cost and latency
  • Reach for it when provider keys, sessions and workspaces must stay on infrastructure you control
  • Reach for it to build a reusable custom harness with your own instructions, MCP tools and skills, test it in the Console, then call it by id

How HarnessRouter compares

HarnessRouter alongside other open-source coding-agent harnesses & runtimes tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
CC Switch★ 158kA cross-platform desktop app that manages provider configuration for eight coding-agent CLIs from one place, with a local failover proxy, MCP and skill management, and spend tracking.
Oh My OpenAgent★ 71.2kOpinionated agent bundle for OpenCode and Codex CLI that ships preconfigured sub-agents, lifecycle hooks and built-in MCP servers behind a single ultrawork command.
herdr★ 53.7kA single-binary terminal multiplexer built for coding agents: persistent sessions across local and SSH machines, per-pane working/blocked/idle status, and a socket API agents drive themselves.
oh-my-claudecode★ 41.1kA plugin and CLI that adds multi-agent orchestration to Claude Code: staged autopilot workflows, parallel tmux workers, and advisors that route a second opinion to Codex, Gemini, Grok or Cursor.
DSH Go★ 35.2kA native Android client for DeepSeek Harness that runs the agent on the phone in a built-in Linux environment or drives DSH on your computer or server over SSH, with plugins and phone control.
AionUi★ 34.6kAn open-source desktop workspace that pairs a built-in agent engine with dozens of external CLI agents, adding scheduled runs, MCP tools and remote access from a WebUI or chat apps.
cc-connect★ 16.5kA Go daemon that bridges local coding agents — Claude Code, Codex, Cursor Agent, Gemini CLI, OpenCode, Kimi CLI and more — to Feishu, DingTalk, Slack, Telegram, Discord, LINE and WeCom, so you drive them from chat.
HarnessRouter★ 4.6kOne self-hosted API that runs Codex, Claude Code, Hermes and other agent harnesses as product backends