How to build an agent

Thorsten Ball wrote this great blog post a few months back explaining the key concepts of a coding agent

I finally made time to go through it and I learned a lot from it. I liked how he broke down an agent to its essence: a loop, a prompt and an LLM with access to tools. And I also like how he implemented a simple version of a coding agent to bring the point home. If you are curious about the inner workings of coding agents, I suggest you take a look.

Since the original code snippets are in Go, I created a repository with equivalent snippets in Ruby and JS to make it easier for me to understand what is happening. This may make the blog post more approachable if you are familiar with those languages. Fun fact: I used Claude Code on the Claude mobile app to write that code.