Agent Harness engineering
Agent Harness Invariants: 30 Decisions & Failure Boundaries
- Author
- DeepSeekAgent.io Editorial Team
- Published
- Updated
The November 2026 paper “Anatomy of an Agent Harness” turns design choices usually hidden in code into 30 decision cards across turns, failures, prompts, state, permissions and display. Every card records options and costs, an invariant, breaking corner cases and a test method.
Its central contribution is to replace “the Agent sometimes behaves strangely” with engineering properties that can be checked.
A Harness turns model output into action
A model only produces content. The Harness assembles requests, runs tools, decides when approval is required, stores the conversation, handles interruption and recovery, and renders the process. The same model can therefore receive different tools, permissions, stop semantics and recovery behavior across Harnesses.
The paper defines the Harness as the complete execution layer between a person or schedule and the model provider: turn loop, provider protocol, tools, permission and sandbox layers, durable transcript, host process and display.
What the 30 decisions cover
The six groups translate into a useful DSH review framework:
- Turn: what starts and ends a turn, and how Tool Calls pair with results.
- Failure: whether network, provider, tool and parsing failures are distinct, and whether retries duplicate effects.
- Prompt: whether tools, rules and current state sent to the model agree.
- State: whether stop, mid-turn messages, restart, compaction and SubAgent messages persist exactly once.
- Permission: who decides before execution and whether stale approvals are withdrawn.
- Display: whether visible state matches actual runtime state.
These are closer to Harness reliability than prompt wording alone.
Three high-value DSH invariants
Stop must prevent new work
After Stop, no new model request or tool execution should begin. Open approval requests should be withdrawn and background processes should follow the declared shutdown behavior. Changing a button to “stopped” while work continues violates the invariant.
Prompt and tool catalog must agree
Every tool named in the prompt should exist in the same request's tool list, and rules should not contradict each other. Dynamic plugin changes, Profile switches and compaction can otherwise leave the prompt claiming a capability that the request no longer exposes.
Mid-turn messages must arrive exactly once
A message sent during execution should be accepted once, displayed once and survive restart. Duplicate submission, display without execution delivery, or loss after restart can each become a deterministic regression test.
Turning invariants into tests
Do not only ask a live model to “try the workflow.” Use a scripted provider, fixed tool outputs and planted state changes: drop the connection before a Tool Call, press Stop during approval, append a message mid-turn, reload rules after compaction, or replace the tool catalog. Then inspect both the event record and UI.
Each test should record its trigger, expected events, forbidden side effects, durable state and user-visible outcome. The same defect can then be reproduced across releases.
Evidence scope
The cards come from the author's Crewroom implementation, manual tests of ten other Harnesses and open-source references. Of 83 invariant clauses, 56 are tagged Tested, 12 Believed and 15 Open. The work is an engineering checklist, not a Harness ranking or an answer-quality benchmark.
Applying it to DSH requires validation against the current release's events, storage and UI. Continue with the DeepSeek Harness security guide and Agent Harness resource budgets.