跪拜 Guibai
← All articles
Python · AI · Agent

DeepSeek Harness Gives Agents Hands, Boundaries, and Memory

By 编程干货铺 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

The bottleneck in agent tooling has shifted from model intelligence to system boundaries and trust; DSH shows that a runtime which owns session, approvals, and recovery lets one human supervise multiple agents, but only if permissions and contexts are set deliberately.

Summary

DeepSeek Harness (dsh) is an agent runtime that equips models with tools, sandbox boundaries, memory, and a plugin system. Its core is an agent loop: the model requests a tool call, the harness executes it in a sandbox, appends the result to an append-only session log, and feeds the updated history back to the model. That loop lets a task span dozens of steps instead of one reply.

The architecture splits into six layers: session (memory), loop (advancement), tools (execution), sandbox/approval (safety), context (cost), and delivery (landing). Profiles stack plugins via YAML patch files, so users can disable or reconfigure components without waiting for official releases. A headless mode runs the same kernel inside CI.

A separate super-agent prototype, open-sourced as dsh-superagent-prototype, separates Router (decides) from Worker (executes), makes workers stateless and replaceable, uses chained retrieval to treat the context window as a cache, and adds an independent watchdog session. Reported p95 completion time dropped from 29.5 to 15.7 minutes across a batch of tasks. The practical sections also cover permission modes, 256 auto-retry turns, and the hard rule that chat replies stay under 100 words.

Takeaways
— DSH's agent loop makes task length independent of a single model reply by appending tool results to an append-only session log.
— Six layers make up the architecture: session, loop, tools, sandbox/approval, context, delivery.
— Profiles are assembled from plugins via package.json and cordis.patch.yml; dsh --dump-config shows the final stacked configuration.
— The super-agent prototype splits Router (decision) from Worker (execution); workers are stateless, replaceable services.
— Prototype p95 task completion time dropped from 29.5 to 15.7 minutes, with the source link pending publication.
— Router feasibility depends on bounded context from natural work boundaries such as groups, repos, and PRs, not on raw model intelligence.
— Chained retrieval inlines only summaries and IDs, fetching details on demand, effectively making the context window a cache.
— Event-driven design uses Threads: Router only judges new messages; subscribed Threads route directly to Worker.
— An independent Watchdog Session checks for stalled tasks or wrong direction, not just crashes.
— start()/stop() make long tool calls asynchronous, decoupling frontend responsiveness from backend execution.
— IM replies are limited to 100 words by a hard rule from the official docs.
— Edge-cloud collaboration uses a local daemon so cloud agents reach real environments; the sandbox becomes a tool, not a container.
— Default safety is strictest read-only; three sandbox modes and two approval levels are bundled as permission presets.
— goal auto-continues up to 256 rounds, and cron-based scheduled tasks persist across restarts.
— Skills are markdown files with only name and description exposed; body loads only when used.
— Permission modes: read-only+never, workspace-write+ask, one-time approval for specific operations, and danger-full-access for containers or CI.
— To avoid rework, have the agent produce a plan in read-only mode before allowing changes.
— Headless mode targets CI, SDK exposes JSON-RPC, ACP connects editors, MCP connects external tools.
— Limitations include the Router still being prototype, sandbox friction from misconfigured workspaces, context costs, and model overconfidence.
— Don't turn off approval in unfamiliar repositories; danger-full-access should stay in containers.
Conclusions

The line between a toy and a tool for agents is whether the user specifies acceptance criteria rather than intentions.

Shifting session management into the system reassigns the human role from operator to spec-setter, so the bottleneck moves from attention span to specification clarity.

Router design depends on a bounded context from work-group boundaries like repos and PRs, so workflow structure substitutes for model reasoning about access.

The 100-word IM cap treats agent output as a communication design problem, not just a model capability problem.

Making workers stateless and replaceable means parallelism is limited by compute rather than instance count, which is a bigger architectural leverage than the p95 improvement suggests.

Concepts & terms
Agent loop
The cycle where a model requests a tool call, the harness executes it in a sandbox, appends the result to the session log, and feeds updated history back to the model, allowing tasks to span many steps beyond a single reply.
Harness
The middle layer between a model and execution: gives the model hands (tools), boundaries (sandbox and approvals), and memory (append-only log).
Chained retrieval
A strategy to keep context within window limits: only inline summaries and object IDs, and fetch full details on demand when needed, treating the context window as a cache.
Router/Worker
In super-agent architecture, Router decides whether a task is worth doing, who to assign it to, and what counts as done; Worker executes and focuses on delivery.
Watchdog session
An independent control loop that periodically checks for tasks making no progress or losing direction, unlike traditional crash detection.
Thread
A group of related messages under the same IM topic, workspace, or PR that establishes a subscribed relationship, so subsequent messages route directly to Worker without Router re-judgment.
From the discussion
Featured comments
用户573468752399

The Harness layer is done right; the remaining pitfalls are basically all in the accounting. When we integrated DeepSeek ourselves, the three most troublesome things were: retries must be recorded per attempt, cache hits need to be separately tagged, and second requests after truncated output shouldn't be double-counted. If these three aren't itemized, the end-of-month reconciliation always comes up short. Later, several domestic models used the same key through one gateway, and with details exported by business line, reconciliation could be closed within half an hour. We can chat about details in private.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗