Building Autonomous AI Agents That Actually Ship Code
Chet
Everyone has watched the flashy demo where an AI agent 'builds an app in five minutes.' Then you point it at a real codebase and it deletes your migrations. The gap between demo and production is not the model — it is the harness around it.
The planning loop
A durable agent separates thinking from doing. Each iteration produces a plan, executes exactly one tool call, then re-reads state before deciding the next step. No blind multi-step chains.
- Plan → single action → observe → re-plan
- Every file edit is verified by re-reading the file, never assumed
- Tests run after each change, not at the end
Sandboxing tools
Give the agent a git worktree, not your working directory. If it goes off the rails, you throw the worktree away instead of your afternoon.
The verification gate is the single highest-leverage component. An unverified diff is a hallucination with a filename.
if (!await runTests()) { revert(); replan(); }Ship the harness, not the hype.