AI Engineering
Building Autonomous Coding Agents
Design, Safety, and Local-First Operation of Unattended AI Development Systems
Build agents that write code, fix tests, and commit changes while you sleep — safely, cheaply, and entirely on your own hardware.
About this book
**Building Autonomous Coding Agents** is a code-first, ground-up guide to the specific engineering discipline that decides whether letting a language model act on a real codebase unsupervised is a responsible decision or a gamble: not a better prompt, but a system around the model that bounds what it can do, verifies what it claims, and stays accountable when it fails. The book exists because the industry conversation about autonomous coding agents has largely stayed at the level of capability claims and anecdote, while the actual question — what architecture makes a given amount of delegated authority safe to grant — has a precise, buildable answer that most treatments skip. This book builds that answer in full, in runnable Python, rather than surveying it in the abstract.
The material progresses as a single cumulative build rather than a tour of unrelated techniques. It opens by defining autonomy itself as delegated authority over action and establishing a four-level spectrum from suggestion to fully unattended operation, then constructs a minimal five-phase agent loop and hardens it, chapter by chapter, with the components real unattended operation requires: three interchangeable planning strategies, a durable SQLite memory that survives a mid-run crash, a validated tool-dispatch layer that turns model mistakes into recoverable data instead of crashes, a Docker sandbox that contains the blast radius of a wrong command, a persistent systemd-managed runner that works a task queue overnight, workspace briefing that stops the agent from rediscovering the same facts on every task, seven concrete runtime guardrails for seven named failure patterns, an evaluation and observability stack that replaces anecdote with measurement, three patterns for coordinating multiple agents when — and only when — that is actually justified, local-first model serving with a privacy-enforced routing policy, and a full operational safety layer of policy-as-code, approval gates, human override, audit trails, and incident response. Everything converges in a capstone Build-Verify-Fix daemon that assembles all of it into one bounded, reviewable system, and the book closes by showing how that same system is wrapped around an external agent SDK without surrendering its boundaries, and how it is operated as a small pool once a single runner is no longer enough.
Readers finish with concrete, transferable capabilities rather than familiarity with one framework: the ability to design a control loop with explicit, runtime-enforced termination; to build a tool layer that survives argument hallucination and malformed input without crashing; to contain command execution in a real sandbox and prove the containment holds with tests against actual Docker; to give an unattended system durable memory, crash recovery, and an audit trail an operator can trust more than the agent's own self-report; to detect and bound the specific ways autonomous agents fail rather than hoping they won't; to measure whether a change to an agent's prompt, model, or planner actually helped instead of guessing; and to reason clearly about when a second agent, a local model, or an external SDK earns its added complexity rather than merely sounding more advanced. The material is thoroughly hands-on: every chapter builds working code, includes a lab that exercises it against real failure conditions (a simulated crash, a path-traversal attempt, a deliberately induced infinite loop, a policy violation), and closes with a chapter summary, an outcomes checklist, and interview-style questions that test the underlying reasoning, not just recall.
This is a book for engineers who already ship software and are deciding how much authority to hand a language model over their own codebase — senior developers building internal tooling, teams evaluating or building agent platforms, and anyone who has to defend an autonomy decision to a colleague or a security review rather than simply hope it works out. It assumes solid Python and ordinary familiarity with tests, containers, and running a service, but assumes no prior experience building agents specifically. Readers looking for a survey of agent products, a promise of unsupervised production deployment, or a shortcut past the engineering will not find it here; readers willing to build the real system, one enforced boundary at a time, will finish with an autonomous coding agent whose limits they can state precisely — because they built every one of those limits themselves.
More books
-
AI Engineering
Agentic Coding Harnesses, Compared & Explained
Master Claude Code, Aider, OpenCode, Goose, and Codex — Then Run Them Locally
-
AI Engineering
AI-Assisted Development
Working With Coding Agents
-
AI Engineering
The Model Context Protocol (MCP) in Practice
Building, Integrating, and Scaling Custom Tool Servers for AI Agents