How to Build an Agent (Ampcode)
Thorsten Ball (Amp) writes a step-by-step tutorial building a code-editing agent in <400 lines of Go. Subtitle: “The Emperor Has No Clothes.”
Key Claims
- “It’s an LLM, a loop, and enough tokens” — there’s no secret behind agent behavior
- Agent definition: “an LLM with access to tools, giving it the ability to modify something outside the context window”
- Tools are just structured “wink if you want me to X” — models are trained and fine-tuned for this
- The entire agent is: conversation loop → tool definitions → tool execution → result feedback → continue
- A fully functional code-editing agent needs just 3 tools:
read_file,list_files,edit_file - “The rest, the stuff that makes Amp so addictive? Elbow grease.”
Tutorial Structure
- Basic chat loop (90 lines) — conversation management
- Tool definitions — name, description, input schema, function
- Tool use loop — when model’s
stop_reasonistool_use, execute and continue - Three tools build a capable agent
Takeaways
- The “emperor has no clothes” framing: agents look magical but the core loop is simple
- The server is stateless — all state management is on the client side
- Models are “very eager” to use tools — they “know” they can get more information
- The complexity is in the tooling, prompt engineering, and edge case handling, not the loop itself
- This is the Amp team’s philosophy: simplicity first
Connections
- How to Build an Agent (existing page) — overlapping topic
- Agent Definition — Simon Willison — agent taxonomy
- Coding Agents — the practical pattern
- Harness Engineering — “elbow grease” = harness engineering