OpenHarness is an open-source project from the HKUDS group at the University of Hong Kong. Its core mission is to recreate Claude Code’s Agent Harness architecture in pure Python.
What is an Agent Harness?
The model is the agent. The code is the harness.
The model provides intelligence; the harness provides the “hands, eyes, memory, and safety boundaries.” It is, in essence, all the infrastructure needed to turn an LLM into a usable agent.
Architectural overview
The core loop is refreshingly simple: Query → LLM streaming response → detect tool_use → permission check → hook → execute → return result → continue the loop, until the model decides to stop.
This architecture decomposes an agent’s capabilities into four layers — a capability layer providing tools and skills, a safety layer controlling permissions and lifecycle, a collaboration layer handling external integrations and multi-agent coordination, and an infrastructure layer responsible for configuration and UI.
Lines-of-code comparison
These numbers are striking. OpenHarness uses only 11,733 lines of Python (Claude Code has 512,664 lines of TypeScript) and still covers 43 out of 44 tools. That’s enormously valuable for anyone trying to understand “how an AI agent actually runs under the hood” — it strips away the enterprise telemetry, OAuth, hundreds of React components, and other overhead, leaving only the harness skeleton.
Ten major subsystems, explained
Why it’s worth your attention
- High learning value: if you want to understand Claude Code’s internal architecture, reading OpenHarness’s 11K lines of Python is far more efficient than reading 500K lines of TypeScript.
- Architectural clarity: it clearly shows which subsystems an Agent Harness needs and how they collaborate.
- Extensible: MIT License, Python ≥3.11 — a solid starting point for building your own agent systems.
The core takeaway: the model is the agent, the code is the harness. The LLM itself already has reasoning ability; the harness’s job is to plug it into tools, memory, permissions, and collaboration — so it can actually do things.
Comments
0 comments