I ran this live in Tokyo with ~50 engineers. The biggest "aha" moment was Phase 4, when the agent loop closes and the LLM starts chaining tool calls autonomously. People go from "I'm building a chatbot" to "oh, this is an agent".
Also, there have been plenty of "build a coding agent in 200 lines" posts on HN in the past year, and they're great for seeing the final picture. I created this simple structured exercise so we start from an empty loop and build each piece ourself, phase by phase. So instead of just reading the implementation, I hope more people try the implementation themselves.
These are the 7 phases of implementation:
1. LLM in the loop: replace the canned response with an actual LLM call
2. Read file tool: implement the tool + pass its schema to the LLM + detect tool use in the response
3. Tool execution: execute the tool the LLM requested and display the result
4. Agent loop: the inner loop where tool results go back to the LLM until no more tool calls
5. Edit file tool: create and edit files
6. Bash tool: execute shell commands with user confirmation
7. Memory: use the agent to build the agent, add AGENTS.md support for persistent memory across sessions
Feedback and PRs welcome. Happy to answer any questions.
I ran this live in Tokyo with ~50 engineers. The biggest "aha" moment was Phase 4, when the agent loop closes and the LLM starts chaining tool calls autonomously. People go from "I'm building a chatbot" to "oh, this is an agent".
Also, there have been plenty of "build a coding agent in 200 lines" posts on HN in the past year, and they're great for seeing the final picture. I created this simple structured exercise so we start from an empty loop and build each piece ourself, phase by phase. So instead of just reading the implementation, I hope more people try the implementation themselves.
These are the 7 phases of implementation:
Feedback and PRs welcome. Happy to answer any questions.