go · intermediate
Build Your Own Coding Agent in Go
Implement a coding agent in Go, one stage at a time. You start with a tiny OpenAI-compatible client and finish with the pieces a tool-using agent needs, including a loop, context limits, and permissions.
0 of 9 stages passed. Copy courses/coding-agent-go/starter and work through the map. The reference solution used by CI is not what you submit.
- 01A minimal LLM API clientSend a chat completion to an OpenAI-compatible endpoint and return the assistant text. Tests use a mock server, so you do not need an API key.Free
- 02A chat loop with historyRead lines from the user, keep the transcript, and print each reply. The harness stubs the model with a function.Free
- 03Tool calls and a registryParse OpenAI tool_calls payloads and dispatch them through a small in-process registry.Locked
- 04A workspace file-read toolLet the model read files inside the project, and reject paths that escape the workspace.Locked
- 05A file edit toolApply one unique search-and-replace edit inside the workspace.LockedPreview
- 06A shell toolRun a command in the workspace with a timeout and captured output.LockedPreview
- 07The agent loopAlternate model calls and tool execution until the model stops requesting tools.LockedPreview
- 08Context managementKeep the transcript inside a character budget without dropping the system prompt.LockedPreview
- 09Safety and permissionsGate each tool behind an explicit policy so a prompt cannot grant itself shell access.LockedPreview