
Why the harness matters
A model can produce a plausible proposal without knowing whether it works in a particular system. The harness situates that model in a working environment with appropriate tools, relevant information and a way to detect failures. It does not guarantee correctness; it makes outcomes verifiable. OpenAI's Codex engineering report describes this shift in software development, but is not independent evidence that the pattern succeeds with every agent.
What a harness actually does at runtime
An agent runtime is a state machine, not just a prompt in a loop. It accepts a task, associates an identity, selects allowed tools and requests a model step. From the model output it extracts either an answer or a proposed action. The proposal is validated syntactically and against business rules before an executor runs it. The result feeds the next model step. The harness determines whether another step is allowed, whether a user must intervene or whether execution can end.
The crucial boundary separates control from data. The model processes files, search results and errors as data. A policy component evaluates identity, destination and allowed effects against external rules. When the model reports completion, an independent verifier checks acceptance criteria. This separation allows model providers to change without rewriting security policy into another prompt.
Model proposals pass independent checks; feedback and audit follow distinct paths.
Six layers of a useful harness
A practical harness includes a scoped task contract, constrained tool interfaces, a legible environment, controlled execution, independent verification and a feedback channel. Give every layer an owner and a failure response. An agent may suggest a test, for example, but should not be able to remove the mandatory check from a release pipeline. Keep production access distinct from access to a working copy.
OpenAI and Anthropic: concrete architectural approaches
OpenAI's engineering report describes how an agent-readable repository, documented architecture decisions and machine-checkable rules support software development. A central idea is making knowledge available in the repository instead of placing every instruction in a huge initial prompt. This is experience from a specific project, not a controlled comparison of models.
Anthropic describes a long-running approach in which agents work incrementally across sessions and preserve progress in verifiable artifacts. A later session can resume from documented state. Its managed-agents architecture additionally separates session, harness and sandbox. The practical implication is that conversation history, active tool loop and executing computer do not need the same lifetime or permissions. Boundaries between components are often more important than the number of agents.
Documentation: OpenAI – Harness engineering · Anthropic – Effective harnesses for long-running agents · Anthropic – Harness design for long-running application development · Anthropic – Session, harness and sandbox
Prompts, context and harnesses
Prompt engineering expresses intended behavior. Context engineering selects the information that the model sees at a particular moment. Harness engineering connects both to actual runtime capabilities and controls. An instruction not to delete files is useful but cannot replace filesystem authorization. A short navigable repository guide may also beat a huge system prompt when an agent can retrieve the right rules on demand.
Concrete tool and policy design
A tool schema should narrowly define an action's purpose. Instead of an arbitrary HTTP client for a support agent, consider search_policy, read_customer_case and draft_response with explicit parameters. Customer identity comes from the authenticated session rather than a freely chosen model argument. A sending tool receives only the approved draft identifier and authorized recipient. This does not prevent every bad decision, but reduces the possible unintended actions.
Return compact structured results: status, result reference, explicit error category and possibly a safe next action. A timeout is not equivalent to a permission denial. After access is denied the model should not try an alternate tool to bypass the boundary. Detailed internal errors belong in an audit record, not unfiltered in model context.
Documentation: OpenAI – Agents SDK concepts · OpenAI – Guardrails
Example: repairing a website defect
Give a coding agent a reproducible defect, a repository working copy and permission to edit only the relevant area. It runs the existing test, proposes a small patch and records the change. A separate immutable CI check runs before a human decides whether to release. After two failed attempts the agent returns a diagnostic instead of trying indefinitely. The result is a reviewable change, not a persuasive success report.
Worked example: why agent loops become expensive
Suppose a task requires twelve model steps. Each processes an average of 8,000 input tokens and 600 output tokens. This illustrative case consumes 96,000 input and 7,200 output tokens. At assumed prices of €2 per million input tokens and €8 per million output tokens, the model costs are €0.192 plus €0.0576, or roughly €0.25. Tool and infrastructure costs are excluded. These are not current vendor prices.
If only 70 percent of tasks are accepted, model cost per accepted task is approximately €0.36. At 90 percent it is about €0.28. Teams should compare cost per accepted outcome, not only cost per call. An additional verification step can pay off if it reduces expensive retries and manual correction. Balance caching, context compression and retrieval against possible loss of relevant evidence.
Illustrative model cost: €0.2496 per attempt divided by acceptance rate; excludes tools and operations.
Feedback rather than endless retries
Record classes of failure as well as successful outputs. A missing authorization check calls for a policy change; repeatedly selecting the wrong file suggests a better index or narrower tools. Convert observed failures into reproducible evaluations. Modify one layer at a time and replay the same cases so that improvements can be attributed to the harness or model rather than confounded changes.
Measurement and stopping criteria
Track accepted outcomes, unauthorized action attempts, cost per accepted task, latency and human interventions. A high count of tool calls is not a quality metric. Set time, cost and retry limits and a safe termination state. Cover at least a malformed tool argument, manipulated input, timeout and denied approval in the evaluation set.
A verifiable task contract with an example
A coding-agent contract can require task_id, objective, allowed_paths, max_tool_calls, expected_checks and approval_required. For a layout repair, it might permit only a CSS file and related tests, twenty tool calls and changes in an isolated branch. Acceptance means a reviewable diff with a successful regression test. A green check is insufficient if the agent also weakened the test.
An independent verifier reads the diff, confirms excluded files remain untouched and runs unchanged mandatory checks in a separate environment. If an out-of-scope change is necessary, create a new task or explicitly extend authorization. Record model version, harness version, tool schema version and test-data revision for later diagnosis. This makes failures replayable without storing all production data in a trace.
A verifiable task contract
Before the first model call, the task contract should specify allowed inputs, editable areas and acceptance criteria in a machine-readable form. For a website it might include an issue identifier, permitted paths, test instructions, a change budget and an explicitly prohibited production action. Distinguish user requirements from information found during research. A webpage or README can supply information but cannot grant new permissions.
For an initial pilot, a single page with a reproducible defect is sufficient. Expand the task catalogue only after the environment makes the failure type reliably observable. A harness should produce an intelligible error even with a less capable model instead of quietly making unsafe decisions.
Authorization as architecture
Separate the planner from execution by requiring a structured action proposal specifying tool, destination and parameters. A separate component checks the action against an allowlist before executing it. For file writes, consider path normalization and symbolic links; for API access, preserve the user's authorization context. Not every action needs manual approval, but each requires appropriate technical permission.
An approval prompt should describe the specific effect rather than merely asking whether the user trusts the agent. Store the approved version and recheck when it changes. The model should not be responsible for deciding whether the approval itself was granted.
Maturity: from assistance to bounded autonomy
At level one the agent only proposes actions. Level two uses read-only tools and cites evidence. Level three permits isolated reversible changes. Level four adds approval for external effects, recovery and production-like evaluations. Only level five permits narrowly defined actions without repeated human confirmation within a preauthorized scope. These levels are our architectural model, not an official certification.
Not every organization should pursue the highest level. A contract assistant that analyzes documents may never need automatic publishing or payment. Controls must match potential harm. An agent with strong average outcomes but occasional unauthorized writes is not production-ready. A good harness makes these outliers measurable and blocks actions independently of how convincing the model sounds.
Original architecture maturity model; not certification or a product rating.
A four-stage pilot
Select ten ordinary tasks and five important failure scenarios. Run them first without write permissions and observe tool selection. Then enable an isolated writable area. Compare test logs and diffs with a human-authored reference result. Repeat the same cases whenever the model version, tool schemas or system policies change.
Keep failed attempts as part of the evidence. A harness that correctly stops a disallowed task has succeeded in that case. Record not just task completion but correct rejection rates and the reviewer effort required to verify results.
Acceptance tests: what failures should the harness handle?
A credible test plan covers a wrong path, incomplete arguments, manipulated documents, an expired token, a tool timeout and denied approval. Add an incorrect business result despite valid formatting, interruption immediately before an external effect and attempts to exceed the time budget. Check not only whether the agent continues but whether it ends in the correct state.
Define expected status and evidence for each class: denied with a policy event, needs_review with unchanged production state or completed with independent outcome validation. Version the evaluation catalogue separately from the application. In our assessment a low reported failure rate without clear negative cases is less valuable than a small reproducible catalogue targeting actual application risks.
AgentenCode assessment
We would start with a small observable harness and restrictive tools before optimizing the model or adding agents. A strong harness exposes weaknesses but cannot reliably manufacture abilities absent from the model. For irreversible actions, critical controls belong outside the model's decision. The real benefit is that failures become reproducible and can be fixed systematically.
Decision matrix
| Failure | Control | Evidence |
|---|---|---|
| Wrong file | Scoped write access | Diff |
| Wrong result | Independent test | Test log |
| Unauthorized action | Policy gate | Audit event |
| Loop | Budget and stop | Stop reason |
Frequently asked questions
Is a harness a framework?
Not necessarily. A framework supplies components; a harness is the configured environment and control logic.
Does it replace prompting?
No. Instructions remain useful but are complemented by enforceable boundaries.
Do I need multiple agents?
No. Start with one agent and a verifiable task.
What is a good first test?
A reproducible failure case with a clear expectation and an independent check.
Does it eliminate hallucinations?
No. Source checks and tests can detect and contain them.
When should releases be autonomous?
Only when permissions, approval policy and independent gates cover the specific risk.
Did AgentenCode lab-test the named products?
No. Our assessment combines public vendor documentation with original conceptual examples and calculations. Suitability must be tested in the specific environment.
Primary sources and methodology
Claims are grounded in the linked primary sources and original editorial analysis. Examples are illustrative; AgentenCode has not independently tested products, certified security or measured keyword volume. Sources reviewed November 25, 2026.