Skip to main content
Engineering the Agentic AI Harness

Engineering the Agentic AI Harness: Architecture, Components, and Design Patterns

Prescriptive architectural guidance for designing, building, governing, and continuously evolving enterprise-grade agentic software engineering platforms.


Who this is for. Principal and staff engineers, platform architects, engineering directors, and heads of AI engineering who are responsible for moving AI coding agents from individual productivity tools to governed, organization-wide delivery capability.

What you will learn. After reading this guide you will be able to:

  1. Distinguish the model, agent, harness, runtime, and runtime environment, and assign each a clear architectural responsibility.
  2. Apply a set of architectural principles and non-negotiable controls to any harness design.
  3. Design a harness reference architecture with a control plane, an execution plane, and an independent verification plane.
  4. Engineer context, skills, tools, and Model Context Protocol (MCP) integrations as governed enterprise capabilities.
  5. Select an execution isolation model and a trust architecture proportionate to workload risk.
  6. Design durable, recoverable execution for long-running tasks.
  7. Build independent verification that an implementing agent cannot weaken, bypass, or game.
  8. Evaluate, observe, and economically manage a harness as a product.
  9. Choose between adopting, extending, composing, and building harness capabilities, and sequence the work in phases.

A note on currency. Agentic tooling changes quickly. Product names, protocol versions, and feature sets mentioned here were reviewed against the state of practice in late 2026 and are illustrative. The architectural responsibilities, controls, and trade-offs are intended to outlast any individual product. Confirm product capabilities, licensing, and security properties before committing to an implementation.


Abstract​

AI coding agents are changing the architecture of software engineering. Organizations are moving beyond isolated assistants toward engineering environments in which agents interpret specifications, navigate repositories, plan work, execute tools, generate and modify software, validate changes, and participate in governed delivery workflows.

Model capability, however, does not by itself produce reliable engineering outcomes. A highly capable model operating in an under-engineered environment will still misread context, exceed its authority, report success it has not earned, lose progress across sessions, and generate cost without delivering value.

What closes this gap is an engineered system that supplies agents with the right context, constrains their autonomy, manages their execution, enforces architectural and security policy, verifies results independently, and converts execution evidence into continuous improvement. That system is the Agentic AI Harness, and the discipline of building and evolving it is Harness Engineering.

This guide presents a prescriptive architectural framework covering the fundamental decisions, logical components, execution mechanisms, design patterns, deployment models, security boundaries, evaluation strategies, and operating practices of a production-grade harness.

The central principle is:

Do not merely engineer intelligent agents. Engineer the system within which those agents can reliably accomplish engineering objectives.


Introduction: Engineering the System That Builds Software​

The changing nature of software engineering​

Software engineering organizations have invested for decades in development environments, source control, build systems, test automation, CI/CD, security scanning, architectural standards, and production observability. These capabilities were designed around human engineers.

AI-native engineering introduces a new class of participant: software agents that interpret objectives, select tools, perform multi-step actions, and adapt to environmental feedback. This raises architectural questions that did not previously have to be answered explicitly:

  • How does an agent understand the architecture of an existing application?
  • How does it obtain the business and technical context it needs, and only that context?
  • How does it decide what to do next, and who decides when it has finished?
  • How does it execute commands without compromising security?
  • How does it recover from partial failure, and preserve progress across sessions?
  • How does the organization independently verify its work?
  • How do we prevent architectural erosion when change volume increases several-fold?
  • How do we control the economics of agent execution?

These questions cannot be answered through prompt engineering alone. They require software architecture, platform engineering, distributed systems, security engineering, context engineering, evaluation engineering, and reliability engineering working together.

From coding assistance to engineered delivery systems​

DimensionConventional coding assistanceAgentic engineering harness
Unit of workCode suggestion or editBounded engineering task or feature
ExecutionHuman-drivenHuman-directed, agent-executed
ContextEditor and open filesRepository, architecture, specifications, enterprise knowledge
PlanningPrimarily humanHuman–agent collaboration
Tool interactionLimited, manually initiatedGoverned, multi-step tool execution
VerificationExternal to the assistantIntegrated with independent verification systems
ContinuitySingle interactionDurable task state and checkpoints
GovernanceIndividual developer settingsEnterprise policy and execution boundaries
AccountabilityHuman engineerHuman engineer supported by auditable execution evidence

The fundamental transition is from assisting individual coding activities to establishing an environment that supports complete engineering workflows.

Where the harness fits​

The harness is one element of the broader AI-native software engineering ecosystem. Four terms are used throughout this guide and should not be conflated:

TermMeaning
Harness EngineeringThe discipline that builds, evaluates, and evolves the harness.
Agentic AI HarnessThe technical system that surrounds models and agents with execution controls.
AI-Native SDLCThe process framework that governs how work flows through humans and agents.
AI-Native Software DevelopmentThe application of the harness and SDLC to deliver business software.
ai-native-software-engineering

Figure 1. Relationships within AI-native software engineering.

This guide concentrates on the left side of the diagram: engineering the harness itself. A companion guide addresses delivering business features through a deployed harness.

Why now: three shifts that make the harness decisive​

Three developments explain why harness quality increasingly determines outcomes.

  1. Agents run longer and act more independently. Tasks that once took a single prompt now span hours, many tool calls, and multiple context windows. Reliability at that horizon is a property of the surrounding system, not just the model.
  2. Throughput changes the economics of control. When agents produce change faster than humans can read it, manual review of every line stops scaling. Controls must shift from inspection after the fact toward mechanical enforcement built into the environment: tests, linters, structural checks, and policy gates.
  3. The environment is the interface. An agent can only work with what it can see and invoke. Knowledge that lives in a chat thread, a wiki the agent cannot reach, or a person's head effectively does not exist. Making the repository and its surrounding systems legible to agents is itself an engineering task.

Key takeaway. The model is necessary but not sufficient. Engineering reliability comes from the system around it.


Defining the Agentic AI Harness​

Architectural definition​

An Agentic AI Software Engineering Harness is an engineered software system that surrounds AI models and agents with the orchestration, context, tools, execution environments, state management, verification, governance, and feedback mechanisms required to perform software engineering work reliably within defined operational constraints.

A harness may be implemented as a local application, a managed coding-agent service, a collection of integrated tools, or a distributed enterprise platform. An organization adopting one does not necessarily build its own foundational agent loop.

Model, agent, harness, runtime, and environment​

These concepts are frequently used interchangeably. They carry different responsibilities.

ConceptArchitectural responsibility
AI modelProvides inference, language understanding, reasoning, and structured action proposals.
AI agentA task-oriented entity that uses a model, context, and tools to pursue an objective.
Agent harnessImplements the execution loop, context assembly, tool dispatch, state coordination, and execution controls around the model.
Agent runtimeHosts and manages execution: lifecycle, sessions, concurrency, scheduling, and resource allocation.
Runtime environmentProvides the actual execution boundary: compute, filesystem, network, isolation, and scoped credentials.
Enterprise harnessExtends a foundational harness with enterprise workflows, policy, verification, integrations, and operational management.
agent-harness-architecture

Figure 2. Logical separation of model, harness, runtime, and runtime environment.

These are logical responsibilities. A commercial or open-source product may combine several in one implementation. What matters architecturally is knowing which component is responsible for which control, so that no control is left implicitly to the model.

The enterprise harness is broader than the foundational harness​

A foundational coding-agent harness typically provides model invocation, context assembly, tool execution, and session management. An enterprise needs more.

Foundational capabilityEnterprise extension
Agent execution loopGoverned engineering workflows
Local repository accessRepository registration and access policy
Tool invocationApproved tool catalog and credential brokerage
Session stateDurable task management and recovery
Repository instruction filesEnterprise architecture and knowledge management
Local command executionIsolated, policy-controlled environments
Agent-written testsIndependent verification infrastructure
Execution logsCentralized observability and auditability
Model integrationModel governance and cost management

The preferred strategy is therefore:

Adopt foundational agent capabilities where appropriate, and engineer the enterprise capabilities that differentiate your delivery environment.


Architectural Principles and Non-Negotiables​

Core principles​

PrinciplePrescriptive guidance
Human accountabilityAssign an accountable human owner to every objective, risk decision, and delivered outcome.
Intent before executionEstablish objective, constraints, acceptance criteria, and scope before significant modification begins.
Context as infrastructureManage engineering context as a versioned, governed, reusable capability.
Repository as system of recordWhatever an agent must know must be discoverable in the repository or governed sources it can reach, not in transient conversations.
Least-privilege executionGrant only the repository, tool, environment, and action permissions the task requires.
Bounded autonomyLimit execution by time, tokens, cost, iterations, actions, and permissions.
Deterministic controlImplement authorization, policy, and quality gates in trusted software, not in model judgment alone.
Independent verificationVerify results using criteria and mechanisms the implementing agent cannot unilaterally alter.
Durable executionPreserve progress and support recovery from interruption or failure.
Architecture by enforcementConvert important architectural constraints into machine-executable checks wherever feasible.
Observability by designCapture enough evidence to investigate decisions, actions, failures, and outcomes.
Progressive complexityAdd models, agents, services, and orchestration only when demonstrated requirements justify them.
Continuous evolutionConvert recurring failures into governed, reusable harness improvements.

Architectural non-negotiables​

Every production-grade enterprise harness must establish controls ensuring that:

  1. Agents cannot grant themselves additional permissions.
  2. Agents cannot unilaterally change the controls that govern their execution.
  3. Agent-reported success is never sufficient evidence of completion.
  4. Credentials are not exposed to model context, execution logs, or generated artifacts.
  5. Agent-generated code remains subject to software supply-chain controls.
  6. Production actions remain subject to established release and operational policy.
  7. Execution has explicit termination and escalation conditions.
  8. Harness changes are evaluated and versioned before wider adoption.
  9. Untrusted content (repository text, web pages, tool output, issue bodies) cannot gain instruction authority by being placed in context.

The objective is not unrestricted autonomy. It is controlled autonomy with independently verifiable outcomes.

Key takeaway. Instructions shape behavior; controls bound it. A production harness needs both, and must never rely on instructions to do the work of controls.


Requirements Engineering for the Harness​

Before choosing technology, decide what engineering workloads the harness must support.

Select the target workload​

WorkloadRepresentative activitiesRecommended initial autonomy
Repository explorationCode comprehension, dependency analysis, documentation discoveryRead-only
DocumentationGenerate or update technical documentationBounded write
Software maintenanceFix defects, update libraries, refactor modulesBounded write with verification
Feature implementationChange application components against a specificationGoverned multi-step execution
Application modernizationCoordinate changes across legacy and target architecturesSupervised execution
Architecture analysisAssess dependencies, constraints, and alternativesRead-only; human owns the decision
TestingGenerate tests, run suites, investigate failuresIsolated execution
Infrastructure engineeringGenerate and validate infrastructure-as-code changesRestricted execution with approvals
Production engineeringAnalyze incidents and propose remediationRead-only initially; remediation separately authorized

Do not begin by attempting to automate the entire SDLC. Select a bounded, representative workload with measurable acceptance criteria and an acceptable risk profile.

Functional requirements​

Capability groupFunctional requirements
Task managementSubmission, classification, assignment, lifecycle management
Context managementRepository discovery, retrieval, instruction assembly
Agent executionPlanning, tool invocation, iteration, delegation, termination
Model managementSelection, invocation, fallback, configuration
Tool managementDiscovery, authorization, validation, execution
Workspace managementProvisioning, isolation, dependency setup, cleanup
State managementSessions, checkpoints, progress, recovery
VerificationTest execution, architecture validation, evidence collection
GovernancePolicies, approvals, permissions, restrictions
Delivery integrationSource control, pull requests, CI/CD, artifact management
OperationsTracing, metrics, alerts, diagnostics, administration
EvaluationBenchmark execution, regression testing, capability assessment

Non-functional requirements​

Quality attributeIllustrative requirement
SecurityNo unauthorized repository, network, or production access.
IsolationSeparate execution boundaries for concurrent tasks.
ReliabilityResume interrupted tasks from durable checkpoints where supported.
ScalabilitySupport growing concurrent workloads without uncontrolled contention.
AvailabilityService objectives appropriate to engineering criticality.
AuditabilityCorrelate material tool actions, policy decisions, approvals, and artifacts.
MaintainabilityVersion workflows, skills, instructions, tools, policies, and evaluations.
ExtensibilityIntroduce approved tools and workflows without modifying unrelated components.
Cost efficiencyEnforce execution budgets; monitor cost per successful task.
PrivacyProtect source code, intellectual property, credentials, and sensitive data.
InteroperabilityIntegrate with existing repositories, identity providers, and delivery systems.
RecoverabilityRestore control-plane state; resume or safely terminate eligible workloads.

Set numerical targets from workload measurements and organizational requirements rather than from arbitrary industry thresholds.


Logical Reference Architecture​

Eight architectural areas​

A production-oriented enterprise harness can be organized into eight logical areas, supported by cross-cutting capabilities.

enterprise-harness-reference-architecture

Figure 3. Logical enterprise reference architecture.

The architecture describes responsibilities, not a mandatory microservices decomposition. Several areas may live in a single application, and others may already exist in your engineering platform.

Reading the architecture​

  • The control plane decides what execution is permitted.
  • The execution layer coordinates the engineering activity.
  • The context, model, and tool layers supply what agents need.
  • The runtime and environment impose operational boundaries.
  • The verification and delivery layer establishes evidence of correctness and hands candidate changes to the existing release path.

Verification capabilities are also useful earlier in execution, for example when an agent runs tests locally for fast feedback. Their position at the end of the diagram emphasizes the authoritative gates a change must satisfy before release.

Three planes, one trust model​

It is often helpful to reason about the harness as three planes with distinct trust levels.

PlaneContainsTrust level
Control planeIdentity, policy, registries, admission, approvals, budgetsFully trusted; not modifiable by agents
Execution planeAgent loop, workspaces, tools, model callsConstrained; treated as potentially compromised
Verification planeProtected tests, policy checks, evidence storeTrusted; isolated from the execution plane

This framing keeps the most important rule visible: the plane that does the work must never be the plane that judges or authorizes the work.


Engineering the Control Plane​

Purpose​

The control plane governs the availability, configuration, authorization, and lifecycle of harness capabilities. It establishes the conditions under which execution may occur.

control-plane-execution-plane

Figure 4. Control-plane and execution-plane responsibilities.

Core components​

ComponentPrimary responsibility
Repository RegistryApproved repositories, owners, context sources, access boundaries
Agent RegistryApproved agent configurations, capabilities, versions
Skill RegistryReusable, versioned engineering skills
Workflow RegistryApproved workflows and execution definitions
Tool RegistryApproved tool definitions, capabilities, risk classes
Task Management ServiceAccept, classify, schedule, and track tasks
Policy ManagementExecution constraints, authorization rules, prohibited actions
Approval ServiceRisk-based human approvals and exceptions
Model ConfigurationApproved models, routing rules, inference constraints
Quota ManagementConcurrency, token, and cost limits

Execution contracts​

Every admitted task should be represented by an explicit execution contract: a machine-readable record of what the agent may attempt and what counts as success.

task_id: TASK-1042
task_type: feature_implementation
owner: accountable-engineer@example.com

repository:
id: tenant-platform
base_ref: <approved-commit-sha>
workspace_mode: isolated

objective: >
Implement retry handling for tenant provisioning.

specification:
ref: specifications/tenant-provisioning.md
acceptance_profile: tenant-provisioning-v3

execution:
workflow: governed-feature-implementation
workflow_version: "1.4"
model_profile: approved-coding-model
skill_profile: aws-saas-engineering

permissions:
repository_read: true
workspace_write: true
pull_request_create: true
protected_branch_write: false
production_access: false
network_egress: allowlist:package-mirror,model-gateway

budget:
max_iterations: 20
max_execution_minutes: 45
max_model_cost_usd: 10

verification:
required:
- functional_acceptance
- integration_tests
- tenant_isolation
- architecture_fitness
- security_scan
protected_paths:
- tests/acceptance/**
- verification/**
- ci/**

approval:
required_before_merge: true

The values above are illustrative, not recommended defaults. Three properties matter more than the values:

  1. Trusted enforcement. The contract must be validated and enforced by trusted harness components. Stating constraints in a prompt does not establish a security boundary.
  2. Protected verification paths. The contract names files and pipelines the implementing agent may not modify.
  3. Immutability during execution. The agent can request a contract change (for example, a larger budget), but only the control plane can grant it.

Engineering the Agent Execution and Orchestration Layer​

The bounded agent loop​

At its core, agentic execution is a controlled feedback loop: the model proposes an action, the harness decides whether to permit it, executes it, and returns the observation.

bounded-agent-execution-loop

Figure 5. Bounded agent execution loop.

The model proposes. The harness disposes.

Deterministic workflow versus autonomous execution​

Not every engineering activity needs an autonomous agent. Prefer deterministic control where the path is known, and use model-driven decisions where genuine uncertainty requires adaptation.

Execution modelAppropriate use
Deterministic workflowMandatory checks, approval gates, build pipelines, publication
Single-agent executionBounded implementation, debugging, code exploration
Sequential agent workflowSpecification analysis → implementation → review → verification
Parallel executionIndependent analyses or isolated subtasks
Multi-agent orchestrationWorkloads needing specialization or distinct contexts
Human–agent workflowAmbiguous objectives, architectural decisions, sensitive change

Task lifecycle​

A harness must give tasks explicit lifecycle semantics.

task-lifecycle-states

Figure 6. Representative task lifecycle.

A task needs a durable identity, an accountable owner, associated artifacts, execution status, and termination conditions. Long-running tasks must never depend exclusively on a model's conversational memory.

Long-running execution: durable progress across context windows​

When work exceeds one context window or one session, the model's working memory resets while the task continues. The harness must therefore externalize progress. Effective patterns observed in practice include:

  • A structured task or feature list that defines scope up front and records pass/fail status per item, so each new session knows what remains and cannot quietly redefine "done".
  • A progress log written by the agent at defined points and read at session start.
  • Frequent, descriptive commits that make the repository itself a recoverable record of progress.
  • A fresh-session start routine that orients the agent: confirm working directory, read the progress log and recent history, run a baseline check, then select the next item.
  • One increment at a time, leaving the environment in a clean, working state before a session ends.
  • Role separation across sessions, for example an initialization session that sets up the environment and task list, followed by incremental implementation sessions.

Structured, machine-readable task records resist casual rewriting better than free-form prose. Constrain who may mark an item complete, and require evidence from the verification plane rather than the agent's own assertion.

Checkpoints and resumption​

Preserve the following at defined checkpoints:

  • Task identity and approved objective.
  • Specification and context versions.
  • Completed and pending work.
  • Repository revision and workspace artifacts.
  • Tool invocation outcomes.
  • Test results and unresolved failures.
  • Active permissions and remaining budgets.
  • Required approvals and handoff notes.

On resumption, revalidate the repository revision, current policy, task scope, and checkpoint integrity before continuing. A resumed task must not blindly repeat actions that are not idempotent; reconcile their outcomes first.

Hooks: deterministic control inside the loop​

Most modern agent harnesses expose lifecycle hooks, points at which deterministic code runs before or after model-driven steps: before a tool call, after a file edit, on session start, on stop. Hooks are valuable because they place enforcement inside the loop without relying on the model to remember a rule.

Hook pointRepresentative use
Session startInject trusted context; verify environment and policy version
Pre-tool-useBlock disallowed commands or paths; validate parameters; require approval
Post-tool-useRun formatters and linters; record evidence; scan output for secrets
On completion claimTrigger independent verification before accepting "done"
Pre-compactionPersist critical state before context is summarized

Hooks run in the harness, not in the model, so they are suitable for controls. Treat hook configuration as a protected, versioned artifact: an agent able to edit its own hooks can disable its own guardrails.

Subagents and delegation​

Subagents, meaning delegated agent instances with their own context windows, serve two distinct purposes that should not be confused.

  1. Context isolation. A subagent explores a large codebase or reads many files and returns a concise summary, keeping the parent's context uncluttered.
  2. Specialization and parallelism. Different subagents carry different instructions, tool sets, or permissions.

Delegation does not create independence. Subagents commonly share a model, instructions, and sometimes credentials with the parent. Grant each subagent only the tools and permissions its task requires, pass explicit task specifications rather than relying on shared assumptions, and treat returned summaries as untrusted claims to be verified.


Engineering the Context and Skills Layer​

Context engineering as infrastructure​

A model cannot reliably honor constraints that are unavailable, ambiguous, outdated, or difficult to discover. The harness must make relevant knowledge accessible at the right step, and only then.

context-management-architecture

Figure 7. Enterprise context engineering architecture.

Context classification​

CategoryRepresentative contentPreferred source
EnterpriseSecurity policy, enterprise standardsGoverned knowledge repositories
DomainBusiness rules, terminology, domain modelsProduct and domain documentation
ArchitectureADRs, system boundaries, contractsArchitecture repositories
RepositoryCode, tests, dependency graphsSource control
TaskRequirements, acceptance criteriaSpecifications and task systems
ExecutionTool results, errors, progressExecution state and telemetry
OperationalRunbooks, incidents, service dependenciesOperational knowledge systems

Principles for context management​

The context subsystem should:

  1. Retrieve relevant context rather than loading entire repositories.
  2. Attach source references and versions to material context.
  3. Enforce access policy before retrieving sensitive information.
  4. Separate trusted organizational instructions from untrusted retrieved content.
  5. Prioritize task-specific and repository-specific constraints.
  6. Detect missing, conflicting, or stale guidance.
  7. Manage window limits through retrieval, summarization, and selective loading.
  8. Persist important facts to durable task state rather than leaving them only in the window.

Treat the context window as a scarce resource. Models can degrade as windows fill with noise, so more context is not automatically better. Effective harnesses combine:

  • Just-in-time retrieval. Keep lightweight references (paths, queries, identifiers) in context and load the content when needed, rather than preloading everything.
  • Progressive disclosure. Present short entry points first and let the agent follow pointers to depth.
  • Compaction. Summarize history when approaching limits, preserving decisions, open issues, and verified facts while discarding redundant tool output. Persist critical state before compaction.
  • Tool-result clearing. Remove stale, bulky tool outputs once their conclusions have been captured.
  • Structured note-taking. Write durable notes outside the window and re-read them when needed.

Begin with simple mechanisms such as file search, structural indexes, and direct retrieval. Introduce semantic retrieval or vector databases only where they produce measurable gains on your tasks.

Repository legibility by design​

A harness is only as effective as the environment it can understand. Treat the repository as the primary interface to the agent.

business-application/
|-- AGENTS.md # concise entry point; agent-agnostic conventions
|-- CLAUDE.md # product-specific entry point, if used
|-- README.md
|-- docs/
| |-- architecture/
| | |-- system-context.md
| | |-- component-model.md
| | +-- adr/
| |-- domain/
| |-- standards/
| +-- runbooks/
|-- specifications/
| |-- features/
| +-- acceptance/
|-- src/
|-- tests/
| |-- unit/
| |-- integration/
| |-- acceptance/
| +-- architecture/
|-- contracts/
|-- infrastructure/
+-- ci/

Guidance for instruction files:

  • Keep entry-point files short. Use them as a table of contents that points to authoritative documents, not as an encyclopedia of every organizational rule. Oversized instruction files crowd out the task and rot quickly.
  • Prefer mechanical enforcement over prose for any rule that matters. A rule that is both documented and checked by a linter or test is far more reliable than one that is only documented.
  • Write for a reader with no prior context: name commands, expected outputs, and where to find things.
  • Keep documentation current through automated checks (for example, link validation and freshness checks) and treat stale guidance as a defect.
  • Exact conventions for instruction files vary by agent product; confirm supported file names and loading behavior.

Engineering reusable agent skills​

An agent skill packages specialized instructions, procedures, reference material, and optionally executable resources for a recurring activity. A widely adopted design is progressive disclosure: only a short name and description are always loaded, the full instructions load when the skill is judged relevant, and supporting files load only if needed. This keeps context lean while making expertise available on demand.

SkillPurpose
API DesignApply enterprise API conventions and contract requirements
AWS ArchitectureApply approved AWS architecture patterns
Tenant IsolationImplement and assess multi-tenant security constraints
Database MigrationGenerate and validate safe schema changes
Test EngineeringCreate appropriate unit, integration, and regression tests
Security ReviewApply approved threat-modeling and review procedures
Architecture ReviewAssess implementation against architectural decisions
ObservabilityApply logging, tracing, metrics, and correlation conventions

Every skill should have a defined purpose, owner, version, applicability conditions, dependencies, expected artifacts, and evaluation criteria. Because skills can contain executable scripts, treat third-party skills as software supply-chain inputs: review, pin, and scan them.

Skills are reusable knowledge, not controls. They must never substitute for authorization policy or mandatory verification.


Engineering the Model Integration Layer​

Purpose​

Different engineering activities need different balances of reasoning quality, context capacity, latency, tool-use reliability, and cost. The model integration layer provides the abstraction needed to manage that, without undermining the capabilities of the foundational harness.

model-integration-layer

Figure 8. Logical model integration architecture.

Selection strategy​

Engineering taskSelection priority
Architecture analysisReasoning quality, context comprehension
Complex feature implementationCoding quality, reliable tool use
Repository explorationContext comprehension, latency
DocumentationInstruction following, cost
Test generationCode understanding, precision
Code reviewDefect identification, evidence quality
Classification and routingLatency, reliability, low cost

A model that excels on public benchmarks may underperform on your repositories, languages, and conventions. Evaluate models on representative internal tasks, in the context of the complete harness.

Routing, fallback, and model change​

  • Introduce routing only when it provides measurable benefit. Routing may weigh task complexity, data classification, cost, context capacity, provider availability, and tool capability.
  • Fallback must preserve execution semantics. If an alternative model cannot reliably interpret the current task state or use the required tools, escalate or terminate rather than silently continuing with incompatible behavior.
  • Where a coding-agent product is tightly coupled to a particular model provider, introduce governance through its supported integration points rather than forcing an incompatible abstraction.
  • Re-evaluate the harness when the model changes. Harness components encode assumptions about model weaknesses (for example, aggressive context resets or heavy scaffolding). As models improve, some of those assumptions become obsolete and may even degrade results. Each harness component should be justified by a measurable benefit and periodically retested for continued necessity.

Engineering the Tool and MCP Integration Layer​

Tools as controlled capabilities​

Tools connect model-generated action proposals to real systems: repository readers, file editors, shell execution, test runners, source control, documentation systems, issue trackers, and cloud services. The challenge is not exposing tools; it is exposing them with proper contracts, permissions, validation, and observability.

Governed tool execution​

governed-tool-execution

Figure 9. Governed tool execution architecture.

Tool contracts​

Contract elementDescription
IdentityUnique identifier and version
PurposeSupported operation
Input schemaValidated parameters and constraints
Output schemaStructured results and failure conditions
Side effectsResources or state the tool may modify
AuthorizationRequired identities, permissions, and scopes
Risk classificationRead-only, modifying, destructive, or sensitive
Execution constraintsTimeout, resource limits, retry policy
IdempotencyWhether repeating the call is safe
Audit requirementsEvidence that must be recorded

Designing tools for agents​

Tools are an interface for a non-human caller, and their design strongly affects reliability.

  • Fewer, higher-level tools usually outperform many overlapping low-level ones. Consolidate operations that are always used together.
  • Clear names and descriptions matter. Describe the tool as you would to a new colleague, including when not to use it.
  • Unambiguous parameters. Prefer explicit identifiers and enumerations to free-form values.
  • Informative, bounded responses. Return what the agent needs to decide its next step, with sensible truncation and pagination so that results do not flood the context window.
  • Actionable errors. Error messages should tell the agent how to correct the call.
  • Safe defaults. Make the secure, narrow behavior the default; require explicit parameters for broader effects.
  • Evaluate tools empirically on realistic tasks and refine them based on observed agent failures.

MCP and the protocol landscape​

The Model Context Protocol (MCP) is an open standard for connecting agent applications to external tools, resources, and prompts. It reduces integration effort and is widely supported. Other protocols address adjacent concerns, such as agent-to-agent communication. Whatever protocol you use, remember:

MCP is an integration protocol, not an enterprise governance architecture.

An MCP-enabled harness still requires:

  • Approved server registration and named ownership.
  • Server and dependency verification, version pinning, and provenance checks.
  • Authentication and authorization, with per-user or per-task scoping rather than shared service credentials.
  • Tool-level permission enforcement.
  • Credential isolation from model context.
  • Input and output validation.
  • Network restrictions.
  • Monitoring and auditability.
  • Compatibility and change management, including detection of changed tool descriptions after approval.

Use MCP where interoperability delivers real value. Native APIs and local integrations remain valid, and often simpler, alternatives. Pay particular attention to tool-description and tool-output injection: text returned by a tool, or embedded in a tool's metadata, is untrusted input that may attempt to redirect the agent.


Engineering the Runtime and Execution Environment​

Runtime responsibilities​

The agent runtime manages the operational lifecycle of execution: session management, scheduling, concurrency, worker allocation, cancellation, resource limits, checkpoint coordination, and recovery.

Environment responsibilities​

The runtime environment establishes the security and resource boundary within which actions occur.

agent_runtime_execution_diagram

Figure 10. Runtime and execution-environment architecture.

Isolation models​

ModelAdvantagesLimitations
Local workstationFast interaction, minimal setupShared host, potentially broad local access
Isolated local workspaceBetter repository separationDirectory separation alone is not a security boundary
OS-level sandboxFilesystem and network restriction with low overheadDepends on host kernel and correct configuration
Container per taskRepeatable, flexibleRequires hardening; shares the host kernel
MicroVM or VM per taskStrong isolation for higher-risk workProvisioning cost and complexity
Managed remote sandboxReduced infrastructure effortProvider restrictions and trust dependencies
Dedicated project environmentSupports regulated or specialized workHigher cost, lower utilization

Choose according to workload risk, code sensitivity, privilege level, and operational needs. Effective sandboxing requires both filesystem isolation and network isolation: without network controls a compromised agent can exfiltrate data, and without filesystem controls it can tamper with its environment.

Permission models: from prompting to policy​

Interactive agents commonly ask a human to approve each sensitive action. At scale this leads to approval fatigue, where people stop reading prompts. Prefer a layered approach:

  1. Pre-approve low-risk, well-understood actions through policy.
  2. Sandbox the environment so that blast radius is bounded even when an action is wrongly permitted.
  3. Deny by default for destructive or out-of-scope actions.
  4. Escalate to a human only for genuinely high-impact decisions, with sufficient context to decide.

Disabling all permission checks should be reserved for strongly isolated, disposable environments with no sensitive credentials.

Workspace lifecycle​

engineering_task_lifecycle_diagram

Figure 11. Managed workspace lifecycle.

An ephemeral workspace must not imply ephemeral task state. Persist checkpoints and evidence outside the workspace.


Engineering Independent Verification​

Why agent self-verification is insufficient​

An agent may implement a change, write tests for its own implementation, run them, and report success. That does not establish that the change satisfies the original requirement. The agent may misread the specification, write incomplete tests, or optimize for a superficial completion signal.

Experience with agentic coding also documents more adversarial failure modes: weakening or deleting failing tests, special-casing test inputs, suppressing errors, or editing the checks themselves. These are best understood as reward hacking by an optimizer under pressure, not necessarily malice, and they are a property of the environment as much as of the model. The remedy is architectural.

Independent verification architecture​

verification_pipeline_diagram

Figure 12. Separation of implementation from authoritative verification.

Layers of verification​

LayerObjective
Syntax and compilationCandidate builds successfully
Unit testingIndividual behaviors are correct
Integration testingComponents interact correctly
Contract testingAPI and event contracts remain compatible
Acceptance testingOriginal business requirements are met
Architecture fitnessArchitectural constraints are satisfied
Security testingVulnerabilities and policy violations are identified
Performance testingRelevant performance characteristics hold
Resilience testingFailure handling and recovery behave as designed
Production validationThe released capability behaves as intended

Required layers depend on the risk and scope of the change.

Enforcing independence​

The verification subsystem should:

  • Protect authoritative acceptance criteria from modification by the implementing agent (for example, via code-owner rules, separate repositories, or read-only mounts).
  • Execute mandatory checks in a trusted environment the agent cannot influence.
  • Bind results to the exact candidate (commit or artifact digest).
  • Prevent agents from bypassing required checks, including by modifying CI configuration.
  • Require authorized human review when acceptance criteria change.
  • Preserve evidence outside agent-controlled workspaces.
  • Detect test tampering: flag diffs that delete tests, loosen assertions, add skips, or reduce coverage on changed code.
  • Use held-out checks that the implementing agent never sees, in addition to visible tests.

A separate reviewer agent can improve coverage, but is not inherently independent: shared context, model behavior, tools, or permissions can introduce correlated failures. LLM-based review is a useful additional signal, not a substitute for deterministic gates. Independence must be established by architectural and governance boundaries.

Architecture fitness functions​

Architecture fitness functions are executable mechanisms that assess whether software continues to satisfy architectural characteristics.

ConcernRepresentative fitness function
LayeringDetect prohibited dependencies between layers
Multi-tenant isolationVerify cross-tenant access is rejected
API compatibilityDetect breaking contract changes
Cloud securityDetect prohibited infrastructure configuration
ObservabilityVerify required telemetry conventions
ResilienceVerify timeouts and recovery configuration
Data privacyDetect sensitive-data exposure
ModularityDetect violations of component boundaries

A central Harness Engineering responsibility is converting recurring architectural violations into automated, enforceable checks. Where possible, write lint and check messages so that they teach the agent how to fix the violation; the error output becomes remediation context.

The human review bottleneck​

As agent throughput rises, human attention becomes the scarce resource. Design review to spend it where it matters:

  • Automate everything that can be decided mechanically.
  • Route changes by risk: low-risk changes pass on green gates; high-risk changes require focused human review.
  • Present reviewers with evidence summaries (what changed, what was verified, what was not) rather than raw diffs alone.
  • Keep changes small and well scoped; large agent-produced diffs are hard to review meaningfully.
  • Preserve accountability: a human who approves a change owns the outcome.

Architectural Design Patterns​

Select patterns according to the nature, complexity, and risk of the workload.

Pattern catalog​

PatternIntentTypical application
Bounded Agent LoopAdaptive execution within explicit limitsCoding and debugging
Plan–Execute–VerifySeparate planning, implementation, and verificationFeature implementation
Repository-Aware AgentSupply repository and architecture contextEnterprise codebases
Skill-Augmented AgentInject reusable procedures on demandRepeated domain tasks
Policy-Gated Tool ExecutionAuthorize actions outside the modelSensitive operations
Human-in-the-LoopInsert human judgment at risk-sensitive pointsArchitecture, production approvals
Checkpoint and ResumePreserve continuity across failures and sessionsLong-running tasks
Isolated WorkspaceContain blast radiusExecuting generated code
Evaluator–OptimizerIterate against defined criteriaQuality improvement
Independent VerifierEstablish trusted evidenceProduction-oriented delivery
Orchestrator–WorkerDelegate bounded subtasksComplex workloads
Evidence-Driven EvolutionTurn execution observations into improvementsPlatform evolution

Plan–Execute–Verify​

Problem. Complex objectives are hard to implement reliably in one unstructured session.

Solution. Establish a bounded plan, implement it, and verify the result independently.

objective_verifier_flow_diagram

Figure 13. Plan–Execute–Verify.

The pattern does not require three agents. The roles may be one agent, deterministic workflows, independent test systems, or any combination. Plans are most valuable when reviewed by a human before costly execution begins.

Trade-off. Greater control and visibility in exchange for added overhead.

Checkpoint and Resume​

Problem. Long-running tasks exceed session lifetimes or context limits.

Solution. Persist meaningful checkpoints and restore validated state on resumption.

session_durable_state_diagram

Figure 14. Checkpoint and Resume.

Trade-off. Recovery improves, but state consistency, idempotency, checkpoint validation, and retention become explicit concerns.

Policy-Gated Tool Execution​

Problem. A model may propose an action outside its approved scope.

Solution. Place a deterministic policy decision point between the agent and sensitive tools.

policy_decision_flow_diagram

Figure 15. Policy-Gated Tool Execution.

Trade-off. Security and auditability improve, but tools must expose enough semantic information to support meaningful authorization.

Evaluator–Optimizer​

Problem. A candidate does not initially meet quality criteria.

Solution. Evaluate, return structured feedback, and permit bounded corrective execution.

implementer_evaluator_gate_diagram

Figure 16. Evaluator–Optimizer.

Terminate when criteria are met, the budget is exhausted, progress stalls, or escalation is required.

Trade-off. Iteration can raise quality, but unbounded loops inflate cost, latency, and rework.

Orchestrator–Worker​

Problem. A complex task contains distinct subtasks that benefit from specialized or parallel execution.

Solution: Use isolated branches or workspaces, explicit interface contracts, controlled delegation, and integration verification.

orchestrator_workers_diagram

Figure 17. Orchestrator–Worker.

Trade-off. Throughput and specialization improve, at the cost of coordination, duplicated context, integration complexity, and additional failure modes. Do not introduce multi-agent orchestration merely because the technology permits it.

Pattern: Entropy Control (Continuous Cleanup)​

Problem. High-throughput agents replicate existing patterns, including poor ones, so inconsistency and drift accumulate faster than humans can correct.

Solution. Encode quality standards and "golden principles" in the repository, run recurring, automated cleanup tasks that scan for deviations, and open small, reviewable corrective changes. Treat technical-debt reduction as a continuous background process rather than an occasional project.

Trade-off. Additional automation and review load, in exchange for a codebase that remains legible to both agents and people.


Security, Governance, and Trust Architecture​

The harness as a privileged system​

A harness can reach proprietary source code, architecture documents, build environments, cloud APIs, internal tools, and deployment workflows. Treat it as a high-impact enterprise system, with the security rigor you would apply to a CI/CD platform.

The core threat model​

The most consequential risk pattern combines three conditions in one agent session:

  1. Access to private or sensitive data.
  2. Exposure to untrusted content (repository text, issues, web pages, tool output, dependencies).
  3. Ability to communicate externally or take consequential action.

When all three are present, injected instructions in untrusted content can cause data exfiltration or damaging actions. Design so that no single session holds all three unmitigated. Remove or constrain at least one: restrict egress, withhold sensitive data, or require approval for consequential actions.

RiskArchitectural mitigation
Prompt injection via repository, issues, web, or tool outputTreat retrieved content as untrusted data; enforce policy outside the model
Unauthorized tool invocationTool-level authorization and parameter validation
Credential exposureShort-lived credentials, credential brokering, secret scanning
Source-code exfiltrationEgress allowlists, data classification, approved model endpoints
Arbitrary code executionIsolated, hardened execution environments
Cross-project accessProject-scoped identity and workspace isolation
Supply-chain compromiseApproved dependencies, scanning, pinned versions, artifact provenance
Policy or hook tamperingProtected configuration enforced outside agent control
Verification bypassTrusted CI and protected quality gates
Runaway executionBudgets, rate limits, cancellation, kill switches
Malicious or compromised tools and skillsRegistration, review, version pinning, isolation
Excessive agencyLeast privilege, bounded autonomy, risk-based approvals

Align your threat modeling with recognized guidance, such as the OWASP work on agentic application risks, and with supply-chain frameworks such as SLSA for build provenance.

Trust boundaries​

enterprise_control_boundaries_diagram

Figure 18. Logical trust architecture.

Treat model-generated commands, code, retrieved documents, and external tool outputs as potentially untrusted. The model must never be the final authority over its own privileges.

Identity for agents​

Give agents their own workload identities rather than borrowing a human's credentials or a shared service account. Bind identity to the task, scope it to the required repositories and actions, make it short-lived, and ensure every action is attributable to a task, an agent configuration, and an accountable human.

Risk-based autonomy​

RiskRepresentative actionPolicy
LowRead approved repository filesAutomatically authorized within scope
ModerateModify files in an isolated workspaceAuthorized with resource and action boundaries
ElevatedOpen pull requests; propose infrastructure changeGoverned workflow plus verification
HighMerge protected changes; modify shared environmentsIndependent policy checks and appropriate approval
CriticalAlter production infrastructure or sensitive dataExplicit privileged workflow; prohibited by default for general coding agents

Authorization should depend on the specific action, identity, target resource, execution context, and organizational policy, not on the agent's confidence.


Reliability Engineering and Operational Resilience​

Failure modes​

A harness combines probabilistic model behavior with conventional distributed-systems failure modes. Engineer for both.

Failure modeRecommended response
Model invocation failureBounded retry, approved fallback, or escalation
Context retrieval failureReport missing context; do not proceed on unsupported assumptions
Tool timeoutRetry only when safe; reconcile the original action if its outcome is uncertain
Workspace failureRestore from durable state; recreate workspace
Context-window exhaustionCompact and resume from validated task state
Repeated implementation failureTerminate or escalate after bounded attempts
Verification failureReturn structured findings for correction
Policy violationDeny and record
Budget exhaustionSuspend or terminate
Conflicting parallel changesReconcile through controlled integration
Provider degradationReduce concurrency, queue work, or use approved alternatives
Stalled or looping agentDetect no-progress conditions; terminate or escalate

Reliability mechanisms​

Combine, as appropriate:

  • Timeouts and cancellation.
  • Bounded retries with backoff and jitter.
  • Circuit breakers.
  • Durable queues and execution state.
  • Checkpointing and recovery.
  • Idempotency keys and outcome reconciliation.
  • Concurrency limits and backpressure.
  • Resource budgets.
  • Dead-letter handling for failed asynchronous tasks.
  • Human escalation and runbooks.

Do not retry tool actions indiscriminately. An action may have succeeded even though its response was lost.

Reliability compounds multiplicatively​

Long tasks chain many steps. If each step succeeds with probability p, a chain of n steps succeeds with roughly pⁿ. A step that is 98% reliable still yields only about 13% end-to-end success across 100 steps. This arithmetic explains why shorter tasks, checkpoints, early error detection, and verification at intermediate points are so effective, and why per-step improvements matter more than they appear to.

Defining availability​

Distinguish the availability of the harness from the effectiveness of its agents. A harness can be fully available while agents repeatedly fail to complete tasks. Define separate objectives for platform availability, task admission, workspace provisioning, execution reliability, verification availability, and successful outcomes.


Evaluation Engineering​

Evaluate the system, not only the model​

Harness evaluation assesses the complete execution system rather than the model in isolation.

harness_evaluation_pipeline_diagram

Figure 19. Harness evaluation architecture.

Dimensions​

DimensionQuestion
Functional effectivenessDid the agent accomplish the approved task?
Context effectivenessDid it retrieve and apply relevant context?
Tool effectivenessDid it select and use tools correctly?
Architectural complianceDo the changes satisfy architectural constraints?
SecurityDid execution stay within authorized boundaries?
ReliabilityDid the harness recover appropriately from failure?
ContinuityWas progress preserved across sessions?
EfficiencyHow much time, compute, and cost were consumed?
Human interventionWhat intervention was needed, and why?
Verification integrityWas completion supported by trustworthy evidence?

Methodology​

Maintain a versioned benchmark of representative organizational tasks. For each candidate harness change:

  1. Establish the baseline configuration.
  2. Select representative tasks, including adversarial and failure scenarios.
  3. Run baseline and candidate under comparable conditions.
  4. Repeat runs. Agent behavior is stochastic; a single run proves little. Report variability, and distinguish can it ever succeed (pass@k) from does it succeed reliably (success on all k attempts), because production use depends on the latter.
  5. Compare correctness, security, reliability, and cost.
  6. Investigate regressions and correlated failures by reading transcripts, not only scores.
  7. Approve, reject, or refine.

Practices that protect evaluation validity:

  • Keep held-out tasks that are not exposed during optimization, to avoid overfitting the harness to the benchmark.
  • Grade outcomes (resulting state and artifacts) in preference to prescribing exact action sequences, but also inspect the path for unsafe or wasteful behavior.
  • Prefer deterministic graders; when using model-based graders, calibrate them against human judgment.
  • Isolate each trial from others; shared state causes correlated, misleading results.
  • Keep the benchmark alive: add a regression task for every significant production failure.
  • Do not let a higher success rate justify an unacceptable regression in security or verification integrity.

Model evaluation versus harness evaluation​

Model evaluationHarness evaluation
Assesses model capabilityAssesses complete system effectiveness
Tests reasoning and code generationTests task completion through real workflows
Focuses on responsesFocuses on artifacts, actions, and evidence
Measures inference characteristicsMeasures reliability and economics
Supports model selectionSupports architecture and configuration evolution

A powerful model in a poorly engineered harness can deliver less dependable outcomes than a more modest model in a well-engineered one.


Observability and Engineering Economics​

Observability architecture​

telemetry_observability_diagram

Figure 20. Harness observability architecture.

Model each task as a distributed trace: a root span for the task, child spans for model calls, tool calls, policy decisions, and verification steps. Where possible, adopt open telemetry standards, including emerging semantic conventions for generative-AI and agent telemetry, so that traces are portable across tools. Verify the maturity of those conventions in your environment, as they continue to evolve.

Minimum execution telemetry​

Capture appropriately redacted, access-controlled information about:

FieldPurpose
Task and execution identifiersCorrelate distributed activity
Repository and revisionIdentify the target
Harness and workflow versionsEstablish configuration
Model and skill identifiersAnalyze effectiveness
Context source referencesInvestigate missing or incorrect context
Tool calls and outcomesDiagnose action failures
Policy decisionsProvide authorization evidence
Verification resultsEstablish correctness
DurationAnalyze performance
Token and model usageAttribute inference cost
Workspace resource usageAttribute infrastructure cost
Human intervention eventsAssess operational dependence

Observability must not become a secondary store of confidential code, credentials, or sensitive data. Capture the evidence needed for investigation without assuming that unrestricted logging of prompts, repository content, or model output is acceptable. Apply redaction, retention limits, and access controls.

Harness effectiveness metrics​

KPIMeasurement
Task success rateIndependently accepted tasks ÷ attempted tasks
First-pass success rateTasks accepted without corrective iterations ÷ attempted tasks
Execution failure rateTasks ending in execution failure ÷ attempted tasks
Recovery success rateSuccessful recoveries ÷ recovery attempts
Human intervention rateTasks requiring intervention ÷ attempted tasks
Architecture compliance rateEvaluated changes satisfying applicable checks
Verification false-acceptance rateIncorrect candidates accepted by verification (estimated through audits and seeded defects)
Cost per successful taskTotal cost, including failed attempts, ÷ accepted tasks
Mean time to completionAverage elapsed time for successful tasks
Guardrail violation ratePolicy-violating attempts ÷ evaluated executions
Harness adoptionActive usage across eligible teams

Define the population precisely, including how cancelled, rejected, expired, and failed tasks are treated. Without consistent definitions, apparent productivity gains can be illusory.

Three levels of outcome​

LevelRepresentative measures
Harness effectivenessTask success, recovery, execution cost, policy compliance
Software delivery effectivenessLead time, deployment frequency, change failure rate, cost per delivered feature
Business valueAdoption, revenue contribution, operational savings, customer experience

Optimize the harness for its contribution to successful delivery, not for agent activity. Volume of generated code is a poor indicator of value; watch downstream measures such as change failure rate and rework.

Engineering economics​

Agent execution consumes tokens, compute, and human attention. Manage it deliberately:

  • Attribute cost per task, team, and workflow.
  • Use prompt and context caching where supported, and keep stable context prefixes stable.
  • Route routine work to lower-cost models when evaluation shows equivalent outcomes.
  • Cap spend per task and per team, and alert on anomalies.
  • Track cost per successful task, not merely cost per call; cheap failures are expensive.
  • Include verification and human review time in total cost.

Implementation Strategy: Adopt, Extend, Compose, or Build​

Options​

OptionDescriptionAppropriate when
AdoptUse an existing coding-agent harness with repository instructions and existing toolsEarly adoption, bounded workloads
ExtendAdd enterprise workflows, policy, context, verification, and integrations around an existing harnessMost enterprise environments
ComposeAssemble agent SDKs with enterprise platform componentsSpecialized execution or integration needs
BuildDevelop substantial custom capability, potentially including the loopRequirements that supported products cannot meet

For most organizations the preferred starting point is adopt and extend. Build foundational capability internally only when justified by explicit requirements, control needs, economics, or demonstrable gaps. Because the foundational layer is evolving rapidly, favor designs that keep your differentiating assets (context, skills, policies, verification, evaluations) portable across agent products and models.

Illustrative technology mapping​

CapabilityCandidate technologies
Foundational coding-agent harnessClaude Code, OpenAI Codex, other coding agents
Programmable agent integrationClaude Agent SDK, supported Codex interfaces
Custom orchestrationPython, LangGraph, Temporal, AWS Step Functions
Policy enforcementOpen Policy Agent, Cedar-based authorization
Tool integrationMCP servers, native APIs, controlled adapters
Context retrievalGit, code-search indexes, document retrieval
Task and statePostgreSQL, Amazon DynamoDB
Execution isolationHardened containers, microVMs, managed sandboxes
Workload orchestrationAmazon ECS, Amazon EKS, AWS Batch
Model accessProvider APIs, Amazon Bedrock where applicable
SecretsAWS Secrets Manager, enterprise secret platforms
VerificationLanguage test frameworks, contract and architecture testing tools
CI/CDGitHub Actions, GitLab CI/CD, Jenkins, AWS CodePipeline
ObservabilityOpenTelemetry, Amazon CloudWatch, enterprise platforms
Infrastructure as codeTerraform, AWS CDK, CloudFormation

These are candidates, not a validated compatibility matrix. Confirm supported interfaces, deployment constraints, licensing, security controls, and model-provider compatibility before committing.


Illustrative AWS Deployment Architecture​

Assumptions​

An organization establishes a centralized engineering harness with isolated remote workspaces and integration with an existing Git-based delivery platform. It requires authenticated access, durable task execution, controlled model access, isolated workspaces, centralized observability, and independent verification.

aws_agent_harness_architecture_diagram

Figure 21. Illustrative AWS deployment architecture.

Component responsibilities​

ComponentResponsibility
API Gateway or ALBExpose the harness service interface
ECS or LambdaHost task APIs and control-plane services
DynamoDB or PostgreSQLPersist task metadata, registries, execution state
SQSBuffer asynchronous tasks
EventBridgeRoute lifecycle and operational events
ECS/EKS workers or sandbox serviceHost agent execution environments
Amazon S3Persist artifacts, checkpoints, evidence
IAM and Secrets ManagerIdentity and credential controls
AWS KMSManage encryption keys
CloudWatch and OpenTelemetryOperational telemetry
CloudTrailSupported AWS API audit events, supplemented by application-level audit

19.3. Deployment guidance​

  • Separate harness execution privileges from production application privileges, ideally in separate accounts.
  • Use workload-specific, short-lived identities.
  • Restrict outbound network access from agent workspaces to an allowlist (package mirrors, the model gateway, approved tool endpoints).
  • Permit model access only through approved connectivity.
  • Keep authoritative verification outside agent-controlled environments, with write access to the evidence store granted only to the verification pipeline.
  • Scope artifact storage permissions per task.
  • Integrate through controlled CI/CD rather than broad production access.
  • Scale execution workers independently from control-plane services.
  • Define backup and recovery objectives for durable harness state.

This deployment is illustrative. It is not a tested implementation or a security certification.


Engineering the Harness Repository​

Logical structure​

The harness is a software product and needs its own architecture, repositories, tests, infrastructure definitions, and lifecycle.

enterprise-agentic-harness/
|-- apps/
| |-- engineering-portal/
| |-- harness-api/
| +-- developer-cli/
|-- core/
| |-- task-management/
| |-- orchestration/
| |-- execution-control/
| |-- context-management/
| |-- state-management/
| +-- checkpointing/
|-- integrations/
| |-- coding-agents/
| |-- model-providers/
| |-- source-control/
| |-- mcp/
| |-- ci-cd/
| +-- cloud-services/
|-- agents/
|-- skills/
|-- workflows/
|-- policies/
|-- runtime/
| |-- workspace-provisioning/
| |-- sandbox-images/
| +-- execution-workers/
|-- verification/
| |-- acceptance/
| |-- architecture-fitness/
| |-- security/
| +-- evidence/
|-- evaluations/
| |-- benchmark-tasks/
| |-- regression-suites/
| +-- adversarial-tests/
|-- infrastructure/
|-- observability/
|-- tests/
|-- configuration/
|-- docs/
+-- ci/

Figure 22. Illustrative harness repository organization.

This is a logical starting point, not a prescription for separately deployable services or a particular language. Keep verification/ and policies/ under stricter change control (code owners, mandatory review) than the rest.

Configuration management​

Version every material dependency of execution behavior.

ArtifactWhy versioning matters
Agent configurationControls behavior
Model configurationInfluences reasoning, cost, capability
SkillsChanges reusable behavior
WorkflowsChanges sequencing and decisions
Tool contractsChanges action semantics
Policies and hooksChanges authorization and governance
Runtime imagesChanges execution dependencies
Context configurationChanges available knowledge
Evaluation datasetsChanges regression assessment
Verification profilesChanges evidence required for completion

Treat a harness release as a coordinated version of all these artifacts, not just of the application binary, and record the release identifier in every task's telemetry so that any outcome can be traced to the exact configuration that produced it.


The Harness Development and Deployment Lifecycle​

Lifecycle​

The harness has its own SDLC, separate from that of the applications it helps deliver.

harness_release_lifecycle_diagram

Figure 23. Harness Engineering lifecycle.

Harness CI/CD​

StageActivities
Source validationCode quality, dependency checks, configuration validation
Unit testingTest deterministic components
Integration testingVerify model, tool, repository, and runtime integrations
Policy testingVerify permitted and prohibited scenarios
Security testingTest isolation, authorization, credentials, tool boundaries, injection resistance
Agent evaluationRun representative benchmark tasks with repeated trials
Regression evaluationCompare with the approved baseline
Artifact publicationPublish versioned, traceable artifacts
Release approvalReview regressions and operational risk
Progressive rolloutRelease to selected repositories or teams first
Operational validationMonitor effectiveness, failures, cost, and policy decisions

Two delivery pipelines​

harness_and_business_pipelines_diagram

Figure 24. Separation of the harness lifecycle from the application lifecycle.

Harness changes must never unintentionally weaken the delivery controls of the applications built through it.


Phased Implementation Roadmap​

Build incrementally. Avoid a large platform program before demonstrating useful outcomes on representative tasks.

PhaseObjectiveKey activitiesExit criteria
1. Foundation and controlled executionA working, governed harness for one bounded use caseAdopt an existing coding-agent harness; approved repository access; concise context instructions; isolated execution; source-control integration; independent test executionRepresentative tasks complete repeatedly, produce verifiable artifacts, and stay within boundaries
2. Standardization and reuseReusable enterprise capabilitiesShared skills, context standards, approved workflows, execution contracts, reusable fitness functions, central configurationMultiple workloads reuse governed capabilities with little customization
3. Evaluation and reliabilityMeasurable, dependable executionDurable checkpoints, recovery, evaluation datasets, regression suites, tracing, failure classification, cost attributionRegressions are detected; failures investigated; eligible tasks recovered; cost per successful task measured
4. Enterprise platformizationMulti-team shared platformCentral control plane, repository registration, workload isolation, quotas, approved tool catalog, shared observability, governed releasesConcurrent workloads run with defined ownership, boundaries, and service objectives
5. Continuous optimizationEvidence-driven evolutionOptimize retrieval, workflows, skills, model choices, verification, utilization, adoption; retire obsolete scaffoldingImprovements are evaluated, versioned, progressively released, and tied to better outcomes

Harness maturity model​

LevelMaturityDefining characteristics
L1AssistedIndividuals use coding assistants and agents
L2StructuredRepository instructions, reusable workflows, basic verification
L3GovernedExecution contracts, policies, isolation, independent verification
L4IndustrializedShared platform, evaluations, observability, scalable execution
L5Continuously evolvingExecution evidence systematically drives evaluated improvements

This is a proposed planning model, not a standardized industry classification.


Practical Example: A Harness for a Multi-Tenant SaaS Platform​

Consider an engineering organization building an enterprise SaaS platform on AWS. Teams need reusable agentic capabilities across frontend applications, microservices, databases, infrastructure, and integration layers.

RequirementHarness capability
Agents must understand the SaaS architectureVersioned architecture context and ADR retrieval
Agents must follow tenant-isolation principlesTenant-aware skills and fitness functions
API changes must stay compatibleAPI contract validation
Infrastructure must meet AWS security standardsInfrastructure policy and security verification
Many tasks must run concurrentlyIsolated workspaces and concurrency controls
Long tasks must survive interruptionDurable state and checkpoints
Changes must satisfy requirementsIndependent acceptance verification
Cloud actions must be restrictedScoped identities and governed tool execution
Failures must be diagnosableCorrelated execution telemetry
Recurring defects must improve future deliveryEvaluation and improvement workflows

A representative failure​

Suppose agents repeatedly generate repository queries that omit tenant filtering.

Fixing each query is software development. Preventing the class of defect from recurring across all future tasks is Harness Engineering.

tenant_isolation_improvement_loop_diagram

Figure 25. Converting a recurring defect into a reusable harness capability.

A concrete implementation might: document the isolation rule in the architecture context; add a short skill describing the approved data-access pattern; add a static check that flags queries on tenant-scoped tables without a tenant predicate (with an error message that states the correct pattern); add a protected cross-tenant integration test to the verification suite; and add the original failing scenarios to the regression benchmark. This is how Harness Engineering creates compounding value.


Evidence-Driven Harness Evolution​

Continuous improvement architecture​

The harness must not remain static while workloads, models, technologies, and requirements evolve.

harness_improvement_loop

Figure 26. Evidence-driven evolution of the harness and AI-Native SDLC.

Failure classification and corrective ownership​

Observed failureLikely corrective owner
Incorrect business requirementProduct and requirements engineering
Ambiguous acceptance criteriaAI-Native SDLC and feature team
Missing architectural knowledgeContext and knowledge engineering
Inappropriate tool selectionHarness orchestration or tool engineering
Excessive iterationsHarness execution and model engineering
Insecure tool actionSecurity and policy engineering
Inadequate verificationVerification engineering
Infrastructure failureRuntime and platform engineering
Application-specific defectProduct engineering
Recurring cross-project architectural defectArchitecture governance and Harness Engineering

A failure should not automatically produce a new prompt or skill. First determine whether the deficiency lies in the application, specification, process, model, context, tool, or harness architecture. Resist accumulating instructions: every addition costs context and can conflict with others, so prefer a mechanical check or a structural fix over another paragraph of guidance.

Pruning​

Evolution includes removal. Periodically test whether each harness component still earns its place by evaluating performance with and without it, especially after a model upgrade. Retire scaffolding, instructions, and skills that no longer improve outcomes.

Governed improvement principle​

Agents may propose improvements to their own environment. Changes to privileged controls, verification mechanisms, permissions, and authoritative policy must remain subject to independent evaluation and authorized release management.

The harness should learn through evidence, not through uncontrolled self-modification.


The Harness Engineering Operating Model​

The harness as an internal product​

A shared enterprise harness needs identifiable customers, a product vision, architectural ownership, a roadmap, service objectives, a support model, and an improvement backlog.

Capability areaPrimary accountability
Harness strategyHead of AI Engineering or accountable platform leader
Reference architecturePrincipal AI Architect / Harness Architect
Control plane and runtimePlatform Engineering
Agent execution and workflowsHarness Engineering
Context and knowledgeContext Engineering and domain owners
Reusable skillsHarness and product engineering specialists
Tool integrationIntegration and Platform Engineering
EvaluationAgent Evaluation Engineering
VerificationQuality Engineering and Architecture Governance
SecuritySecurity Engineering and Platform Security
Production operationsPlatform Operations / SRE
AdoptionEngineering leadership and enablement

These are responsibility areas, not necessarily separate teams or job titles. In smaller organizations one team may hold several.

Responsibilities of the Head of AI Engineering​

The Head of AI Engineering establishes and governs:

  • Harness strategy and investment priorities.
  • The enterprise reference architecture.
  • Build-versus-adopt decisions.
  • Standards for reusable engineering capability.
  • Model, context, skill, and tool governance.
  • Security and execution boundaries.
  • Evaluation and independent verification frameworks.
  • Reliability and operational objectives.
  • Engineering economics and adoption measures.
  • Maturity and continuous evolution.

The goal is an enduring engineering capability, not a collection of disconnected experiments.

Evolving the engineer's role​

As agents take on implementation, the human engineer's weight shifts toward specifying intent, designing environments, defining acceptance criteria, reviewing evidence, and making architectural and risk decisions. Plan for training, new review practices, and revised career paths, and treat these as part of the harness rollout rather than as afterthoughts.


Architectural Anti-Patterns​

Anti-patternWhy it failsAlternative
Prompt-only harnessInstructions cannot enforce operational constraintsCombine instructions with executable controls
Unbounded autonomyUnpredictable execution, cost, and riskExecution contracts and budgets
Multi-agent by defaultUnneeded coordination complexityStart with the simplest effective topology
Monolithic context or giant instruction fileCrowds out task information; goes staleShort entry points, progressive disclosure, retrieval
Agent self-certificationImplementation and verification failures correlateIndependent verification
Agent-editable guardrailsThe agent can disable its own controlsProtect policy, hooks, tests, and CI outside agent control
Shared privileged credentialsExpands blast radiusScoped, short-lived, task-bound identity
Approval fatigueHumans click through constant promptsSandboxing plus policy; escalate only high-impact actions
Persistent unrestricted workspacesAccumulates sensitive state and driftControlled workspaces; durable external checkpoints
Unversioned skills and promptsRegressions are untraceableVersion and evaluate all execution configuration
Unvetted third-party tools and skillsSupply-chain and injection exposureRegistration, review, pinning, scanning
Agent-controlled production deploymentWeakens release controlsAuthorized CI/CD workflows
Evaluating only the modelIgnores context, tool, runtime, and verification failuresEvaluate the complete harness
Single-run evaluationStochastic behavior hides unreliabilityRepeated trials; report variance
Measuring generated code volumeConfuses activity with deliveryMeasure accepted outcomes and economics
Never pruning scaffoldingObsolete workarounds degrade newer modelsPeriodic ablation testing
Building everything internallyCost and delayAdopt foundations; extend selectively
Harness as a one-time projectCapability and policy decayManage as a continuously evolving product

Production Readiness Checklist​

Architecture and execution​

  • Architectural boundaries and component responsibilities are documented.
  • Approved workloads and autonomy levels are defined.
  • Execution contracts and termination conditions exist.
  • Model, context, skill, and tool integrations are validated.
  • Execution environments are isolated at filesystem and network level.
  • Session continuity and recovery are implemented where required.

Security and governance​

  • User and workload identities are governed.
  • Least-privilege tool authorization is enforced.
  • Credentials are scoped, short-lived, and kept out of model context and logs.
  • Prompt injection and untrusted-content risks are assessed, including tool descriptions and outputs.
  • No session combines sensitive data, untrusted input, and unrestricted external action without mitigation.
  • Repository and environment boundaries are tested.
  • Sensitive actions require appropriate authorization.
  • Agents cannot modify authoritative policy, hooks, tests, or CI configuration.
  • Third-party tools, MCP servers, and skills are reviewed and pinned.

Evaluation and verification​

  • Representative evaluation tasks, including adversarial cases, exist.
  • Baseline performance is measured with repeated trials.
  • Held-out tasks are maintained.
  • Independent verification is operational and protected from agent modification.
  • Test-tampering detection is in place.
  • Fitness functions exist where applicable.
  • Regression evaluation gates harness releases.
  • Verification evidence is bound to exact candidate artifacts.

Reliability and operations​

  • Execution budgets and resource limits are enforced.
  • Timeouts, cancellation, no-progress detection, and recovery are validated.
  • Telemetry and audit evidence are available and appropriately redacted.
  • Concurrency and contention are assessed.
  • Backup, recovery, and runbooks are established.
  • Incident ownership and escalation paths are defined.

Lifecycle and adoption​

  • Harness components and configuration are versioned together.
  • Harness CI/CD and progressive rollout operate.
  • Engineers are trained, and review practices are updated.
  • Ownership and support responsibilities are defined.
  • Effectiveness and economics are measured.
  • A governed improvement process, including pruning, exists.

This checklist is a readiness framework, not a substitute for workload-specific threat modeling, operational testing, or regulatory assessment.


Conclusion: Engineering Reliability Around Intelligence​

The Agentic AI Harness is an important architectural evolution in software engineering. Its purpose is not to give agents more tools, larger windows, or more powerful models. It is to establish a system in which model intelligence becomes controlled action, verifiable artifacts, dependable execution, and measurable outcomes.

Its essential capabilities are:

  • Context that makes the engineering environment understandable.
  • Orchestration that makes complex execution manageable.
  • Tools that make authorized action possible.
  • Runtime environments that make execution controlled and recoverable.
  • Policies that define acceptable boundaries.
  • Verification that produces trustworthy evidence.
  • Observability that makes execution diagnosable.
  • Evaluation that makes effectiveness measurable.
  • Feedback mechanisms that make continuous improvement possible.

Harness Engineering is not an extension of prompt engineering or agent development. It is a multidisciplinary specialization concerned with the architecture, construction, governance, operation, and evolution of the systems through which AI agents perform engineering work. A well-run harness grows more effective as the organization learns from its execution history, recurring failures, architectural deviations, and successful delivery patterns.

The fundamental philosophy:

The model provides intelligence. The agent provides task-oriented agency. The harness provides the controlled execution system. Independent verification provides evidence of correctness. Human engineers retain accountability for the outcome.

Engineering the harness is the first half of the AI-native software engineering transformation. The second half is learning to deliver complete business features through that harness in a disciplined, governed, and measurable way.


Key Takeaways​

  1. The model is necessary but not sufficient; reliability comes from the surrounding system.
  2. Distinguish model, agent, harness, runtime, and environment, and give every control an owner other than the model.
  3. Instructions shape behavior; deterministic controls bound it.
  4. Separate the plane that does the work from the planes that authorize and judge it.
  5. Treat context as a scarce, governed resource; make the repository the system of record.
  6. Externalize progress so long tasks survive context resets and interruptions.
  7. Independent verification must be protected from the implementing agent, including against test tampering and reward hacking.
  8. Do not combine sensitive data, untrusted input, and unrestricted external action in one session.
  9. Evaluate the whole harness with repeated trials, held-out tasks, and transcript review.
  10. Adopt and extend before you build, keep differentiating assets portable, and prune scaffolding as models improve.

Glossary​

TermDefinition
Agent harnessThe software that wraps a model with an execution loop, context assembly, tool dispatch, and controls.
Agent skillA packaged, versioned set of instructions and resources for a recurring task, loaded on demand.
Architecture fitness functionAn executable check that an architectural characteristic still holds.
CompactionSummarizing accumulated context to continue work within window limits.
Control planeThe trusted components that decide what execution is permitted.
Execution contractA machine-readable specification of a task's scope, permissions, budgets, and success criteria.
HookDeterministic code executed at defined points in an agent's lifecycle.
MCPModel Context Protocol, an open standard for connecting agent applications to tools and resources.
Reward hackingAn agent satisfying a measurable completion signal without achieving the intended goal.
Runtime environmentThe isolated compute, filesystem, and network boundary in which agent actions occur.
SubagentA delegated agent instance with its own context and, optionally, restricted tools.
Verification planeThe trusted components that independently determine whether a candidate change satisfies requirements.

Continue the Learning Journey​

Delivering with the Agentic AI Harness: An End-to-End Feature Delivery Playbook​

Explore how engineering teams use the deployed harness across the AI-Native SDLC: from business requirements and specification-driven development to solution architecture, agentic implementation, independent verification, controlled deployment, and production operations.

Continue to Delivering with the Agentic AI Harness


Further Reading​

  1. OpenAI. Harness Engineering: Leveraging Codex in an Agent-First World.
  2. OpenAI. Unlocking the Codex Harness: How We Built the App Server.
  3. Anthropic. Effective Harnesses for Long-Running Agents.
  4. Anthropic. Building Effective Agents.
  5. Anthropic. Harness Design for Long-Running Application Development.
  6. OWASP. Top 10 for Agentic Applications.
  7. SLSA. Build Provenance.
  8. Model Context Protocol. Specification and security best-practice documentation (modelcontextprotocol.io).

Engineer the harness. Deliver through the harness. Improve both through evidence.