Agentic Coding: Build the Harness
The Loop, Guardrails, and Verification That Make Your AI Coding Agent Reliable on Real Code, Not Just Demos
Your AI agent dazzles in a demo, then falls apart on real code. The difference isn't the model. It's the harness. Build one running coding-agent harness yourself, layer by layer, in Python you understand down to the last line.
Your AI agent looks brilliant in the demo, then joins your real codebase and falls apart. The difference isn’t the model. It’s the harness around it. This book hands you the one thing every harness book on Amazon describes but never builds: a real, running coding-agent harness you code yourself, layer by layer, in about 190 pages of dense Python, ending with one complete system you understand down to the last line.
What You'll Build
Why ~98% of a coding agent is harness, not model, and why that gap is your opening.
The seven layers wrapped around the model, defined cleanly enough to draw from memory.
Same model, +14 points: hold the engine still and change the transmission.
A real, running ~150-line agent loop in your terminal. The spine everything bolts onto.
Stop the agent losing the plot with a pinned progress note and a trimmed window.
Gate every tool call in code so your agent runs with write access without being a loaded gun.
Narrow, typed, retry-safe tools with errors the model can actually recover from.
An independent check the agent can't fudge, and a rollback when it fails.
Prove a change helped with a real number instead of guessing.
Run two harnesses on one job, a writer and an adversarial reviewer, through the filesystem.
The honest chapter: drift, governance, and the layer you should refuse to add.
Score six real harnesses against the seven layers and make the build-vs-adopt call.
Free Articles from this Book
AI Agent Guardrails: Gate Every Tool Call
AI agent guardrails belong on one line of code: the tool call. Build a deterministic gate that classifies, approves, and fails safe before any action runs.
from: Agentic Coding: Build the Harness
Build an AI Coding Agent From Scratch in Python
Build an AI coding agent from scratch in Python: the ~150-line agent loop that reads files, writes code, runs tests, and stops on its own. No framework.
from: Agentic Coding: Build the Harness
Context Engineering for AI Agents
Context engineering for AI agents: build a context layer that trims the window, pins a progress note, and survives long tasks where blind compaction fails.
from: Agentic Coding: Build the Harness
What Is an Agent Harness? The 7 Layers
What is an agent harness? The 7 layers wrapped around the model: loop, context, guardrails, tools, verification, recovery, orchestration. With a teardown table.
from: Agentic Coding: Build the Harness
Why AI Agents Report False Success
Why AI agents report false success: the bias that makes them grade their own work, the $1.78M bug it shipped, and the independent check that catches it.
from: Agentic Coding: Build the Harness