You are a software engineer who is skeptical of AI hype.
You have seen the demos. You have tried the frameworks. You have watched your LangChain app hallucinate its way into disaster. And you thought: "There has to be a better way."
There is.
This book is a rebellion against "magic." It teaches you to build a production-grade AI coding agent from scratch with pure Python. No LangChain. No Pydantic. No vector databases. Just code you can debug with print().
By the end, you will have built Nanocode, a terminal-based coding agent that:
- Reads and writes files in your codebase (The Hands)
- Executes shell commands and tests (The Feedback Loop)
- Searches code with
git grep (The Eyes) - Remembers context across sessions (The Memory)
- Asks permission before dangerous operations (The Safety Harness)
You will learn that an agent is just four things:
- The Brain: A stateless API call (Claude, DeepSeek, or Ollama)
- The Tools: Python functions (Read, Write, Run)
- The Memory: A managed context window
- The Loop: A
while True loop that ties it all together
Along the way, you will test everything. You will build a FakeBrain test double that allows you to run full pytest suites instantly—verifying complex agent logic without burning API credits.
The Final Exam: In the last chapter, you will use your agent to build a complete Snake game in Pygame without writing a single line of code yourself. You will speak the plan, and your agent will write, run, debug, and fix the code until the game is playable.
If you can read Python and want to understand what's actually happening inside AI agents, this book is for you.