Start here
Four reading paths through the site, each an ordered list of guides, for learning how agents work, for shipping one at work, for leading a team that builds them, and for the Go an agent depends on.
This site is for Go developers who want to build AI agents and understand what happens inside them. It assumes you can write and run Go code; nothing about models or machine learning is assumed, and none of the examples needs an API key. New to Go? Finish the Tour of Go first; Getting set up lists what to brush up on.
Pick the path that matches why you’re here; every guide on it links to the next step.
Learning how agents workYou write Go and have never built an agent.
Shipping an agent at workYou know the loop and have a deadline.
Leading a teamYou decide whether a team spends its time here.
The Go underneathYou know Go from the Tour and want the parts agents lean on.
Learning how agents work
For a Go developer who has never built an agent: set up, make a first model call, build an agent from scratch, then learn what it costs, how to design its tools, and how to test it. If a guide’s Go is unfamiliar, the Go underneath path covers the parts it uses.
Phase 1
Get oriented
Set up, and see what an agent is before any model is involved.
- Getting set upGo 1.27, the companion code, offline and live runs, and the newer Go features the code uses.
- What an agent isWhat makes a program an agent, followed through one run that fixes a failing test.
- ch01: A scripted agent loopA complete agent loop that fixes a failing test from a script. No key, no network.
- The agent loopThe whole agent loop in about 30 lines of Go, read stage by stage.
Phase 2
Talk to a model
Make a first call, and learn the shape of every request and reply.
- Your first model callAn API key, one request with curl, and every part of the reply, including what it cost.
- Messages and rolesThe four roles in a conversation, the Go type that holds them, and how to write a system prompt.
- Calling a model from GoA chat completions client in standard-library Go, with deadlines, error checks, and finish reasons.
- Common first errorsA missing key, no credit, a bad model ID, rate limits, cut-off replies, and two Go traps.
Phase 3
Build an agent
Give the model tools, watch a real agent work, then write your own.
- Tool calling on the wireA tool call as raw JSON, how a Go client sends and reads one, and the rules that keep it valid.
- ch04: A real agent fixes a failing testThe same loop on a real model’s recorded replies, with go test running for real.
- Build your first agentA complete agent in a few short files of standard-library Go, run offline and then on your own files.
Phase 4
Understand the model
What each turn costs, how a model picks its words, and which model to use.
- Tokens, cost, and contextHow an agent’s requests grow each turn, what a run costs, and why the context window misleads.
- How models pick the next tokenA toy model in Go shows why answers vary, what temperature does, and why a tool call is text.
- Choosing a modelTool support, cost per finished task, reasoning models, local models, and how to compare.
Phase 5
Make it dependable
Tools a model uses well, stopping safely, the right shape, and tests.
- Designing toolsWhat the model sees of a tool, and how to write names, schemas, results, and errors it uses well.
- Why the agent stoppedNaming every way a run can end: typed errors, budgets, reply checks, and cancellation.
- Workflow or agent?Five shapes of program that call a model, and how to pick the simplest one that handles the task.
- Testing an agent offlineTesting an agent without a live model: scripted models, replayed HTTP, and outcome checks.
Phase 6
See where it leads
A finished agent, measured on real tasks.
Shipping an agent at work
For an engineer who knows the loop and has a deadline: decide between a workflow and an agent, then work down the launch checklist, one guide per item.
Phase 1
Decide the shape
A workflow or an agent, and what a launch needs.
- Workflow or agent?Five shapes of program that call a model, and how to pick the simplest one that handles the task.
- Launch checklistTwenty-four checks for an agent that runs unattended and spends money.
- Measured mistakesTwelve failures from recorded runs, each with how often it happened and what the code changed.
Phase 2
Design it
Tools and context, which decide most of the quality and the cost, and replies in the shape your code needs.
- Designing toolsWhat the model sees of a tool, and how to write names, schemas, results, and errors it uses well.
- Context managementFive ways to keep a long run affordable and on task, and what each did on a 99-report batch.
- Structured outputGet a typed, checked answer from any tool-calling model by making the answer a final tool.
- Streaming repliesReading a reply that arrives as it is written (server-sent events) in Go, and rebuilding tool calls from fragments.
Phase 3
Make it reliable
Named stops, retries, and traces.
Phase 4
Test it
Offline tests, and evals that tell a real change from chance.
Phase 5
Make it safe
Sandboxes, injection defenses, a person's approval, and credentials scoped to one user and one run.
- Prompt injection and sandboxingA threat model, a ladder of sandboxes, and five layers of defense against prompt injection.
- Human approvalPutting a person in front of risky tool calls, with a gate the model can’t route around.
- Agent identityWhose rights an agent uses, how to hand them over safely, and how to prove afterward who did what.
Phase 6
Run it for real
Runs that survive a crash, a service, and the provider client, libraries, and framework to pick.
- Durable runsSurviving a crash without losing work or doing it twice: checkpoints, locks, and idempotency keys.
- An agent as a serviceRunning an agent unattended: restarts, shutdown, secrets, a work queue, budgets, and reviews.
- Providers and SDKsOne agent loop on providers whose APIs disagree, with each SDK behind your own interface.
- Libraries and SDKsEvery SDK and framework the book’s code uses, with its version, its strengths, and its costs.
- Go agent frameworks comparedFive Go agent frameworks set against the parts of a harness, with one task ported and measured.
Phase 7
See the result
The finished agent, measured.
Leading a team
For whoever decides whether a team spends its time here: what the work costs, what the team ends up able to build, the risks and how they’re handled, and what’s left out, mostly without code.
Phase 1
The case
What the work costs, and when an agent is the right tool.
- For leadsA short page for whoever approves a team’s time on AI agents in Go. What live runs cost, what the team ends up able to build, the risks and how the material handles each one, what it leaves out, and how to get a team started.
- Workflow or agent?Five shapes of program that call a model, and how to pick the simplest one that handles the task.
- Workflow or agent, measuredOne Go bug fixed by a three-step workflow and by an agent, on four models: cost, speed, failures.
Phase 2
The risks
What goes wrong, whose authority an agent acts with, and what a launch needs.
- Measured mistakesTwelve failures from recorded runs, each with how often it happened and what the code changed.
- One sentence decided 79 of 80 first movesOne sentence in an MCP tool’s description steered four models’ first move in 79 of 80 replies.
- Agent identityWhose rights an agent uses, how to hand them over safely, and how to prove afterward who did what.
- Launch checklistTwenty-four checks for an agent that runs unattended and spends money.
Phase 3
The results
What the finished agent achieved, how it was measured, and where else it applies.
- The finished agentThe book’s final agent on 20 held-out tasks and three models: pass rates, costs, and failures.
- Beyond crash triageThe book’s agent triages crashes in a Go service, and its parts carry over to agents with other jobs. A support-ticket resolver, a SQL analyst, and a research assistant, each with the shape it needs, what goes wrong without the right parts, and how to measure it.
- Evals for an agentHow to tell whether an agent is good, and whether a change made it better.
- Two identical runs, 15 points apartThe same agent, run twice, scored 15 points apart. How to tell a real improvement from chance.
Phase 4
The fit
What's left out, and why Go.
- What this coversThe ground this site and Building AI Agents in Go cover, the topics the site covers beyond the book, such as retrieval and memory between sessions, the topics both leave out on purpose, such as multi-agent planning, and why, so you can tell before reading whether they answer your question.
- Why GoWhere Go’s standard tools did an agent’s work in the book’s code, with numbers, and what Go costs.
The Go underneath
For a Go developer who knows the language from the Tour and wants the parts an agent depends on: interfaces and generics, cancellation, errors, JSON, HTTP, streams, concurrency, and files, each shown in tested agent code.
Phase 1
How the parts fit
Small interfaces, wrappers around them, and tools typed by their arguments: the shapes the rest of the code is built from.
Phase 2
Control and failure
How a run is stopped, and how every failure is named and routed.
Phase 3
Talking to a model
The JSON, the HTTP client, and the streams every model call is made of.
- JSON v2 for model APIsWhat changed from encoding/json, and the parts of v2 an agent leans on, each checked in Go 1.27.
- An HTTP client for model APIsOne shared client, deadlines on the context, size limits, errors inside a 200, and honoring Retry-After.
- Streams in GoReading and writing a stream in Go: io.Reader, bufio.Scanner, server-sent events, and flushing.
Phase 4
Doing several things at once
Goroutines with an owner, and iterators for streams and runs.
Phase 5
Touching the machine
Running commands and reading files without letting a model escape its workspace.
Going further

The paths are the shortest routes through the site. When you finish one, these guides go further, grouped by subject:
- More tools, more agents: Patterns by name, parallel tool calls, sub-agents, and MCP in Go, with an agent that files issues over MCP to run.
- Knowledge and memory: RAG in Go, RAG or agentic search?, and memory between sessions.
- Providers and frameworks: how two provider APIs differ, more providers, and one task built three ways: by hand, with Eino, and with Genkit.
- More to run: four crash reports, triaged, and an agent’s progress streamed to a browser.
- The measurements: Research holds every measured result behind the guides, each with its method, including 910 crashes with no duplicates, how a tool error’s wording changed the turns, and fan-out, measured.
All guides lists every page, filtered by the stage of the loop you’re working on.
Browsing instead
To look something up instead of following a path, start at All guides: every guide on the site, grouped by section, with its skill level, and a filter that shows the guides for one stage of the loop first. Each section in the header collects the guides on one subject, search finds a page by its title or headings, and the glossary defines the vocabulary. Every runnable program is listed in Examples, with the command that runs it offline.

