{"slug": "harness-engineering-101-the-llm-is-the-brain-the-harness-is-the-body", "title": "Harness Engineering 101: The LLM is the brain, the harness is the body", "summary": "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.", "body_md": "*The LLM is the brain. The harness is the body.*\n\n*Version 1.0 — September 2026.*\n\nA blog series about building AI agents from first principles, published as a book.\n\n**📖 Read it online: [https://isuruwijesiri.com/harness-engineering-101/](https://isuruwijesiri.com/harness-engineering-101/)**\n\nAn LLM API is stateless. Every turn, you send the entire conversation as a JSON\narray and get text back. A *harness* is the program that builds, maintains, and\nprotects that array. Everything the field calls \"agents\" is a set of patches to\nthat one loop, and each patch exists because something concrete broke. This\nseries develops that one idea across 16 chapters, growing a ~300-line toy agent\nin plain Python as it goes.\n\nThe patterns here are developed in full in\n[One Code](https://github.com/IsuruMaduranga/one-code), an open-source coding\nagent built on [pi](https://github.com/earendil-works/pi).\n\nThe rendered book reads best online at the link above. If you'd rather read\nthe source here on GitHub, follow the chapters in order below. The full\nintroduction is on the [book's landing page](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/README.md).\n\nEvery chapter has the same shape: the failure, the minimal patch, what the patch costs.\n\n| # | Chapter | The failure it patches | \n|---|---|---|\n| 1 | [It's Just a JSON Array](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/01-its-just-a-json-array.md) | \"How do I even talk to this thing?\" | \n| 2 | [The Brain: A Next-Token Black Box](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/02-the-brain.md) | \"Why does it behave like that?\" | \n| 3 | [Tools: JSON Mapped to Functions](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/03-tools.md) | The brain can't touch the world | \n| 4 | [The Agent Loop](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/04-the-agent-loop.md) | One tool call isn't enough | \n| 5 | [Caching: Why Order Is Load-Bearing](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/05-caching.md) | Resending the array gets expensive | \n\n| # | Chapter | The failure it patches | \n|---|---|---|\n| 6 | [Context Is a Budget, Not a Bag](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/06-context-is-a-budget.md) | The window fills up | \n| 7 | [Subagents: Fork the Context](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/07-subagents.md) | One array can't hold all the work | \n| 8 | [Steering the Running Loop](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/08-steering.md) | The brain drifts mid-task | \n| 9 | [Background Work and Time](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/09-background-work-and-time.md) | The loop is synchronous; the world isn't | \n\n| # | Chapter | The failure it patches | \n|---|---|---|\n| 10 | [Every Framework Is a Wrapper Around Chapter 1](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/10-frameworks-are-wrappers.md) | Abstraction anxiety | \n| 11 | [Extending the Body: MCP, Skills, Deferred Loading, Hooks](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/11-extending-the-body.md) | Capabilities don't fit in the array | \n| 12 | [Debugging the Array](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/12-debugging-the-array.md) | You can't fix the prompt you can't see | \n\n| # | Chapter | The failure it patches | \n|---|---|---|\n| 13 | [Reflexes and Guardrails](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/13-reflexes-and-guardrails.md) | The loop will do something dumb | \n| 14 | [Case Study: Coding Agents](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/14-coding-agents.md) | How specialized does the body need to be? | \n| 15 | [RAG Was a Harness Pattern All Along](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/15-rag.md) | A thousand names for one idea | \n\n- [Build Your Own](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/16-epilogue-build-your-own.md) — the complete toy harness, annotated\n\nStandalone pieces. Read them when you need them.\n\n- [A. One Harness, Many Brains](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/appendix-a-one-harness-many-brains.md) — model routing, prompt tiers, cost engineering\n- [B. Worktrees and Isolation](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/appendix-b-worktrees-and-isolation.md) — giving parallel agents separate copies of the world\n- [C. Modes and Plan Mode](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/appendix-c-modes-and-plan-mode.md) — harness-enforced operating states (coding-specific)\n- [D. Retries, Rate Limits, and Streaming](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/src/appendix-d-retries-rate-limits-streaming.md) — the unglamorous plumbing, plus how streaming works on the wire\n\n| Path | What it holds | \n|---|---|\n| `src/*.md` | The chapters and appendices (the book source) | \n| `src/SUMMARY.md` | The book's table of contents | \n| `src/harness/` | The runnable toy harness — one file per stage | \n| `src/diagrams/` | Diagram generators and their generated PNGs | \n| `book.toml` | mdBook configuration | \n| `scripts/sync-to-blog.sh` | Builds the book and mounts it into the blog for serving | \n\n```\ncargo install mdbook mdbook-mermaid   # or: brew install mdbook (+ mdbook-mermaid binary)\nmdbook serve --open                    # live-reloading preview at http://localhost:3000\nmdbook build                           # static site into ./book\n```\n\n`mdbook-mermaid` renders the inline mermaid diagrams; without it those blocks\nshow as raw code.\n\n```\ncd src/diagrams && python3 gen_all.py   # Python 3.10+, matplotlib\n```\n\nThis repository is dual-licensed:\n\n- **The prose** — every chapter and appendix (the`.md` files under`src/` ) —\nis licensed under[Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International\n(CC BY-NC-ND 4.0)](https://creativecommons.org/licenses/by-nc-nd/4.0/) . You\nmay share it with credit, but not use it commercially or publish modified\nversions. Full text in[`LICENSE`](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/LICENSE) .\n- **The code** — the`.py` files under`src/harness/` and`src/diagrams/` , and\ncode snippets reproduced from them in the chapters — is licensed under the[MIT License](https://github.com/IsuruMaduranga/harness-engineering-101/blob/main/LICENSE-CODE) . Use it freely, with attribution.\n\n© 2026 Isuru Wijesiri.", "url": "https://wpnews.pro/news/harness-engineering-101-the-llm-is-the-brain-the-harness-is-the-body", "canonical_source": "https://github.com/IsuruMaduranga/harness-engineering-101", "published_at": "2026-10-19 12:07:41+00:00", "updated_at": "2026-10-19 12:46:50.432223+00:00", "lang": "en", "topics": ["ai-agents", "artificial-intelligence", "large-language-models", "ai-tools", "agent-protocols"], "entities": ["Isuru Wijesiri", "Harness Engineering 101", "One Code", "pi"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/harness-engineering-101-the-llm-is-the-brain-the-harness-is-the-body", "markdown": "https://wpnews.pro/news/harness-engineering-101-the-llm-is-the-brain-the-harness-is-the-body.md", "text": "https://wpnews.pro/news/harness-engineering-101-the-llm-is-the-brain-the-harness-is-the-body.txt", "jsonld": "https://wpnews.pro/news/harness-engineering-101-the-llm-is-the-brain-the-harness-is-the-body.jsonld"}}