Harness Engineering 101

A 16-chapter book that builds an AI agent's body from first principles around one ~300-line Python harness.

Stars
★ 663
Last updated
25d ago
FARS reviewed
Nov 27, 2026
License
NOASSERTION
Primary language
Python

At a glance

Works with
Portable with changes
You'll need
mdbookmdbook-mermaidPython 3.10+matplotlibRust/cargo (optional install path)Shell / CLINetwork accessLocal filesystem
Typical use
A backend engineer writing their first agent loop who wants to see how tool calls map to JSON before reaching for a framework — read chapters 1–4 alongside src/harness/.
Main limitation
It is a teaching book, not an installable agent: no package, CLI or dependency manifest is published, so running the code means wiring your own model calls.
Maintenance
Commits in the last 30 dayslast commit 2026-11-02

What does this agent do, and when should you use it?

Harness Engineering 101 is an English book, published as a blog series and rendered with mdBook, about building AI agents from first principles. Its single argument is that an LLM API is stateless: every turn you resend the whole conversation as a JSON array, and the harness is the program that builds, maintains and protects that array. Across 16 chapters plus four appendices, each chapter follows the same shape — the failure, the minimal patch, what the patch costs — growing a ~300-line toy agent in plain Python as it goes. The repository holds the book source (src/*.md and src/SUMMARY.md), the staged runnable harness under src/harness/, matplotlib diagram generators under src/diagrams/, book.toml for mdBook, and scripts/sync-to-blog.sh for publishing. The material comes from the author's work on WSO2 MI Copilot, WSO2 BI Copilot and One Code; prose is CC BY-NC-ND 4.0 and code is MIT.

The repository produces four auditable things. First, the manuscript: Markdown chapters under src/ organised into Part I (the wire), Part II (running long), Part III (the ecosystem), Part IV (trust, domains, data), an epilogue and appendices A–D, with src/SUMMARY.md as the table of contents. Second, src/harness/, a staged pure-Python toy harness that starts at a bare JSON-array request loop and adds tool-call-to-function mapping, the agent loop, cache-aware ordering, context budgeting, subagent context forking, in-flight steering and background work. Third, src/diagrams/, where python3 gen_all.py drives matplotlib to emit the quantitative PNG figures. Fourth, an mdBook pipeline: book.toml configures the site, mdbook serve gives a live preview, mdbook build writes a static site to ./book, and scripts/sync-to-blog.sh mounts the build into the author's blog. Prose chapters also cover MCP, skills, deferred loading, hooks, RAG and worktree isolation.

  1. A backend engineer writing their first agent loop who wants to see how tool calls map to JSON before reaching for a framework — read chapters 1–4 alongside src/harness/.
  2. A team cutting agent API spend that needs to understand why the ordering of the conversation array changes cache hit rates — chapter 5, "Caching: Why Order Matters".
  3. Engineers whose agent blows the context window or drifts mid-task — chapters 6–8 on context budgets, subagent context forking and steering the running loop.
  4. A tech lead scoping a coding agent who wants to judge how specialised the harness must be — chapter 14's coding-agent case study and appendix C on modes and plan mode.
  5. A technical writer who wants a multi-chapter, mermaid-annotated documentation site — fork the repo and build the Markdown book with mdBook.

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Install / run
  • cargo install mdbook mdbook-mermaid # or: brew install mdbook (+ mdbook-mermaid binary)
Ports
3000
Runtime
Python 3.10+
Install notes cover
macOS

How do you install or deploy this agent?

Install mdBook first; add mdbook-mermaid if you want the inline mermaid diagrams rendered.

cargo install mdbook mdbook-mermaid   # or: brew install mdbook (+ mdbook-mermaid binary)

Then clone the repository and build or preview it locally:

mdbook serve --open    # live-reloading preview at http://localhost:3000
mdbook build           # static site into ./book

Regenerating the quantitative diagrams needs Python 3.10+ and matplotlib:

cd src/diagrams && python3 gen_all.py

How do you use this agent?

The easiest path is reading the rendered book at https://isuruwijesiri.com/harness-engineering-101/ . To read on GitHub, follow the reading order in the README from chapter 1 through the epilogue, keeping in mind each chapter is the failure, the minimal patch and the patch's cost. To work through the code, open the matching stage under src/harness/ and run it against your own model API calls — the repository ships no unified CLI entry point, dependency manifest or API-key configuration, so you supply that layer. To change the site, edit src/*.md and src/SUMMARY.md, then rebuild:

mdbook build

The output can be mounted into the blog with:

scripts/sync-to-blog.sh

Safety boundaries, hardening & integrations

Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.

Declared capability surface (blast radius)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

FARS trust-control audit

Not found in source — apply before daily use
  • least-privilege scoping — Grant only what the task needs: a dedicated account or read-only token, scoped to specific directories and repos.
  • confirmation before acting — Turn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
  • data-flow disclosure — Watch which external services it contacts (proxy or firewall logs) and keep sensitive data out until you know where it goes.
  • sensitive-data handling — Use dedicated, low-privilege, revocable API keys — never production credentials — and keep secrets out of logs.
  • dependency security — Pin versions and run a dependency audit (npm audit, pip-audit) before installing; prefer running it in a container.
  • disclosed external effects — Establish which external systems it writes to, sends to or changes, and verify with test accounts or repos before production.
  • rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.

What are this agent's strengths and limitations?

Pros
  • One tightly held thesis: the whole book is patches to a single stateless-JSON-array loop, so later chapters build on earlier ones instead of piling up concepts.
  • Every chapter has the same structure — the failure, the minimal patch, what the patch costs — so you learn why a feature exists and what it charges you.
  • Text and code live together: src/harness/ carries runnable pure-Python stages, and the epilogue annotates the complete ~300-line toy harness.
  • Split licensing that is easy to reason about: prose is CC BY-NC-ND 4.0, while .py files under src/harness/ and src/diagrams/ are MIT and freely reusable with attribution.
  • Grounded in real shipped work on WSO2 MI Copilot, WSO2 BI Copilot and One Code rather than a survey of other people's blog posts.
Limitations
  • It is a teaching book, not an installable agent: no package, CLI or dependency manifest is published, so running the code means wiring your own model calls.
  • The prose is English-only with no translated edition.
  • The CC BY-NC-ND 4.0 prose licence forbids commercial use and modified redistribution, which constrains internal training rewrites.
  • Building the site needs a Rust toolchain (cargo) or brew, and without mdbook-mermaid the inline diagrams degrade to raw code blocks.
  • The repository declares no Topics and ships no AGENTS.md or extra guidance, so discoverability and auditable metadata are thin.

How does this agent compare with similar options?

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
Harness Engineering 101 This agent 30 · Major gaps — ★ 663 25d ago Python —
ai4j — Java AI Agentic SDK 60 · Some gaps Library / SDKFree + model costs ★ 443 4d ago Java OpenAI API · Claude API
Late 60 · Some gaps CLIFree + model costs ★ 458 3d ago Go OpenAI API
PI from Scratch 56 · Major gaps CLIFree + model costs ★ 1.3k 1mo ago TypeScript OpenAI API

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Major gaps
30/ 100 5-point scale 1.5 / 5
Trust 2/29
Reliability 5/14
Adaptability 9/18
Convention 8/18
Effectiveness 3/13
Verifiability 3/8
Why each dimension lost points
Trust2 / 29 · 0.3/5

Trust dimension: the evidence contains only README and the CC license; no runtime permission model, user confirmation mechanism, data flow description, or sensitive data handling policy is shown; dependency security is not discussed; no external effects or rollback mechanisms. For source attribution, README discloses AI usage and credits WSO2 projects and One Code, scoring 2; the rest score 0 due to absence or non-applicability.

Reliability5 / 14 · 1.8/5

Reliability: README is internally consistent with no contradictions in chapter order or repository layout, scoring 2; build instructions provide cargo and python commands but no pinned dependency versions or dependency-failure handling, scoring 1; no runnable code in the packet means no failure messages to assess, scoring 0.

Adaptability9 / 18 · 2.5/5

Adaptability: target audience (developers learning to build agents) and reading scenarios are clear; the project is positioned as an educational book with a ~300-line toy harness, so capability boundaries are clear, scoring 2; local build environment notes are adequate for ordinary use, scoring 2; trigger precision is not applicable to a book product, scoring 0.

Convention8 / 18 · 2.2/5

Convention: information architecture (reading order, repository layout) and install notes are clear, scoring 2; version 1.1 is present but no changelog and no naming-stability promise, scoring 1; chapters serve as examples but no FAQ, scoring 1; no known-limitations section, scoring 0; dual-license explanation is clear and CC text is included, but the MIT code license text (LICENSE-CODE) is not in the packet, scoring 2; version info exists but no changelog, scoring 1; maintenance responsibility is only author credit and copyright, with no explicit maintenance commitment, scoring 1.

Effectiveness3 / 13 · 1.2/5

Effectiveness: readable as an online book, but the packet lacks runnable harness code, limiting output usability, scoring 1; there is educational marginal value for learning agent construction but it is not a deployable agent product, scoring 1; no cost-benefit analysis, scoring 0.

Verifiability3 / 8 · 1.9/5

Verifiability: claims are traceable via the online book link and external project references, scoring 2; but there is only a single README source with no cross-source corroboration, scoring 1; narrative content does not clearly separate fact from inference, scoring 0.

Risks and how to mitigate them
  • Not found in source: least-privilege scopingGrant only what the task needs: a dedicated account or read-only token, scoped to specific directories and repos.
  • Not found in source: confirmation before actingTurn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
  • Not found in source: data-flow disclosureWatch which external services it contacts (proxy or firewall logs) and keep sensitive data out until you know where it goes.
  • Not found in source: sensitive-data handlingUse dedicated, low-privilege, revocable API keys — never production credentials — and keep secrets out of logs.
  • Not found in source: dependency securityPin versions and run a dependency audit (npm audit, pip-audit) before installing; prefer running it in a container.
  • Not found in source: disclosed external effectsEstablish which external systems it writes to, sends to or changes, and verify with test accounts or repos before production.
  • Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
  • This repository is primarily book content, not a runnable agent framework; the packet lacks src/harness code, so code security and reliability cannot be assessed.
  • The MIT license text (LICENSE-CODE) is not included in the packet; only README mentions it.
  • Build dependencies (mdbook, mdbook-mermaid, matplotlib) are not version-pinned and dependency security is not discussed.
  • A known-limitations section is missing, and there is no cross-source corroboration.
Evidence confidence: Low Reviewed Nov 27, 2026 Reviewed revision bab04540eb3b
Review evidence README.mdLICENSE
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/harness-engineering-101.svg)](https://followagents.com/en/agents/harness-engineering-101)
<a href="https://followagents.com/en/agents/harness-engineering-101"><img src="https://followagents.com/badge/harness-engineering-101.svg" alt="FARS review"></a>

FAQ

Can I drop this into production as my agent framework?
No. The repository delivers a manuscript plus a ~300-line teaching harness, with no packaging, releases or dependency manifest. Its purpose is to show why each patch to the loop exists so you can then choose a framework deliberately.
What does it cost to follow along?
The book is free to read online under CC BY-NC-ND 4.0. Running the harness code means calling an LLM API, and that spend is between you and whichever model provider you point it at; the repository provides no credits or hosting.
Can we share or teach from it inside a company?
The licence allows credit-giving sharing but not commercial use or publishing modified versions, so paid internal training or redistributing an edited edition needs the author's permission. The .py code under src/harness/ and src/diagrams/ is MIT and can be reused with attribution.
What do I need installed to build it locally?
mdBook plus optionally mdbook-mermaid, usually via cargo or brew; regenerating the quantitative figures additionally needs Python 3.10+ and matplotlib. Without mdbook-mermaid, mermaid blocks display as raw code.
Which models or platforms does the harness support?
The book treats the LLM as a stateless text black box and appendix A discusses model routing and prompt tiers, but the repository ships no vendor SDK adapters or platform integration configuration.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts