AI Tools
●11 min read●December 1, 2026●Updated December 1, 2026

What Is an Agent Harness? Same Model, Two Harnesses, Tested

What is an agent harness? Same model, two harnesses: Claude Code's first request was about 11,100 tokens, DeepSeek Harness's about 6,100. Both passed 33 of 33.

Paras Tiwari
Paras TiwariFounder, Spectrum AI Labs
What Is an Agent Harness? Same Model, Two Harnesses, Tested

Get weekly AI tool reviews

We test tools so you don't have to. No spam.

TL;DR

An agent harness is the code around an AI model that runs its loop, gives it tools and decides what it sees. A 2026 arXiv paper puts it as "An agent is a model plus a harness". I ran one model, deepseek-flash, in two harnesses on the same tasks and read the logs. In task 1, Claude Code's first request was about 11,100 tokens with 12 tool entries. DeepSeek Harness's was about 6,100 tokens with 24 tools. Both passed all 33 hidden checks.

The runs come from my 12 run test, where I first compared the two tools on hidden checks and cost.

What is an agent harness?

An agent harness is the program that sits between you, the model and your computer. The model reads text and writes text. The tools, the loop, the permission rules, the sandbox, the logs and the cost count all belong to the harness. The arXiv paper "Harness Engineering: Anatomy, Architecture, and Evolution of Coding Agents" opens with "An agent is a model plus a harness" and describes the harness as "the runtime that couples an LLM to the world through a loop, tools, context management, safety controls" and more.

For the first task, both harnesses had to build a small CSV stats tool and write its tests.

  • Context. Each harness sent my task along with its own instructions and a list of tools the model could ask for. DeepSeek Harness listed 24 tools. Claude Code listed 12 entries.
  • Tools and the loop. deepseek-flash cannot create a file. In one Claude Code run it asked to write two files, csvstats.py and its test file. Claude Code wrote them, sent back a short "File created successfully" note for each and asked the model again. That went on until the model gave its final answer.
  • Permissions. I let both tools edit and run files without asking me. Both also have modes that ask first.
  • Sandbox. DeepSeek Harness ran the shell commands under Landlock, a Linux feature that fences what a command can touch. Claude Code has a sandbox too, but it is off by default.
  • Logs and cost. Both kept a record of every request. DeepSeek Harness showed a cost estimate that matched my math in the one run I checked. Claude Code's estimate was 42x to 48x too high on DeepSeek.
Diagram of an agent harness: you give the harness a task, the harness sends it with instructions and a tool list to the model, the model answers or asks for a tool call, the harness checks permission and runs the tool on your computer, then sends the result back. Harness parts shown: Context, Tools, Permissions, Sandbox, Session and memory, Cost tracking
My diagram of where a harness sits and the loop it runs. The example task and the model are from my test.

What my logs show: same model, two harnesses

With the same model and the same task text, the two harnesses sent a very different first request. Claude Code's was about 11,100 tokens. DeepSeek Harness's was about 6,100.

Both ran deepseek-flash at max effort, and each run started in a fresh folder. I used DeepSeek Harness 0.2.2-rc.5 and Claude Code 2.1.310, both headless. The harness records every request header, its tools and its token use in a session log. Claude Code records the request shape and the usage per request in a session transcript. The numbers below are my reading of those logs.

The first request each harness sent to deepseek-flash

DeepSeek HarnessClaude Code
Tokens in the first request, task 16,138 to 6,142. Run 1 all new, runs 2 and 3: 382 new + 5,760 cache hit11,070 to 11,074, all new, no cache hit in any run
Tokens in the first request, task 26,005 to 6,007, mostly cache hit (5,504 to 5,632)10,937 to 10,939, all new, no cache hit in any run
Tools offered to the model2412 entries: 11 named tools plus one placeholder entry
Size of the tool definitions (characters of JSON)about 20,800about 29,700
Size of the main system prompt (characters)about 3,200 (log record size)about 5,650, plus a separate environment section

Source: My own logs of the runs on November 30, 2026, deepseek-flash at max effort. The task text was the same for both tools

Bar chart of tokens in the first request for task 1 and task 2: DeepSeek Harness about 6,100 and 6,000, Claude Code about 11,100 and 10,900
My chart, drawn from my own run logs: tokens in the first request for each tool on task 1 and task 2.

The task text was identical, so by my reading the gap of about 5,000 tokens is mostly the harnesses' own text: instructions, tool descriptions and, in Claude Code, a separate environment section. A system prompt is the standing instruction text a harness sends with every request, and the tool descriptions tell the model what each tool does.

The tool lists also differ. The harness offered 24 tools. Claude Code's request listed 11 named tools and one placeholder entry. In my Claude Code runs on task 1 the model mostly used Bash and Write. So in Claude Code, most of the offered tools sat unused in these small jobs.

In my runs the bigger first request did not decide the cost. The job costs of the two tools overlapped, as the figures below show. DeepSeek charges much less for input it has already seen, called a cache hit: $0.003 per 1M tokens off-peak, against $0.15 for new input. Claude Code's first request had no cache hit in any run, but its later requests were mostly cache hits. On request 2 of task 1 run 2 it sent 237 new tokens and 11,776 cache hit tokens. The harness's first request had no cache hit in its very first run and was mostly cache hits after that, which I read as the same harness text having been sent before.

Every run in the 12 run test passed every hidden check, 33 of 33 per tool. Costs overlapped: $0.0054 to $0.0123 per job for the harness and $0.0057 to $0.0111 for Claude Code, by my math.

The parts of a harness

I split a harness into nine parts: the loop, tools, context, permissions, sandbox, session and memory, cost tracking, extensions and model choice. The table shows each part in the two harnesses I ran.

Harness parts, in the two harnesses I ran

PartWhat it doesDeepSeek HarnessClaude Code
LoopCalls the model, runs the tool it asks for, returns the result, repeatsModel call, tool call, result, repeat. The Trajectory tab lists every tool callThe same cycle
ToolsLets the model act on files and commands24 tools in the first request12 entries in the first request
ContextDecides what the model seesSystem prompt of about 3,200 characters and about 20,800 characters of tool definitionsSystem prompt of about 5,650 characters plus an environment section, and about 29,700 characters of tool definitions. A compaction window setting exists, which I did not test
PermissionsAsks before risky actionsRead Only, Workspace Write, Full accessdefault, acceptEdits, plan, auto, dontAsk, bypassPermissions
SandboxFences shell commandsShell commands ran under Landlock, which was partial on the kernel I usedA sandbox using bubblewrap on Linux, off by default, covering shell commands only
Session and memoryKeeps a record of the workSession logs with each request and its token useSession transcripts with the request shape and usage
Cost trackingCounts tokens and prices themA per answer estimate, about $0.0072 in one run I checked, which matched my mathPrices unknown models at list price, so the readout was 42x to 48x too high until I added a modelPricing row
ExtensionsAdds new abilitiesEverything is a plugin: built in Subagent, Web search and fetch, Agent loop and ShellSubagents, plugins, hooks and MCP
Model choicePicks which model it talks to42 built in providers plus custom APIsDeepSeek documents the setup. Anthropic's gateway page says it does not support non Claude models

Source: My own logs and runs on November 30, 2026, the DeepSeek Harness README and Anthropic's Claude Code docs. I did not test compaction or Claude Code's sandbox

In DeepSeek Harness you can watch the loop happen in the Trajectory tab.

DeepSeek Harness Trajectory tab for the ledger job, listing read, bash, write and edit tool calls with arguments, a landlock-run line, and the agent noting that hidden tests may expect certain money behavior
The Trajectory tab on my server during the ledger job, from my first test. I blurred the server folder paths.

For the cost row, my Claude Code setup post shows the readout problem and the fix. For the install side, see the DeepSeek Harness setup guide.

Agent harness vs agent loop vs framework vs runtime vs MCP

In my reading, the agent loop is one part of a harness, a framework is a toolkit you build an agent with, a runtime is a lower layer that can power a framework, and MCP is a standard for plugging tools and data into a harness. The terms are not settled. LangChain's Harrison Chase writes "the lines are blurry". In a Turing Post interview, OpenAI's Michael Bolin says the harness is "what we sometimes call the agent loop". The arXiv paper uses the wider definition from above.

Running coding agents on real work? Get a practical setup that wastes less of your limit.

Get the Claude Code setup

How the common terms are used

TermWhat it means in the sourceSource
Agent harnessThe runtime around the model: loop, tools, context management and safety controls. LangChain lists DeepAgents as a harness, with batteries includedarXiv paper; LangChain
Agent loopThe cycle where the model either answers or requests a tool call, repeating until it stops requesting tools. Bolin also uses harness for the loopOpenAI, Unrolling the Codex agent loop; Turing Post interview with Bolin
Agent frameworkExamples from LangChain: LangChain, Vercel's AI SDK, CrewAI, OpenAI Agents SDK, Google ADK, LlamaIndex. LangChain gives no single definition and says the lines are blurryLangChain
Agent runtimeLower level than a framework and able to power one. LangChain's example is LangGraph, which it says is probably best described as both a runtime and a frameworkLangChain
MCPAn open source standard for connecting AI applications to external systemsmodelcontextprotocol.io

Source: LangChain, OpenAI, the arXiv paper and the MCP docs, checked November 30, 2026. The terms are not settled and sources use them differently

An agent harness vs agent loop: the loop is one part inside the harness, unless you follow Bolin, who uses the two words for the same thing. An agent harness vs agent framework: in my reading, a framework is something you build with, and a harness is something that already runs, but LangChain itself says the lines are blurry. Of DeepAgents, LangChain writes that "it comes with batteries included". It also admits LangGraph is "probably best described as both a runtime and a framework". The arXiv paper's source code study of the eleven systems found "no agent runtime imports a general-purpose agentic framework".

MCP is not a harness. It is a standard way to plug tools and data into an AI application, and it does not run the loop. A harness can use MCP servers as one source of tools. My MCP explainer covers it in full.

Harness engineering

The arXiv abstract defines it: "Harness engineering, named as a discipline in early 2026, is the design and evolution of that runtime."

OpenAI's post "Harness engineering: leveraging Codex in an agent-first world" by Ryan Lopopolo came out on February 11, 2026. It does not define a harness. Martin Fowler's site has a memo by Birgitta Böckeler noting the article mentions the word only once in its text. The post's idea is that engineers work "to design environments, specify intent, and build feedback loops". Its numbers: a product built over five months with "0 lines of manually-written code", on the order of a million lines of code, and roughly 1,500 pull requests opened and merged.

Anthropic's engineering post "Effective harnesses for long-running agents" describes a case of changing only the harness. It calls the Claude Agent SDK "a powerful, general-purpose agent harness adept at coding". Without help, the agent tried "to one-shot the app", and a later session would "declare the job done" too early. Anthropic's fix was in the harness, not the model. A first session with a special prompt sets up the environment, a claude-progress.txt file "that keeps a log of what agents have done" carries the state, and later sessions work on "only one feature at a time".

Agent harness examples

Claude Code, Codex CLI, DeepSeek Harness and Pi are four coding harnesses. Two more are the Claude Agent SDK and LangChain's DeepAgents, which the Anthropic and LangChain posts call harnesses.

Agent harness examples

NameWho makes itLicense or statusSource
Claude CodeAnthropicNot open source. The repo says all rights reservedgithub.com/anthropics/claude-code
Codex CLIOpenAIApache 2.0. Described as a coding agent that runs locally on your computergithub.com/openai/codex
DeepSeek Harness (dsh)DeepSeek AIMIT. Described as an open source agent harnessgithub.com/deepseek-ai/deepseek-harness
PiThe earendil-works GitHub organizationMIT. Described as a minimal, extensible agent harnessgithub.com/earendil-works/pi
Claude Agent SDKAnthropicRenamed from the Claude Code SDK in 2025. Anthropic calls it the harness that powers Claude CodeAnthropic blog, September 29, 2025
DeepAgentsLangChainListed by LangChain as a harnessLangChain blog, October 25, 2025

Source: Each project's own page, the Anthropic and LangChain posts and the arXiv paper, checked November 30, 2026

The arXiv paper's list of eleven systems also has Gemini CLI, Mistral Vibe, OpenHands, Aider, Mini-SWE-Agent, Hermes, OpenCode and OpenClaw. I make no claims about those. The same paper's abstract ends by mentioning "a 90-line minimum-viable-harness scaffold".

Which harness should you use?

Both of mine passed all 33 checks, so the checks did not help me choose. What I actually ran into was the sandbox and the cost readout, and Claude Code's readout was 42x off until I fixed it.

For DeepSeek jobs on my own server I use DeepSeek Harness, and its cost estimate matched my math in the one run I checked. If you run Claude Code on DeepSeek, the pricing row in my setup post fixes its cost readout. Anthropic does not support that setup.

Read the series

The other posts in this series, plus my MCP explainer:

What I did not test

My numbers come from two small tasks, one model and one machine. This is not a benchmark and not a ranking.

  • Other models. Both harnesses ran deepseek-flash.
  • Gemini CLI, OpenHands, Aider and the other systems in the arXiv list.
  • Codex CLI, Pi, the Claude Agent SDK and DeepAgents. I list them from their own pages and I did not run them.
  • Compaction, which is how a harness shrinks a long history, on either tool.
  • Whether the roughly 5,000 extra tokens in Claude Code's first request change how the model behaves. I only measured the size.
  • The small separate request that DeepSeek Harness sends to name a session. I only saw it in the harness log, and I make no claim about whether Claude Code does the same.

Sources

All pages were checked on November 30, 2026. The test runs are mine, and every figure marked as my math is token counts priced at DeepSeek's list prices, not a bill.

FAQ

What is an agent harness in simple words?

It is the program around an AI model that lets the model act. It sends the model your task and a tool list, runs the tools the model asks for and returns the results.

What is the difference between an agent harness and an agent framework?

In my reading, a framework is a toolkit you use to build your own agent, and a harness is a runtime that already comes with the loop, tools and safety controls. LangChain's own post admits the lines are blurry, so people use the words in different ways.

What is the difference between an agent harness and an agent loop?

The loop is one part of the harness: call the model, run the tool it asks for, give back the result, repeat. OpenAI's Michael Bolin says the harness is what they sometimes call the agent loop. The arXiv paper uses a wider meaning that also covers tools, context and safety controls.

Is MCP an agent harness?

No. MCP is an open source standard for connecting AI applications to external systems. It is a way to plug tools and data into a harness, and it does not run the loop itself.

What is harness engineering?

The arXiv paper calls it the design and evolution of the runtime around the model, a discipline named in early 2026. OpenAI used the term in a February 2026 post about building with Codex. Anthropic described harness changes, not model changes, as its fix for long coding jobs.

Which agent harnesses are open source?

DeepSeek Harness and Pi are MIT licensed, and OpenAI's Codex CLI is Apache 2.0. Claude Code is not open source, and its repo says all rights reserved.

Paras Tiwari
Written by
Paras Tiwari
Founder, Spectrum AI Labs

Founder of Spectrum AI Labs, testing AI tools and models, and writing up what actually ships.

More about Paras →

Stay ahead of the AI curve

We test new AI tools every week and share honest results. Join our newsletter.