Coding agents like Claude Code, Codex, Cursor, and GitHub Copilot can explore repositories, edit files, execute commands, run tests, and solve engineering problems with minimal supervision.
But what if you wanted to build one yourself?
Production coding agents are complex. They handle context management, code editing, terminal execution, permissions, sandboxing, and much more.
But the core idea is surprisingly simple. Give a language model access to a few tools, then create a loop where it can use those tools, observe the results, and decide what to do next.
In this chapter, we'll build a simple coding agent from scratch using Python. It will explore a repository, read files, modify code, and run tests to verify its changes.
Our goal isn't to recreate Claude Code or Codex. It's to build the smallest useful agent that helps us understand how these systems actually work.