DeepSeek Harness:当 agent loop 也变成插件DeepSeek Harness: when the agent loop becomes a pluginDeepSeek Harness:エージェントループまでプラグインになるとき

约 5 分钟3 min read約 6 分

Published:

On August 13 DeepSeek released V4 together with something I did not expect from a model lab: an entire agent runtime, DeepSeek Harness (dsh), MIT-licensed, in developer preview. The repository passed 95,000 stars within two days. I have spent the week since reading the code and the write-ups, and I think most of the coverage is looking at the wrong layer.

What it is

The slogan is everything is a plugin. That is usually marketing, but here it is literal: the model adapter, the tool registry, the session log and the agent loop itself are plugins, composed on a framework called Cordis. The Cordis paper (A Programming Paradigm for Spatiotemporal Composability) is about adding and removing components from a live system and cleanly reversing their side effects.

Cordis core load · unload · roll back side effects Model adapter V4-Flash · V4-Pro · self-hosted Agent loop itself a plugin Tool registry shell · edit · web search Session log append-only → cache-friendly Modes full · code · minimal · creator Sub-agents Claude Code · Codex dashed = swappable plugin
DeepSeek Harness as I understand it: a small core, and every runtime service around it replaceable.

A few practical details make it more than a framework demo:

  • Shell, file editing and web search are separately toggleable, and there are four modes (full coding agent, code, minimal, creator).
  • Models are configured in a YAML file: V4-Flash or V4-Pro with adjustable reasoning effort, other providers, or self-hosted models.
  • It can call Claude Code or Codex as sub-agents.
  • npx @deepseek-ai/dsh web starts a local web UI.

The part that matters: the cache bill

An agent re-reads its whole context on every step. MindStudio’s test of dsh burned about 20 million tokens across two turns (35 minutes, ~240k output tokens at ~130 tok/s). At that volume the price per token barely matters; what matters is how much of the input is served from cache.

That is what the “plugin” design is really for. If the session log is append-only and nothing rewrites the start of the prompt, every step hits the prefix cache. Reported hit rates are 95–100%, and one analysis puts a task at $0.045–0.09 on V4-Flash versus $0.195–0.65 with Claude Code on Opus.

Append-only context turn 1 turn 2 turn 3 each turn re-reads the whole prefix, but only the new tail is billed at full price Mutated prefix turn 3′ a timestamp or re-ordered tool list at the start → nothing after it can be served from cache cache hit new / uncached changed prefix
Why "never touch the prefix" is an architectural rule, not a micro-optimisation.
Reported cost per task (USD) $0 $0.20 $0.40 $0.60 dsh + V4-Flash $0.045 – 0.09 Claude Code + Opus $0.195 – 0.65 (bar clipped at $0.60) Source: third-party write-up of dsh (A. Masood, Aug 2026). Ranges as reported, not my measurement.
Reported ranges, not my own benchmark; the gap is what matters, not the exact numbers.

This also explains design choices that look arbitrary from outside. A timestamp in the system prompt, a tool list sorted differently on each run, a memory block injected at the top: each one silently turns a 99% cache hit into a miss. A harness written by the people who price the cache has every reason to make those mistakes impossible.

What I take from it

1. Model labs are becoming harness companies. Anthropic has Claude Code, OpenAI has Codex, now DeepSeek has dsh. The model is increasingly sold with the loop that uses it well, and for a cheap model the harness is where the margin is protected.

2. Two answers to the same problem. Pi keeps the core tiny and lets the agent write its own extensions. dsh makes the core formally composable. Both are reactions to closed, opinionated agents, and both treat cache stability as a design constraint.

3. It matters for private deployments. In my day job, customers want agents that run against models in their own data centre. A harness that treats “self-hosted model” as just another adapter, and whose cost model assumes a prefix cache you can also run yourself, is much easier to bring on-premises than one welded to a single API.

4. The caveats are real. It is a developer preview, it is token-hungry by design (cheap only because of the cache), and every plugin you load is code with access to your shell. “Everything is swappable” also means “everything is attack surface”.

My short version: the headline feature is composability, but the lasting idea is that cache hit rate is the KPI of an agent harness.

Sources