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:
- Distinguish the model, agent, harness, runtime, and runtime environment, and assign each a clear architectural responsibility.
- Apply a set of architectural principles and non-negotiable controls to any harness design.
- Design a harness reference architecture with a control plane, an execution plane, and an independent verification plane.
- Engineer context, skills, tools, and Model Context Protocol (MCP) integrations as governed enterprise capabilities.
- Select an execution isolation model and a trust architecture proportionate to workload risk.
- Design durable, recoverable execution for long-running tasks.
- Build independent verification that an implementing agent cannot weaken, bypass, or game.
- Evaluate, observe, and economically manage a harness as a product.
- 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
| Dimension | Conventional coding assistance | Agentic engineering harness |
|---|---|---|
| Unit of work | Code suggestion or edit | Bounded engineering task or feature |
| Execution | Human-driven | Human-directed, agent-executed |
| Context | Editor and open files | Repository, architecture, specifications, enterprise knowledge |
| Planning | Primarily human | Human–agent collaboration |
| Tool interaction | Limited, manually initiated | Governed, multi-step tool execution |
| Verification | External to the assistant | Integrated with independent verification systems |
| Continuity | Single interaction | Durable task state and checkpoints |
| Governance | Individual developer settings | Enterprise policy and execution boundaries |
| Accountability | Human engineer | Human 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:
| Term | Meaning |
|---|---|
| Harness Engineering | The discipline that builds, evaluates, and evolves the harness. |
| Agentic AI Harness | The technical system that surrounds models and agents with execution controls. |
| AI-Native SDLC | The process framework that governs how work flows through humans and agents. |
| AI-Native Software Development | The application of the harness and SDLC to deliver business software. |
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.
- 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.
- 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.
- 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.
| Concept | Architectural responsibility |
|---|---|
| AI model | Provides inference, language understanding, reasoning, and structured action proposals. |
| AI agent | A task-oriented entity that uses a model, context, and tools to pursue an objective. |
| Agent harness | Implements the execution loop, context assembly, tool dispatch, state coordination, and execution controls around the model. |
| Agent runtime | Hosts and manages execution: lifecycle, sessions, concurrency, scheduling, and resource allocation. |
| Runtime environment | Provides the actual execution boundary: compute, filesystem, network, isolation, and scoped credentials. |
| Enterprise harness | Extends a foundational harness with enterprise workflows, policy, verification, integrations, and operational management. |
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 capability | Enterprise extension |
|---|---|
| Agent execution loop | Governed engineering workflows |
| Local repository access | Repository registration and access policy |
| Tool invocation | Approved tool catalog and credential brokerage |
| Session state | Durable task management and recovery |
| Repository instruction files | Enterprise architecture and knowledge management |
| Local command execution | Isolated, policy-controlled environments |
| Agent-written tests | Independent verification infrastructure |
| Execution logs | Centralized observability and auditability |
| Model integration | Model 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
| Principle | Prescriptive guidance |
|---|---|
| Human accountability | Assign an accountable human owner to every objective, risk decision, and delivered outcome. |
| Intent before execution | Establish objective, constraints, acceptance criteria, and scope before significant modification begins. |
| Context as infrastructure | Manage engineering context as a versioned, governed, reusable capability. |
| Repository as system of record | Whatever an agent must know must be discoverable in the repository or governed sources it can reach, not in transient conversations. |
| Least-privilege execution | Grant only the repository, tool, environment, and action permissions the task requires. |
| Bounded autonomy | Limit execution by time, tokens, cost, iterations, actions, and permissions. |
| Deterministic control | Implement authorization, policy, and quality gates in trusted software, not in model judgment alone. |
| Independent verification | Verify results using criteria and mechanisms the implementing agent cannot unilaterally alter. |
| Durable execution | Preserve progress and support recovery from interruption or failure. |
| Architecture by enforcement | Convert important architectural constraints into machine-executable checks wherever feasible. |
| Observability by design | Capture enough evidence to investigate decisions, actions, failures, and outcomes. |
| Progressive complexity | Add models, agents, services, and orchestration only when demonstrated requirements justify them. |
| Continuous evolution | Convert recurring failures into governed, reusable harness improvements. |
Architectural non-negotiables
Every production-grade enterprise harness must establish controls ensuring that:
- Agents cannot grant themselves additional permissions.
- Agents cannot unilaterally change the controls that govern their execution.
- Agent-reported success is never sufficient evidence of completion.
- Credentials are not exposed to model context, execution logs, or generated artifacts.
- Agent-generated code remains subject to software supply-chain controls.
- Production actions remain subject to established release and operational policy.
- Execution has explicit termination and escalation conditions.
- Harness changes are evaluated and versioned before wider adoption.
- 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
| Workload | Representative activities | Recommended initial autonomy |
|---|---|---|
| Repository exploration | Code comprehension, dependency analysis, documentation discovery | Read-only |
| Documentation | Generate or update technical documentation | Bounded write |
| Software maintenance | Fix defects, update libraries, refactor modules | Bounded write with verification |
| Feature implementation | Change application components against a specification | Governed multi-step execution |
| Application modernization | Coordinate changes across legacy and target architectures | Supervised execution |
| Architecture analysis | Assess dependencies, constraints, and alternatives | Read-only; human owns the decision |
| Testing | Generate tests, run suites, investigate failures | Isolated execution |
| Infrastructure engineering | Generate and validate infrastructure-as-code changes | Restricted execution with approvals |
| Production engineering | Analyze incidents and propose remediation | Read-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 group | Functional requirements |
|---|---|
| Task management | Submission, classification, assignment, lifecycle management |
| Context management | Repository discovery, retrieval, instruction assembly |
| Agent execution | Planning, tool invocation, iteration, delegation, termination |
| Model management | Selection, invocation, fallback, configuration |
| Tool management | Discovery, authorization, validation, execution |
| Workspace management | Provisioning, isolation, dependency setup, cleanup |
| State management | Sessions, checkpoints, progress, recovery |
| Verification | Test execution, architecture validation, evidence collection |
| Governance | Policies, approvals, permissions, restrictions |
| Delivery integration | Source control, pull requests, CI/CD, artifact management |
| Operations | Tracing, metrics, alerts, diagnostics, administration |
| Evaluation | Benchmark execution, regression testing, capability assessment |
Non-functional requirements
| Quality attribute | Illustrative requirement |
|---|---|
| Security | No unauthorized repository, network, or production access. |
| Isolation | Separate execution boundaries for concurrent tasks. |
| Reliability | Resume interrupted tasks from durable checkpoints where supported. |
| Scalability | Support growing concurrent workloads without uncontrolled contention. |
| Availability | Service objectives appropriate to engineering criticality. |
| Auditability | Correlate material tool actions, policy decisions, approvals, and artifacts. |
| Maintainability | Version workflows, skills, instructions, tools, policies, and evaluations. |
| Extensibility | Introduce approved tools and workflows without modifying unrelated components. |
| Cost efficiency | Enforce execution budgets; monitor cost per successful task. |
| Privacy | Protect source code, intellectual property, credentials, and sensitive data. |
| Interoperability | Integrate with existing repositories, identity providers, and delivery systems. |
| Recoverability | Restore 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.
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.
| Plane | Contains | Trust level |
|---|---|---|
| Control plane | Identity, policy, registries, admission, approvals, budgets | Fully trusted; not modifiable by agents |
| Execution plane | Agent loop, workspaces, tools, model calls | Constrained; treated as potentially compromised |
| Verification plane | Protected tests, policy checks, evidence store | Trusted; 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.
Figure 4. Control-plane and execution-plane responsibilities.
Core components
| Component | Primary responsibility |
|---|---|
| Repository Registry | Approved repositories, owners, context sources, access boundaries |
| Agent Registry | Approved agent configurations, capabilities, versions |
| Skill Registry | Reusable, versioned engineering skills |
| Workflow Registry | Approved workflows and execution definitions |
| Tool Registry | Approved tool definitions, capabilities, risk classes |
| Task Management Service | Accept, classify, schedule, and track tasks |
| Policy Management | Execution constraints, authorization rules, prohibited actions |
| Approval Service | Risk-based human approvals and exceptions |
| Model Configuration | Approved models, routing rules, inference constraints |
| Quota Management | Concurrency, 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:
- Trusted enforcement. The contract must be validated and enforced by trusted harness components. Stating constraints in a prompt does not establish a security boundary.
- Protected verification paths. The contract names files and pipelines the implementing agent may not modify.
- 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.
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 model | Appropriate use |
|---|---|
| Deterministic workflow | Mandatory checks, approval gates, build pipelines, publication |
| Single-agent execution | Bounded implementation, debugging, code exploration |
| Sequential agent workflow | Specification analysis → implementation → review → verification |
| Parallel execution | Independent analyses or isolated subtasks |
| Multi-agent orchestration | Workloads needing specialization or distinct contexts |
| Human–agent workflow | Ambiguous objectives, architectural decisions, sensitive change |
Task lifecycle
A harness must give tasks explicit lifecycle semantics.
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 point | Representative use |
|---|---|
| Session start | Inject trusted context; verify environment and policy version |
| Pre-tool-use | Block disallowed commands or paths; validate parameters; require approval |
| Post-tool-use | Run formatters and linters; record evidence; scan output for secrets |
| On completion claim | Trigger independent verification before accepting "done" |
| Pre-compaction | Persist 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.
- Context isolation. A subagent explores a large codebase or reads many files and returns a concise summary, keeping the parent's context uncluttered.
- 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.
Figure 7. Enterprise context engineering architecture.
Context classification
| Category | Representative content | Preferred source |
|---|---|---|
| Enterprise | Security policy, enterprise standards | Governed knowledge repositories |
| Domain | Business rules, terminology, domain models | Product and domain documentation |
| Architecture | ADRs, system boundaries, contracts | Architecture repositories |
| Repository | Code, tests, dependency graphs | Source control |
| Task | Requirements, acceptance criteria | Specifications and task systems |
| Execution | Tool results, errors, progress | Execution state and telemetry |
| Operational | Runbooks, incidents, service dependencies | Operational knowledge systems |
Principles for context management
The context subsystem should:
- Retrieve relevant context rather than loading entire repositories.
- Attach source references and versions to material context.
- Enforce access policy before retrieving sensitive information.
- Separate trusted organizational instructions from untrusted retrieved content.
- Prioritize task-specific and repository-specific constraints.
- Detect missing, conflicting, or stale guidance.
- Manage window limits through retrieval, summarization, and selective loading.
- 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.
| Skill | Purpose |
|---|---|
| API Design | Apply enterprise API conventions and contract requirements |
| AWS Architecture | Apply approved AWS architecture patterns |
| Tenant Isolation | Implement and assess multi-tenant security constraints |
| Database Migration | Generate and validate safe schema changes |
| Test Engineering | Create appropriate unit, integration, and regression tests |
| Security Review | Apply approved threat-modeling and review procedures |
| Architecture Review | Assess implementation against architectural decisions |
| Observability | Apply 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.
Figure 8. Logical model integration architecture.
Selection strategy
| Engineering task | Selection priority |
|---|---|
| Architecture analysis | Reasoning quality, context comprehension |
| Complex feature implementation | Coding quality, reliable tool use |
| Repository exploration | Context comprehension, latency |
| Documentation | Instruction following, cost |
| Test generation | Code understanding, precision |
| Code review | Defect identification, evidence quality |
| Classification and routing | Latency, 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
Figure 9. Governed tool execution architecture.
Tool contracts
| Contract element | Description |
|---|---|
| Identity | Unique identifier and version |
| Purpose | Supported operation |
| Input schema | Validated parameters and constraints |
| Output schema | Structured results and failure conditions |
| Side effects | Resources or state the tool may modify |
| Authorization | Required identities, permissions, and scopes |
| Risk classification | Read-only, modifying, destructive, or sensitive |
| Execution constraints | Timeout, resource limits, retry policy |
| Idempotency | Whether repeating the call is safe |
| Audit requirements | Evidence 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.
Figure 10. Runtime and execution-environment architecture.
Isolation models
| Model | Advantages | Limitations |
|---|---|---|
| Local workstation | Fast interaction, minimal setup | Shared host, potentially broad local access |
| Isolated local workspace | Better repository separation | Directory separation alone is not a security boundary |
| OS-level sandbox | Filesystem and network restriction with low overhead | Depends on host kernel and correct configuration |
| Container per task | Repeatable, flexible | Requires hardening; shares the host kernel |
| MicroVM or VM per task | Strong isolation for higher-risk work | Provisioning cost and complexity |
| Managed remote sandbox | Reduced infrastructure effort | Provider restrictions and trust dependencies |
| Dedicated project environment | Supports regulated or specialized work | Higher 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:
- Pre-approve low-risk, well-understood actions through policy.
- Sandbox the environment so that blast radius is bounded even when an action is wrongly permitted.
- Deny by default for destructive or out-of-scope actions.
- 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
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
Figure 12. Separation of implementation from authoritative verification.
Layers of verification
| Layer | Objective |
|---|---|
| Syntax and compilation | Candidate builds successfully |
| Unit testing | Individual behaviors are correct |
| Integration testing | Components interact correctly |
| Contract testing | API and event contracts remain compatible |
| Acceptance testing | Original business requirements are met |
| Architecture fitness | Architectural constraints are satisfied |
| Security testing | Vulnerabilities and policy violations are identified |
| Performance testing | Relevant performance characteristics hold |
| Resilience testing | Failure handling and recovery behave as designed |
| Production validation | The 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.
| Concern | Representative fitness function |
|---|---|
| Layering | Detect prohibited dependencies between layers |
| Multi-tenant isolation | Verify cross-tenant access is rejected |
| API compatibility | Detect breaking contract changes |
| Cloud security | Detect prohibited infrastructure configuration |
| Observability | Verify required telemetry conventions |
| Resilience | Verify timeouts and recovery configuration |
| Data privacy | Detect sensitive-data exposure |
| Modularity | Detect 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
| Pattern | Intent | Typical application |
|---|---|---|
| Bounded Agent Loop | Adaptive execution within explicit limits | Coding and debugging |
| Plan–Execute–Verify | Separate planning, implementation, and verification | Feature implementation |
| Repository-Aware Agent | Supply repository and architecture context | Enterprise codebases |
| Skill-Augmented Agent | Inject reusable procedures on demand | Repeated domain tasks |
| Policy-Gated Tool Execution | Authorize actions outside the model | Sensitive operations |
| Human-in-the-Loop | Insert human judgment at risk-sensitive points | Architecture, production approvals |
| Checkpoint and Resume | Preserve continuity across failures and sessions | Long-running tasks |
| Isolated Workspace | Contain blast radius | Executing generated code |
| Evaluator–Optimizer | Iterate against defined criteria | Quality improvement |
| Independent Verifier | Establish trusted evidence | Production-oriented delivery |
| Orchestrator–Worker | Delegate bounded subtasks | Complex workloads |
| Evidence-Driven Evolution | Turn execution observations into improvements | Platform 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.
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.
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.
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.
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.
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:
- Access to private or sensitive data.
- Exposure to untrusted content (repository text, issues, web pages, tool output, dependencies).
- 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.
| Risk | Architectural mitigation |
|---|---|
| Prompt injection via repository, issues, web, or tool output | Treat retrieved content as untrusted data; enforce policy outside the model |
| Unauthorized tool invocation | Tool-level authorization and parameter validation |
| Credential exposure | Short-lived credentials, credential brokering, secret scanning |
| Source-code exfiltration | Egress allowlists, data classification, approved model endpoints |
| Arbitrary code execution | Isolated, hardened execution environments |
| Cross-project access | Project-scoped identity and workspace isolation |
| Supply-chain compromise | Approved dependencies, scanning, pinned versions, artifact provenance |
| Policy or hook tampering | Protected configuration enforced outside agent control |
| Verification bypass | Trusted CI and protected quality gates |
| Runaway execution | Budgets, rate limits, cancellation, kill switches |
| Malicious or compromised tools and skills | Registration, review, version pinning, isolation |
| Excessive agency | Least 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
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
| Risk | Representative action | Policy |
|---|---|---|
| Low | Read approved repository files | Automatically authorized within scope |
| Moderate | Modify files in an isolated workspace | Authorized with resource and action boundaries |
| Elevated | Open pull requests; propose infrastructure change | Governed workflow plus verification |
| High | Merge protected changes; modify shared environments | Independent policy checks and appropriate approval |
| Critical | Alter production infrastructure or sensitive data | Explicit 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 mode | Recommended response |
|---|---|
| Model invocation failure | Bounded retry, approved fallback, or escalation |
| Context retrieval failure | Report missing context; do not proceed on unsupported assumptions |
| Tool timeout | Retry only when safe; reconcile the original action if its outcome is uncertain |
| Workspace failure | Restore from durable state; recreate workspace |
| Context-window exhaustion | Compact and resume from validated task state |
| Repeated implementation failure | Terminate or escalate after bounded attempts |
| Verification failure | Return structured findings for correction |
| Policy violation | Deny and record |
| Budget exhaustion | Suspend or terminate |
| Conflicting parallel changes | Reconcile through controlled integration |
| Provider degradation | Reduce concurrency, queue work, or use approved alternatives |
| Stalled or looping agent | Detect 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.
Figure 19. Harness evaluation architecture.
Dimensions
| Dimension | Question |
|---|---|
| Functional effectiveness | Did the agent accomplish the approved task? |
| Context effectiveness | Did it retrieve and apply relevant context? |
| Tool effectiveness | Did it select and use tools correctly? |
| Architectural compliance | Do the changes satisfy architectural constraints? |
| Security | Did execution stay within authorized boundaries? |
| Reliability | Did the harness recover appropriately from failure? |
| Continuity | Was progress preserved across sessions? |
| Efficiency | How much time, compute, and cost were consumed? |
| Human intervention | What intervention was needed, and why? |
| Verification integrity | Was completion supported by trustworthy evidence? |
Methodology
Maintain a versioned benchmark of representative organizational tasks. For each candidate harness change:
- Establish the baseline configuration.
- Select representative tasks, including adversarial and failure scenarios.
- Run baseline and candidate under comparable conditions.
- 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.
- Compare correctness, security, reliability, and cost.
- Investigate regressions and correlated failures by reading transcripts, not only scores.
- 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 evaluation | Harness evaluation |
|---|---|
| Assesses model capability | Assesses complete system effectiveness |
| Tests reasoning and code generation | Tests task completion through real workflows |
| Focuses on responses | Focuses on artifacts, actions, and evidence |
| Measures inference characteristics | Measures reliability and economics |
| Supports model selection | Supports 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
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:
| Field | Purpose |
|---|---|
| Task and execution identifiers | Correlate distributed activity |
| Repository and revision | Identify the target |
| Harness and workflow versions | Establish configuration |
| Model and skill identifiers | Analyze effectiveness |
| Context source references | Investigate missing or incorrect context |
| Tool calls and outcomes | Diagnose action failures |
| Policy decisions | Provide authorization evidence |
| Verification results | Establish correctness |
| Duration | Analyze performance |
| Token and model usage | Attribute inference cost |
| Workspace resource usage | Attribute infrastructure cost |
| Human intervention events | Assess 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
| KPI | Measurement |
|---|---|
| Task success rate | Independently accepted tasks ÷ attempted tasks |
| First-pass success rate | Tasks accepted without corrective iterations ÷ attempted tasks |
| Execution failure rate | Tasks ending in execution failure ÷ attempted tasks |
| Recovery success rate | Successful recoveries ÷ recovery attempts |
| Human intervention rate | Tasks requiring intervention ÷ attempted tasks |
| Architecture compliance rate | Evaluated changes satisfying applicable checks |
| Verification false-acceptance rate | Incorrect candidates accepted by verification (estimated through audits and seeded defects) |
| Cost per successful task | Total cost, including failed attempts, ÷ accepted tasks |
| Mean time to completion | Average elapsed time for successful tasks |
| Guardrail violation rate | Policy-violating attempts ÷ evaluated executions |
| Harness adoption | Active 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
| Level | Representative measures |
|---|---|
| Harness effectiveness | Task success, recovery, execution cost, policy compliance |
| Software delivery effectiveness | Lead time, deployment frequency, change failure rate, cost per delivered feature |
| Business value | Adoption, 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
| Option | Description | Appropriate when |
|---|---|---|
| Adopt | Use an existing coding-agent harness with repository instructions and existing tools | Early adoption, bounded workloads |
| Extend | Add enterprise workflows, policy, context, verification, and integrations around an existing harness | Most enterprise environments |
| Compose | Assemble agent SDKs with enterprise platform components | Specialized execution or integration needs |
| Build | Develop substantial custom capability, potentially including the loop | Requirements 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
| Capability | Candidate technologies |
|---|---|
| Foundational coding-agent harness | Claude Code, OpenAI Codex, other coding agents |
| Programmable agent integration | Claude Agent SDK, supported Codex interfaces |
| Custom orchestration | Python, LangGraph, Temporal, AWS Step Functions |
| Policy enforcement | Open Policy Agent, Cedar-based authorization |
| Tool integration | MCP servers, native APIs, controlled adapters |
| Context retrieval | Git, code-search indexes, document retrieval |
| Task and state | PostgreSQL, Amazon DynamoDB |
| Execution isolation | Hardened containers, microVMs, managed sandboxes |
| Workload orchestration | Amazon ECS, Amazon EKS, AWS Batch |
| Model access | Provider APIs, Amazon Bedrock where applicable |
| Secrets | AWS Secrets Manager, enterprise secret platforms |
| Verification | Language test frameworks, contract and architecture testing tools |
| CI/CD | GitHub Actions, GitLab CI/CD, Jenkins, AWS CodePipeline |
| Observability | OpenTelemetry, Amazon CloudWatch, enterprise platforms |
| Infrastructure as code | Terraform, 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.
Figure 21. Illustrative AWS deployment architecture.
Component responsibilities
| Component | Responsibility |
|---|---|
| API Gateway or ALB | Expose the harness service interface |
| ECS or Lambda | Host task APIs and control-plane services |
| DynamoDB or PostgreSQL | Persist task metadata, registries, execution state |
| SQS | Buffer asynchronous tasks |
| EventBridge | Route lifecycle and operational events |
| ECS/EKS workers or sandbox service | Host agent execution environments |
| Amazon S3 | Persist artifacts, checkpoints, evidence |
| IAM and Secrets Manager | Identity and credential controls |
| AWS KMS | Manage encryption keys |
| CloudWatch and OpenTelemetry | Operational telemetry |
| CloudTrail | Supported 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.
| Artifact | Why versioning matters |
|---|---|
| Agent configuration | Controls behavior |
| Model configuration | Influences reasoning, cost, capability |
| Skills | Changes reusable behavior |
| Workflows | Changes sequencing and decisions |
| Tool contracts | Changes action semantics |
| Policies and hooks | Changes authorization and governance |
| Runtime images | Changes execution dependencies |
| Context configuration | Changes available knowledge |
| Evaluation datasets | Changes regression assessment |
| Verification profiles | Changes 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.
Figure 23. Harness Engineering lifecycle.
Harness CI/CD
| Stage | Activities |
|---|---|
| Source validation | Code quality, dependency checks, configuration validation |
| Unit testing | Test deterministic components |
| Integration testing | Verify model, tool, repository, and runtime integrations |
| Policy testing | Verify permitted and prohibited scenarios |
| Security testing | Test isolation, authorization, credentials, tool boundaries, injection resistance |
| Agent evaluation | Run representative benchmark tasks with repeated trials |
| Regression evaluation | Compare with the approved baseline |
| Artifact publication | Publish versioned, traceable artifacts |
| Release approval | Review regressions and operational risk |
| Progressive rollout | Release to selected repositories or teams first |
| Operational validation | Monitor effectiveness, failures, cost, and policy decisions |
Two delivery pipelines
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.
| Phase | Objective | Key activities | Exit criteria |
|---|---|---|---|
| 1. Foundation and controlled execution | A working, governed harness for one bounded use case | Adopt an existing coding-agent harness; approved repository access; concise context instructions; isolated execution; source-control integration; independent test execution | Representative tasks complete repeatedly, produce verifiable artifacts, and stay within boundaries |
| 2. Standardization and reuse | Reusable enterprise capabilities | Shared skills, context standards, approved workflows, execution contracts, reusable fitness functions, central configuration | Multiple workloads reuse governed capabilities with little customization |
| 3. Evaluation and reliability | Measurable, dependable execution | Durable checkpoints, recovery, evaluation datasets, regression suites, tracing, failure classification, cost attribution | Regressions are detected; failures investigated; eligible tasks recovered; cost per successful task measured |
| 4. Enterprise platformization | Multi-team shared platform | Central control plane, repository registration, workload isolation, quotas, approved tool catalog, shared observability, governed releases | Concurrent workloads run with defined ownership, boundaries, and service objectives |
| 5. Continuous optimization | Evidence-driven evolution | Optimize retrieval, workflows, skills, model choices, verification, utilization, adoption; retire obsolete scaffolding | Improvements are evaluated, versioned, progressively released, and tied to better outcomes |
Harness maturity model
| Level | Maturity | Defining characteristics |
|---|---|---|
| L1 | Assisted | Individuals use coding assistants and agents |
| L2 | Structured | Repository instructions, reusable workflows, basic verification |
| L3 | Governed | Execution contracts, policies, isolation, independent verification |
| L4 | Industrialized | Shared platform, evaluations, observability, scalable execution |
| L5 | Continuously evolving | Execution 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.
| Requirement | Harness capability |
|---|---|
| Agents must understand the SaaS architecture | Versioned architecture context and ADR retrieval |
| Agents must follow tenant-isolation principles | Tenant-aware skills and fitness functions |
| API changes must stay compatible | API contract validation |
| Infrastructure must meet AWS security standards | Infrastructure policy and security verification |
| Many tasks must run concurrently | Isolated workspaces and concurrency controls |
| Long tasks must survive interruption | Durable state and checkpoints |
| Changes must satisfy requirements | Independent acceptance verification |
| Cloud actions must be restricted | Scoped identities and governed tool execution |
| Failures must be diagnosable | Correlated execution telemetry |
| Recurring defects must improve future delivery | Evaluation 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.
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.
Figure 26. Evidence-driven evolution of the harness and AI-Native SDLC.
Failure classification and corrective ownership
| Observed failure | Likely corrective owner |
|---|---|
| Incorrect business requirement | Product and requirements engineering |
| Ambiguous acceptance criteria | AI-Native SDLC and feature team |
| Missing architectural knowledge | Context and knowledge engineering |
| Inappropriate tool selection | Harness orchestration or tool engineering |
| Excessive iterations | Harness execution and model engineering |
| Insecure tool action | Security and policy engineering |
| Inadequate verification | Verification engineering |
| Infrastructure failure | Runtime and platform engineering |
| Application-specific defect | Product engineering |
| Recurring cross-project architectural defect | Architecture 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 area | Primary accountability |
|---|---|
| Harness strategy | Head of AI Engineering or accountable platform leader |
| Reference architecture | Principal AI Architect / Harness Architect |
| Control plane and runtime | Platform Engineering |
| Agent execution and workflows | Harness Engineering |
| Context and knowledge | Context Engineering and domain owners |
| Reusable skills | Harness and product engineering specialists |
| Tool integration | Integration and Platform Engineering |
| Evaluation | Agent Evaluation Engineering |
| Verification | Quality Engineering and Architecture Governance |
| Security | Security Engineering and Platform Security |
| Production operations | Platform Operations / SRE |
| Adoption | Engineering 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-pattern | Why it fails | Alternative |
|---|---|---|
| Prompt-only harness | Instructions cannot enforce operational constraints | Combine instructions with executable controls |
| Unbounded autonomy | Unpredictable execution, cost, and risk | Execution contracts and budgets |
| Multi-agent by default | Unneeded coordination complexity | Start with the simplest effective topology |
| Monolithic context or giant instruction file | Crowds out task information; goes stale | Short entry points, progressive disclosure, retrieval |
| Agent self-certification | Implementation and verification failures correlate | Independent verification |
| Agent-editable guardrails | The agent can disable its own controls | Protect policy, hooks, tests, and CI outside agent control |
| Shared privileged credentials | Expands blast radius | Scoped, short-lived, task-bound identity |
| Approval fatigue | Humans click through constant prompts | Sandboxing plus policy; escalate only high-impact actions |
| Persistent unrestricted workspaces | Accumulates sensitive state and drift | Controlled workspaces; durable external checkpoints |
| Unversioned skills and prompts | Regressions are untraceable | Version and evaluate all execution configuration |
| Unvetted third-party tools and skills | Supply-chain and injection exposure | Registration, review, pinning, scanning |
| Agent-controlled production deployment | Weakens release controls | Authorized CI/CD workflows |
| Evaluating only the model | Ignores context, tool, runtime, and verification failures | Evaluate the complete harness |
| Single-run evaluation | Stochastic behavior hides unreliability | Repeated trials; report variance |
| Measuring generated code volume | Confuses activity with delivery | Measure accepted outcomes and economics |
| Never pruning scaffolding | Obsolete workarounds degrade newer models | Periodic ablation testing |
| Building everything internally | Cost and delay | Adopt foundations; extend selectively |
| Harness as a one-time project | Capability and policy decay | Manage 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
- The model is necessary but not sufficient; reliability comes from the surrounding system.
- Distinguish model, agent, harness, runtime, and environment, and give every control an owner other than the model.
- Instructions shape behavior; deterministic controls bound it.
- Separate the plane that does the work from the planes that authorize and judge it.
- Treat context as a scarce, governed resource; make the repository the system of record.
- Externalize progress so long tasks survive context resets and interruptions.
- Independent verification must be protected from the implementing agent, including against test tampering and reward hacking.
- Do not combine sensitive data, untrusted input, and unrestricted external action in one session.
- Evaluate the whole harness with repeated trials, held-out tasks, and transcript review.
- Adopt and extend before you build, keep differentiating assets portable, and prune scaffolding as models improve.
Glossary
| Term | Definition |
|---|---|
| Agent harness | The software that wraps a model with an execution loop, context assembly, tool dispatch, and controls. |
| Agent skill | A packaged, versioned set of instructions and resources for a recurring task, loaded on demand. |
| Architecture fitness function | An executable check that an architectural characteristic still holds. |
| Compaction | Summarizing accumulated context to continue work within window limits. |
| Control plane | The trusted components that decide what execution is permitted. |
| Execution contract | A machine-readable specification of a task's scope, permissions, budgets, and success criteria. |
| Hook | Deterministic code executed at defined points in an agent's lifecycle. |
| MCP | Model Context Protocol, an open standard for connecting agent applications to tools and resources. |
| Reward hacking | An agent satisfying a measurable completion signal without achieving the intended goal. |
| Runtime environment | The isolated compute, filesystem, and network boundary in which agent actions occur. |
| Subagent | A delegated agent instance with its own context and, optionally, restricted tools. |
| Verification plane | The 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
- OpenAI. Harness Engineering: Leveraging Codex in an Agent-First World.
- OpenAI. Unlocking the Codex Harness: How We Built the App Server.
- Anthropic. Effective Harnesses for Long-Running Agents.
- Anthropic. Building Effective Agents.
- Anthropic. Harness Design for Long-Running Application Development.
- OWASP. Top 10 for Agentic Applications.
- SLSA. Build Provenance.
- Model Context Protocol. Specification and security best-practice documentation (modelcontextprotocol.io).
Engineer the harness. Deliver through the harness. Improve both through evidence.