Harness 工程 101:LLM 是大脑,Harness 是身体
Harness Engineering 101: The LLM is the brain, the harness is the body

原始链接: https://github.com/IsuruMaduranga/harness-engineering-101

本仓库是一本名为《Harness Engineering 101》的书,讲述如何从第一性原理构建 AI 智能体。它认为 LLM API 是无状态的:每次调用都把整个对话以 JSON 发送并返回文本,而 harness 负责构建、维护并保护这个数组。所有智能体行为都被描述为对单一循环的修补,每次修补都是因为某件具体的事情坏了。本系列共 16 章,逐步扩展一个小型 Python 玩具智能体,相关模式在开源 One Code 智能体中得到扩展。全书组织为四部分加附录,涵盖线缆层机制、长期运行压力、生态系统,以及信任、领域和数据。渲染版书籍建议在线阅读;源章节、图表和可运行的 harness 阶段均已包含。本地构建使用 mdBook 和 mdbook-mermaid,定量图表在 Python 中重新生成。本项目采用双重许可,© 2026 Isuru Wijesiri。

``` Hacker News 新 | 过去 | 评论 | 提问 | 展示 | 工作 | 提交 登录 Harness 工程 101:LLM 是大脑,harness 是身体 ( github.com/isurumaduranga ) 13 分 由 isuruwijesiri 22 分钟前 | 隐藏 | 过去 | 收藏 | 1 条评论 帮助 prologic 3 分钟前 [–] 这里有很多不错的资源! 回复 考虑申请 YC 2027 冬季批次! 申请 开放至 11 月 2 日。 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请加入 YC | 联系 搜索: ```
相关文章

原文

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.

Part I — The Wire (nothing is magic)

Part II — Running Long (the array under pressure)

Part III — The Ecosystem (naming what you already understand)

Part IV — Trust, Domains, and Data

Appendix — Advanced Topics

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

Building the book locally

cargo install mdbook mdbook-mermaid   # or: brew install mdbook (+ mdbook-mermaid binary)
mdbook serve --open                    # live-reloading 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.

Regenerating the quantitative diagrams

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

This repository is dual-licensed:

© 2026 Isuru Wijesiri.

联系我们 contact @ memedata.com