GeekNews
Harness Engineering 101 - Learning AI Agent Implementation in About 300 Lines of Python
AIFirst seen 84 points1 comments
This is a free online book called "Harness Engineering 101." It teaches how to build an AI agent by writing a small Python program of about 300 lines.
What the book is
The book is a series of 16 chapters about AI agents. Its main idea is that an AI model only receives a list of messages and sends back text. The program that manages that list is called the harness. The author says most ideas called "agents" are small changes to this one loop. Each change fixes a real problem that came up.
Key idea: brain and body
Think of the LLM (large language model, an AI that predicts text) as the brain. Think of the harness as the body. The LLM API is stateless, which means it does not remember past turns. So the harness must send the whole conversation again every time, as a JSON array (a structured list written in a common data format).
Key facts
- The book has 16 chapters.
- It is split into four parts plus an epilogue and an appendix.
- The agent grows to about 300 lines of plain Python.
- Version 1.1 was published in October 2026.
- The author also works on One Code, an open-source coding agent.
Why it matters
Many people find AI agents confusing or magic. This book shows that they are built from simple parts. Students and developers can read the code, understand each step, and learn how to build their own agent.
Glossary
- LLM
- Large language model: an AI system trained on lots of text that predicts and writes words.
- Harness
- The program that builds, keeps, and protects the message list sent to an AI model.
- JSON
- A simple text format for storing data as keys and values, often used by programs to talk to each other.
- One Code
- An open-source coding agent, built on the pi project, that the author uses for ideas in the book.