cd /news/ai-agents/harness-engineering-101-the-llm-is-t… Β· home β€Ί topics β€Ί ai-agents β€Ί article
[ARTICLE Β· art-152922] src=github.com β†— pub= topic=ai-agents verified=true sentiment=↑ positive

Harness Engineering 101: The LLM is the brain, the harness is the body

Isuru Wijesiri published "Harness Engineering 101" (Version 1.0, September 2026), a 16-chapter online book that builds a roughly 300-line toy AI agent in plain Python, framing the LLM as a stateless "brain" and the harness as the program that builds, maintains and protects the conversation JSON array. Each chapter follows the same shape β€” the failure, the minimal patch, what the patch costs β€” covering topics from tool calling and the agent loop through caching, context budgeting, subagents, steering, MCP and guardrails. The patterns are developed in full in One Code, an open-source coding agent built on pi.

read4 min views1 publishedOct 19, 2026
Harness Engineering 101: The LLM is the brain, the harness is the body
Image: Michielbdejong (auto-discovered)

The LLM is the brain. The harness is the body.

Version 1.0 β€” September 2026.

A blog series about building AI agents from first principles, published as a book.

πŸ“– Read it online: https://isuruwijesiri.com/harness-engineering-101/

An LLM API is stateless. Every turn, you send the entire conversation as a JSON array and get text back. A harness is the program that builds, maintains, and protects that array. Everything the field calls "agents" is a set of patches to that one loop, and each patch exists because something concrete broke. This series develops that one idea across 16 chapters, growing a ~300-line toy agent in plain Python as it goes.

The patterns here are developed in full in One Code, an open-source coding agent built on pi.

The rendered book reads best online at the link above. If you'd rather read the source here on GitHub, follow the chapters in order below. The full introduction is on the book's landing page.

Every chapter has the same shape: the failure, the minimal patch, what the patch costs.

# Chapter The failure it patches
1 It's Just a JSON Array "How do I even talk to this thing?"
2 The Brain: A Next-Token Black Box "Why does it behave like that?"
3 Tools: JSON Mapped to Functions The brain can't touch the world
4 The Agent Loop One tool call isn't enough
5 Caching: Why Order Is Load-Bearing Resending the array gets expensive
# Chapter The failure it patches
6 Context Is a Budget, Not a Bag The window fills up
7 Subagents: Fork the Context One array can't hold all the work
8 Steering the Running Loop The brain drifts mid-task
9 Background Work and Time The loop is synchronous; the world isn't
# Chapter The failure it patches
10 Every Framework Is a Wrapper Around Chapter 1 Abstraction anxiety
11 Extending the Body: MCP, Skills, Deferred , Hooks Capabilities don't fit in the array
12 Debugging the Array You can't fix the prompt you can't see
# Chapter The failure it patches
13 Reflexes and Guardrails The loop will do something dumb
14 Case Study: Coding Agents How specialized does the body need to be?
15 RAG Was a Harness Pattern All Along A thousand names for one idea

Standalone pieces. Read them when you need them.

Path What it holds
src/*.md The chapters and appendices (the book source)
src/SUMMARY.md The book's table of contents
src/harness/ The runnable toy harness β€” one file per stage
src/diagrams/ Diagram generators and their generated PNGs
book.toml mdBook configuration
scripts/sync-to-blog.sh Builds the book and mounts it into the blog for serving
cargo install mdbook mdbook-mermaid   # or: brew install mdbook (+ mdbook-mermaid binary)
mdbook serve --open                    # live-re preview at http://localhost:3000
mdbook build                           # static site into ./book

mdbook-mermaid renders the inline mermaid diagrams; without it those blocks show as raw code.

cd src/diagrams && python3 gen_all.py   # Python 3.10+, matplotlib

This repository is dual-licensed:

Β© 2026 Isuru Wijesiri.

── more in #ai-agents 4 stories Β· sorted by recency
── more on @isuru wijesiri 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/harness-engineering-…] indexed:0 read:4min 2026-10-19 Β· β€”