On a stone lectern by lantern light, the Gopher, clipboard in hand, reads a great open book while the kneeling Ghost, a stone android, turns a page.

Reference

Glossary

The vocabulary of building AI agents, from agent and harness to idempotency key and tool poisoning, each in a sentence or two, with a link to the guide that covers it.

Updated

Short definitions of the terms this guide uses. Where a guide covers a term in depth, its entry links to it.

A

Ablation

Running the agent with a single component removed, next to the complete agent, so the difference in results shows what that component is worth.

Adapter

A thin layer that lets code written against one interface use something with a different one. In the companion code, an adapter makes each tool an MCP server offers look like an ordinary agent tool, so the loop needs no changes.

Agent

A program that lets a model pick its next action, one turn at a time, looking at the results of the actions so far, and keeps going until the job is finished or a limit ends the run. The agent loop in Go

Agent event

A notice the harness emits while a run is in progress, at the moment each thing happens: the model produced some text, the model finished writing a tool call, a tool returned, a turn ended, or the run ended.

Agentic loop

What the harness does each turn, in four steps: assemble the request, send it to the model, execute any tools the model asked for, then decide whether another turn is needed. The agent loop in Go

API key

A secret string that identifies your account to a service. A program sends it with each request, and the service bills that account. Keep it out of source code; the examples read it from the OPENROUTER_API_KEY environment variable. See OpenRouter.

Approval

A yes from a person, which the harness records, allowing a single specific action to proceed. Asking a person before a risky tool call

At least once

A delivery guarantee under which an action is never lost but may run more than once. You get it by retrying until a reply comes back.

At most once

A delivery guarantee under which an action never runs twice but may not run at all. You get it by never retrying.

Attempt marker

A note the harness writes right before a call that could change the outside world, saying the call is starting. A marker with no saved result beside it means the call may or may not have happened.

Attention

The part of a model that lets each position in the text look back over itself and all earlier positions, score them by relevance, and mix in information in proportion to those scores.

Attenuation

Handing a narrower credential to someone who acts for you, such as a sub-agent: each handoff can remove permissions and none can add them back. Agent identity shows it in Go.

Audit log

A record that is only ever appended to, saying who made each decision and when, so anyone can verify the decision afterward.

B

Backend for frontend

A web app’s server acting as its OAuth client, so every token stays on the server and the browser holds only a session cookie. RFC 10017 describes it for browser-based apps. See OAuth and OpenID Connect.

Backoff

Increasing the wait before each retry, commonly doubling it, so a client that keeps failing puts less load on the server over time instead of more.

Barrier

A point that work can’t pass in either direction: all the work before it must finish first, and none of the work after it starts until then.

C

Channel (Go)

A typed pipe that passes values between goroutines. A send waits until a receiver takes the value (or until there is room, for a buffered channel), and closing a channel tells receivers that no more values are coming. Goroutines with an owner

Chat template

The rules a specific model uses to flatten a list of messages, plus any tool definitions, into the single stream of text it saw during training. Different model families use different templates.

Checkpoint

A saved snapshot of a run’s state, written in a way that survives a crash at any instant: what’s on disk afterward is always a whole snapshot, either the old one or the new one. Durable agent runs: checkpoints, resuming, and doing things exactly once

Chunk

A piece of a document small enough to search and to send to a model on its own, such as the text under one heading. Retrieval embeds and searches chunks rather than whole documents. See RAG in Go.

Circuit breaker

A guard placed in front of a dependency. After a string of consecutive failures it trips and fails calls immediately without sending them; after a pause it allows a single probe call through to find out whether the dependency is back.

Compaction

Shrinking the request by swapping the oldest part of the conversation for a model-written summary of it.

Confused deputy

A program that holds authority and is tricked into using it for someone who shouldn’t have it. A prompt injection is mostly this attack: the agent holds the user’s authority and acts on text an attacker planted. See agent identity.

Context (Go)

Go’s context.Context, passed as the first parameter of every function that does I/O or can block, carries cancellation, a deadline, and a cause down a chain of calls. Not to be confused with a model’s context window. See context.Context in an agent.

Context policy

The code that decides which parts of the full conversation go into each request. Common policies send everything, drop old turns, clear old tool results, or summarize.

Context window

The text a model can take into account on one call, and its maximum size in tokens. The prompt and the reply share it, so a long prompt leaves less room for the answer.

Cosine similarity

A measure of how closely two vectors point the same way, ignoring their length: 1 for the same direction, near 0 for unrelated ones. Retrieval uses it to find the chunks whose embeddings are closest to a question’s.

Cost budget

A cap, in dollars, on what a run may spend. The harness checks it before every call to the model.

Crash catalog

The 32 triage tasks the companion code seeds for its examples and evals. Each task bundles crash reports made by sending requests to the practice service, remind; the answer the agent ought to reach; hidden tests for its fix; and the issues already on file.

Crash group

A set of crash reports with a single underlying cause. Grouping is a judgment call: the same bug can crash in several different stacks, and two different bugs can produce the same stack.

Crash report

Everything captured about one crash: the panic message and stack trace, the version of the program that crashed, the request it was handling, and the last log lines before it.

Crash-triage agent

The agent the companion code builds from chapter 7 on. It reads crash reports from remind, a small reminders web service with bugs seeded on purpose, groups them by cause, writes a test that reproduces each bug, fixes the code, and files one issue per cause in an issue tracker. One crash report, triaged by an agent

D

Data marker

A random boundary string, new each time the program runs, wrapped around any text that came from outside the harness. The prompt says that anything between the markers is data, which the model must not obey.

Deduplication

Using an ID that the sender attached to a message to spot a repeat of something already handled, so a message delivered twice acts as if it arrived once.

Delegated credential

A token that lets a program act for one user, limited to named permissions (scopes) and a short life, in place of the user’s password or a key shared by everyone. See agent identity.

Delta

A fragment of a reply that arrives over a stream. Each delta carries one of four things: some text, a piece of a tool call, the usage, or the finish reason.

E

Egress

Anything that flows out of a system. For the crash-triage agent in these guides, that includes the text of each issue and comment it files.

Embedding

A vector, a list of numbers, that represents a token. Training adjusts the vectors so tokens that appear in similar contexts end up with similar vectors. Production models use a few thousand numbers per vector.

An embeddings model does the same for a whole text: one vector per passage, placed so that passages about similar things are close together. Retrieval compares those vectors to find the passages that match a question.

Eval

An eval measures how well a model, a prompt, or an agent performs a task by running it many times against a real model, scoring each run, and reporting the result as a rate. Evals for an AI agent whose answers vary

Eval set

A fixed list of tasks, each with its starting inputs and the checks a result has to pass. Because it runs identically every time, it lets you compare one version of an agent with another.

Exfiltration

Moving data to an outsider who shouldn’t have it, usually through a channel the system has for some other job.

F

Fan-out

Splitting one job into parts and having the harness run an agent on each part at the same time, then gathering their results.

Fingerprint

A short identifier derived from a crash report. The goal is that crashes from one cause share a fingerprint and crashes from different causes don’t.

Finish reason

The field in each reply that says why the model stopped generating: it was done (stop), it ran out of room (length), it wants tools run (tool_calls), a content filter cut it off (content_filter), or the provider hit an error (error). Tool calling in Go, on the wire

G

Goroutine

A function running at the same time as the rest of the program, started with the go keyword. Goroutines are cheap, so an agent can run many at once, but each needs an owner that knows when it ends. Goroutines with an owner

Graceful shutdown

Ending a process without dropping work or leaving it half finished: refuse new work, complete or save whatever is in progress, then exit.

Grader

Code that tests one run’s result against each of its checks and decides whether the run passed.

Greedy decoding

Choosing the most probable token at every step. It gives the same text each time, and a small model writing a long reply can get stuck repeating one phrase. Temperature 0 asks for it. How a language model picks its next token

H

Hallucination

A model presenting something false with the same confidence as something true. Nothing has malfunctioned: the model produces likely text, and a false statement can be likely.

Harness

Everything in an agent program except the model. The harness carries out the tool calls the model requests, chooses what goes into each request, and decides when the run is over. The agent loop in Go

Hash

A short value computed from some data, such as a SHA-256 digest, that changes completely if any byte of the data changes. Comparing two hashes shows whether two pieces of text are identical without keeping both.

Hidden test

A test kept out of the agent’s view that tries its fix on inputs other than the one in the crash report. A patch that merely prevents the reported panic doesn’t pass.

HMAC

A keyed hash: producing or verifying one requires a secret key, so nobody without the key can forge it. An agent’s audit log can use one, so that an edit to the log can be detected.

Host

A company that actually runs a model behind OpenRouter. OpenRouter routes each request to one of them, and each serves the model with its own account.

I

ID token

A signed token from an OpenID Connect provider that says who signed in, issued for the app that asked, whose client ID is its audience. It is not an access token and is never sent to an API. See OAuth and OpenID Connect.

Idempotency key

A unique name the sender attaches to a request and the receiver stores. When a request arrives with a key the receiver has seen before, it returns the earlier result and doesn’t act again.

Idempotent

Safe to repeat: a second call leaves things exactly as one call did. In the triage agent, run_tests is idempotent; issue_file is not, since a second call files a second issue.

Idle timeout

How long a client will wait on a stream that has gone quiet before abandoning it.

Interrupt

A pause requested by a tool partway through a run, so the run can wait on something external, like a person’s decision, and later pick up from the same point.

Issue tracker

Where a team keeps its list of known problems, for example GitHub Issues or Jira. The companion code ships a small stand-in, tracker, which stores issues in a JSON file.

Iterator (Go)

A function that hands values to a for loop one at a time by calling yield, so for v := range seq works on it the way it works on a slice. iter.Seq[V] is the type of one. Iterators in an agent

J

Jitter

A random amount added to each retry’s wait, so clients that failed at the same moment spread their retries out instead of all retrying at once.

JSON Schema

A standard vocabulary for describing JSON values: the fields an object has, each field’s type, and which fields are required. A tool definition uses one to describe its arguments. Tool calling in Go, on the wire

JSON-RPC

A small protocol for remote method calls carried in JSON. A request has an ID, the response repeats that ID so the caller can match the two, and a notification gets no response at all. MCP uses it as its message format.

L

Language model

A program that takes text and returns a probability for every possible next piece; it writes by next-token prediction.

Least privilege

Granting a program the capabilities its task requires and nothing else, so a bug or an attacker has nothing extra to misuse.

Logprobs

For each token the model wrote, the logarithm of the probability it assigned to that token, and optionally the top alternatives it considered at the same spot. Exponentiate to get the probability back: a logprob of -1.11 is about 0.33.

M

MCP

The Model Context Protocol: an open standard that lets one program expose tools and data, and lets an agent in another process or on another machine find and call them. MCP in Go: a client and a server, both sides One sentence in a tool description decided 79 of 80 first moves

MCP gateway

One MCP server that agents connect to, in front of the MCP servers that do the work. It decides every tool call against a policy, publishes only tools an operator approved, gets each server behind it a token of its own instead of passing the agent’s on, keeps the audit log, and can cut off a user, an agent, or a tool in one place. See agent gateways.

Median

The middle value once results are sorted: half the runs came out lower and half higher. It is used instead of the average when one unusual run would pull the average far off.

Memory

What an agent keeps from one conversation to the next: text saved outside the conversation, and a rule for which of it goes into the next one. A common form is short notes the agent saves with a tool and that are recalled by meaning. See memory between sessions.

Message

A single entry in a conversation with a model, tagged with a role for its sender: system for instructions, user for whoever is asking, assistant for the model, and tool for a tool’s output. The conversation is the ordered list of messages so far.

Middleware

A wrapper around each model or tool call that runs extra code before and after it, such as retrying or enforcing a timeout. Neither the wrapped call nor the loop has to know it is there.

Model

Short for large language model (LLM): a system trained to continue text. Your program sends it text through an API and gets back its prediction of what follows.

Model-as-judge

Asking a model to score another model’s output against a written rubric, for outputs that code can’t check.

N

Native API

The API a provider built for its own models. A compatible API, by contrast, imitates another provider’s request and reply format.

Next-token prediction

How a language model writes: it gives every possible next token a probability, one is chosen, the token is added to the text, and the model predicts again from the longer text. Every reply, a tool call included, comes out this way. How a language model picks its next token

O

OpenID Connect

A sign-in layer on OAuth 2.0: the app asks for the openid scope and gets an ID token saying who the user is, alongside the access token. See OAuth and OpenID Connect.

OpenRouter

A service that puts many model providers behind a single API, so one key and one bill cover all of them. You pick a model by ID, and OpenRouter sends the request to a provider that runs it.

Orchestration graph

A program written as nodes, such as a model call, a tool call, or a branch, joined by edges. A framework executes the graph and takes care of checkpointing and resuming it.

P

Parallel tool calls

More than one tool call in a single reply. The harness can run them concurrently; the model only asks for them and never executes anything itself. Running an agent’s tool calls in parallel with goroutines

PKCE

Proof Key for Code Exchange (RFC 7636): the client sends the hash of a random secret with its authorization request and the secret itself when redeeming the code, so a code stolen in between is useless. See OAuth and OpenID Connect.

Pass rate

Of an eval’s scored runs, the share that passed every check, averaged per task so each task has equal weight. Report it with its range, how many tasks and runs it covers, and how many runs couldn’t be scored.

Prompt caching

A provider saving the computation it did on the opening tokens of a request, then charging less to reuse that work when a later request begins with the identical tokens.

Prompt injection

Instructions planted in an agent’s input by someone other than its user, which the model then carries out as though its user had given them. Prompt injection and sandboxing: defenses that don’t rely on the model

Protected path

A file or directory the agent can’t modify unless a person approves.

Protocol version

A date that identifies a revision of MCP, for example 2026-07-28. Starting with that revision, every request includes it in its _meta field.

R

RAG

Retrieval-augmented generation: search a set of documents for the passages closest to a question, then send them to the model with the question and ask it to answer from them alone. See RAG in Go and RAG or agentic search?.

Range

The interval of plausible values for a measured number, allowing for how far chance could have moved it. These guides use the central 95 percent of results the measurement would give if repeated on a new sample of the same kind.

Refresh token

A long-lived credential an OAuth client exchanges for new access tokens while the user is away. With rotation, each works once and a reused one revokes its whole family. See OAuth and OpenID Connect.

Rate limit

A cap a provider sets on the requests or tokens one caller can send per period. Anything beyond the cap is rejected with HTTP 429.

Read-only tool

A tool that only reads, such as code_read or crash_list: calling it has no effect outside the run.

Reasoning model

A model trained to produce reasoning tokens before it answers. The reply usually hides those tokens or shows a summary, but you pay for them as output.

Reproducer

A test the agent writes that fails on the code as it was and passes once the fix is applied, which shows the fix changed the behavior that crashed.

Retry budget

A pool of retries shared by everyone calling a service. Failures draw it down and successes refill it, so when most calls are failing, retrying stops.

Run state

All a run needs to carry on once its process has exited: the conversation, the money spent so far, anything it is waiting on, and the step it was in the middle of.

S

Sampling

Choosing the next token at random in proportion to the model’s probabilities, instead of always taking the most probable one. APIs sample by default, which is the main reason the same request can get different replies. How a language model picks its next token

Sandbox

Limits on what code may read, write, or connect to, enforced from outside that code so it can’t lift them itself.

SDK

A library a provider publishes for using its API from a particular language. It typically includes request and response types and a client, and often helpers for retries and streaming.

Sentinel error

An exported error value that callers compare against with errors.Is, such as io.EOF or an agent’s ErrMaxTurns. Sentinels can be grouped into families by wrapping one in another, so a caller can check a whole family at once. See errors in an agent.

Server-sent events

A simple format for streaming messages from a server over an HTTP response that stays open. A message travels on lines beginning data: and ends at a blank line; a line beginning with a colon is a comment.

Settled

Describes a call whose saved answer shows either that it completed or that it never started. The harness never runs a settled call again.

Side effect

A lasting change a tool makes beyond the run, for example an edited file or a filed issue; it is still there when the run is over.

Span

One timed step in a trace. It records its parent span, when it started and ended, its attributes, and an error if there was one. Turns, model calls, attempts, and tool calls each get a span.

Stack trace

The chain of function calls active at the moment a program panicked, listed from the innermost call outward, each with its file and line number.

Stop reason

The harness’s account of why a whole run ended: it got an answer, hit a limit, was cancelled, or failed with an error. Compare the finish reason, which explains only why a single reply ended. Why did the agent stop?

Struct tag

The backtick text after a field in a Go struct, such as `json:"finish_reason"`. It tells the JSON decoder which JSON name belongs to that field. The code puts an explicit tag on every field that comes from an API, because encoding/json/v2 matches names exactly, case included. Common first errors shows what a missing tag looks like.

Structured outputs

An API option that forces the model’s reply to fit a JSON Schema, so your code can decode it directly instead of parsing free text. Structured output: an agent’s answer in a fixed shape

Sub-agent

A separate agent loop that a tool of another agent starts, with its own empty context, to handle one self-contained task and return a report. Sub-agents in Go, and when a fresh context helps

Supply-chain attack

An attack that comes in through something a project depends on (a library, a tool, a build step) rather than through the project’s own code.

System prompt

The first message in a conversation, with the role system, holding instructions that apply throughout: what the model’s job is and how it should respond.

T

Temperature

A setting applied to the model’s probabilities before a token is chosen. Below 1 the favorite wins more often, and 0 means always taking it; above 1 unlikely tokens are chosen more often, and replies start to fall apart. How a language model picks its next token

Threat model

A brief inventory of what in a system is worth protecting, where untrusted input gets in, and what the system is able to do with that input, used to tie each defense to a specific risk.

Token

The unit of text a model reads and writes. A token can be a whole common word, a fragment of a longer word, or a punctuation mark; in English a token is about four characters on average.

Token exchange

Swapping a token that proves who a user is for a new one with a narrower audience, fewer scopes, and a short life, as defined by OAuth 2.0 Token Exchange (RFC 8693). See agent identity.

Tokenizer

The program that converts text into tokens and tokens back into text. It has a fixed vocabulary, usually between 100,000 and 250,000 tokens, each assigned a number, and the model works entirely in those numbers.

Tool and tool call

A tool is an action your program offers to perform for the model, like reading a file or running tests, which the model knows by a name and a description of its inputs. A tool call is the model’s request to run one of those tools with specific inputs, for example read_file on duration.go. Tool calling in Go, on the wire

Tool definition

The description of a tool sent to the model: a name, a plain-language explanation of what it does, and a JSON Schema for its arguments. Tool calling in Go, on the wire

Tool poisoning

Hostile instructions planted in a tool’s description or schema to steer the model that reads the definition. Since definitions reach the model before any tool runs, it is prompt injection that acts before the first call. One sentence in a tool description decided 79 of 80 first moves

Tool result

What a tool returned, delivered to the model as a tool message tagged with the ID of the tool call it responds to. Tool calling in Go, on the wire

Trace

A record of one unit of work, such as a single agent run, organized as a tree of steps, each with its timing.

Transport (Go)

The http.RoundTripper inside an http.Client, the part that actually sends an HTTP request and returns the response. Swapping it lets a test replay recorded responses without touching the network.

Tuning set and confirmation set

Two separate groups of tasks. You may try a change against the tuning set while you develop it; the confirmation set judges the finished change and is never used during development.

Turn

One trip around the loop: the harness sends the model the whole conversation so far, gets a reply, and acts on it. The agent loop in Go

Turn limit

A cap on how many turns a run can take before the harness ends it. A loop without one can keep running, and charging you, indefinitely. The agent loop in Go

Type parameter (Go)

A type written in square brackets after the name of a generic function or type, as in errors.AsType[*APIError](err) or iter.Seq[Event]. The brackets say which type the code works with this time.

U

Unscored run

A run cut short by a failure in the harness or at the provider, so its result tells you nothing about the agent. Such runs are counted and reported, excluded from the pass rate, and rerun.

Usage

The token counts the API returns with each reply: input tokens, output tokens, and on OpenRouter the dollar cost of the call. Tool calling in Go, on the wire

V

Finding the stored vectors closest to a query vector, usually by cosine similarity. For a few thousand vectors, comparing the query with every one is fast enough; larger sets use a vector index, which finds close vectors without comparing them all.

W

Wire format

The JSON exactly as it travels over HTTP, as opposed to the Go types a program uses to build and read it.

Workflow

A program that calls a model at points its code decides ahead of time. In an agent, by contrast, the model picks the next step. Workflow or agent? The shapes, in Go

Workload identity

An identity the platform gives a running program, so it can prove what it is without a stored password; cloud IAM roles and SPIFFE work this way. See agent identity.

Workspace

A separate copy of a codebase made for one run, which the agent reads and edits so the original is never touched.