Field notes from working through example 31 of Ardan Labs’ Ultimate AI course by Bill Kennedy and Florin Pățan (Apache 2.0). My fork: PratikDhanave/ai-training. Thank you Bill and Florin for teaching this material — the patterns in this post are derived from the course; the production reflections at the end are mine.
What the example teaches
A coding agent: tools for reading files, writing files, searching the directory, running commands, plus the loop that ties them together. A scoped-down version of what Cursor and Claude Code do, in a few hundred lines of Go you can read end-to-end.
What it looks like
tools := []Tool{
{Name: "read_file", Schema: schemaRead, Run: doRead},
{Name: "write_file", Schema: schemaWrite, Run: doWrite},
{Name: "search", Schema: schemaGrep, Run: doGrep},
{Name: "run_command", Schema: schemaCmd, Run: doRun},
}
for {
resp := llm.Chat(ctx, history, tools)
if resp.Stop { break }
for _, call := range resp.ToolCalls {
result := tools[call.ToolID].Run(call.Args)
history = append(history, toolResult(call.ID, result))
}
}
What I learned
Coding agents are simpler than they look in the marketing. The loop is small. The intelligence is in the tool design and the prompt — not in clever orchestration.
The hard part is the tool-result format. How do you serialize a grep result so the LLM can use it? How do you truncate without losing context? Those decisions matter more than the orchestration loop.
Production connection
I use Cursor and Claude Code daily. Reading this example let me reason about why certain prompts work and others don’t — the loop is doing exactly what I expected, and the prompt is the lever.
Credit & reference. This post is field notes on example 31 from Ardan Labs’ Ultimate AI by Bill Kennedy + Florin Pățan, licensed Apache 2.0. The original example: cmd/examples/example31-coding-agent/. My fork with notes: PratikDhanave/ai-training. Highly recommend the course for anyone building AI applications in Go — the material is rigorous and the Kronk + yzma + llama.cpp pipeline gives you hardware-accelerated local inference end-to-end. Thank you, Bill and Florin.