Harness Engineering 101
A 16-chapter book that builds an AI agent's body from first principles around one ~300-line Python harness.
- Source repo
- IsuruMaduranga/harness-engineering-101
- Stars
- ★ 663
- Last updated
- 25d ago
- FARS reviewed
- Nov 27, 2026
- License
- NOASSERTION
- Primary language
- Python
- FA score
- 30/100 · Major gaps
At a glance
- Works with
- Portable with changes
- You'll need
- 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
- Source review
- 30/100 · Major gaps 7 safety controls not found
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.
- 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/.
- 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".
- 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.
- 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.
- 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 ./bookRegenerating the quantitative diagrams needs Python 3.10+ and matplotlib:
cd src/diagrams && python3 gen_all.pyHow 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 buildThe output can be mounted into the blog with:
scripts/sync-to-blog.shSafety 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)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
FARS trust-control audit
- 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?
- 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.
- 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?
Why each dimension lost points
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.
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.
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.
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.
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.
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.
- 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.
FAQ
Can I drop this into production as my agent framework?
What does it cost to follow along?
Can we share or teach from it inside a company?
What do I need installed to build it locally?
Which models or platforms does the harness support?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.