Why throw away 132 working files and start over? This book follows a real rewrite of an agent runtime — v1 forked from an agent engine, v2 built from the ground up — and examines 14 dimensions where the two made different choices. Code examples are presented in Python.
- Back Cover — Audience, promise, and key takeaways
- Chapter Inventory — All chapters with one-line descriptions
- Parts Summary — How the six parts connect
- Terminology Register — Canonical terms and style conventions
| # | Chapter | Focus |
|---|---|---|
| 1 | The Turn That Couldn't Crash | v1's monolithic await, topology baggage, mid-migration shapes |
| 2 | Reading Other People's Runtimes | Shape audit of claude-code and codex-rs across 9 dimensions |
| # | Chapter | Focus |
|---|---|---|
| 3 | Contracts | 10 v1 seams vs 5 v2 seams; what survived and why |
| 4 | The Single Construction Seam | SessionFactory as the one composition root |
| 5 | The Turn | The 4-phase journal, AgentTurnJournal as a state machine |
| # | Chapter | Focus |
|---|---|---|
| 6 | The Journal | Four phases, four points of no return |
| 7 | Resume and Repair | classify_submission_state, 7 resume modes, pure-function recovery |
| # | Chapter | Focus |
|---|---|---|
| 8 | Tools as Factories | Trust-scoped tool factories with Pydantic validation |
| 9 | The Sandbox Boundary | 11-operation SandboxApi contract, three backends |
| # | Chapter | Focus |
|---|---|---|
| 10 | Workflows | agent/parallel/pipeline DSL, coordinate paths, contextvars |
| 11 | The Sandbox | Subprocess isolation, restricted builtins, DoS budgets |
| # | Chapter | Focus |
|---|---|---|
| 12 | From Runtime to Fleet | JSON-RPC transport, firewall, topology separation |
| # | Chapter | Focus |
|---|---|---|
| 13 | The Shape Gaps | Seven ranked gaps (G0–G6), build order |
| 14 | Conclusion | Three design moves: shape audit, single seam, durable envelope |