Production Agent Architecture

The Harness
Determines
Agent Success

Reference architecture patterns for production AI agent systems. Not better models. Better engineering discipline: context architecture, execution guardrails, and memory infrastructure that actually works.

Architecture Readiness

0%
Harness Gain +26%
Zero Model Changes 52.8 → 66.5%
Enterprise Fail Rate 70-95%
Planning Ratio 85% Plan / 15% Code
Harness Engineering

Three Jobs of an Agent Harness

The harness, not the model, determines agent success. LangChain's coding agent jumped from 52.8% to 66.5% on Terminal Bench 2.0 by changing zero model parameters.

JOB-001

Context Architecture

Deciding what information the model sees at each step. Context is a scarce resource: a 1M token window with 800K of noise performs worse than 200K with 150K curated signal. Structured compaction before the window fills.

JOB-002

Execution Guardrails

Enforcing what the model can and cannot do. Risk-tiered CI with machine-readable contracts: high-risk paths get policy gates, browser evidence, and security scans. Low-risk paths get fast-tracked.

JOB-003

Memory Infrastructure

Ensuring the model learns from its own history. Failed commands captured automatically, corrections applied, patterns graduated to rules. Cross-session search prevents repeating solved problems.

Failure Modes

Three Ways 1M Token Windows Fail

Bigger context windows do not solve the problem. They make it worse without proper architecture.

Context Saturation

By 100K tokens, the window is 60% noise: old file reads, superseded search results, abandoned reasoning paths. Adding more capacity without compaction makes performance worse, not better.

Structured compaction before the window fills

Instruction Dilution

System prompt says "use pnpm." CLAUDE.md says "run tests before committing." README says "use npm." By 200K tokens, instructions compete with 150K of conversation history and lose.

Priority-weighted instruction injection

Goal Drift

Long-running agents accumulate so many intermediate steps that they lose sight of the original objective. The model optimises for local coherence rather than global progress toward the actual goal.

Periodic reality-check prompts and drift detection
Honest Comparison

What You Keep vs What They Take

Framework sprawl versus disciplined harness engineering.

Capability Reference Architecture Framework + Cloud Raw LLM API
Context compaction
Risk-tiered CI gates
Cross-session learning
Role-based knowledge graphs
Multi-agent coordination
Strategic drift detection
Data stays local
Vendor lock-in

Full support   Partial   Not available

Agent Flywheel

The 9-Step Orchestration Arc

85% planning, 15% code. Moving the hardest thinking into representations that still fit inside model context windows is the entire game.

1

Intent Clarification

Explain goals to frontier models. Establish problem boundaries and success criteria before any design work begins.

2

Competing Plans

Request independent designs from multiple models. Diverse reasoning paths surface blind spots that a single model misses.

3

Synthesis

Create a "best-of-all-worlds" hybrid plan. Merge the strongest elements via structured diff format.

4

Iterative Refinement

4-5+ rounds in fresh conversations. Plans reach 3,000-6,000+ lines. Each round sharpens architecture and edge cases.

Plan Space: 1x Rework Cost
5

Plan-to-Task Conversion

Transform markdown into executable work units with full dependency graphs and embedded context. Every piece of reasoning travels with the task.

Task Space: 5x Rework Cost
6

Task Polishing

4-6+ refinement cycles. "Check tasks N times, implement once." Transition when whole-workflow questions stabilise.

7

Swarm Launch

Deploy 5-15 coordinated agents. Stagger starts by 30+ seconds to prevent thundering herd. All agents are generalists, instantly replaceable.

Code Space: 25x Rework Cost
8

Swarm Tending

Human manages flow, unblocks stuck tasks. Cross-agent review every 30-60 minutes alternating random exploration and systematic integration checks.

9

Hardening

Self-review, cross-review, testing, polish. Strategic drift detection: "Do we actually have the thing we are trying to build?"