Glossary
73 terms from AI Agents Basics, in plain words, each with the chapter that teaches it.
A
- Agent
- A program in which a language model decides what to do next, does it through tools, looks at the result and repeats until the job is done. Priya's order-support agent chooses its own lookups, refunds and escalations.
- Annotated
- A Python typing helper that attaches extra information to a type. In the LangGraph example, Annotated[list, operator.add] tells LangGraph to add each node's new messages to the list instead of replacing it.
- Approver
- A function that receives one risky tool call and answers `"yes"`, `"wait"` or a reason for saying no, so a person's decision can gate an agent's action. For example, `priya(call)` stands in for Priya deciding on Ana's $32 refund.
- asdict
- A function from Python's dataclasses module that turns a dataclass such as Run into a plain dict. It lets a paused run be saved as JSON.
C
- Checkpointer
- LangGraph's store that saves the graph's state after every step. It lets a paused run resume, and a database-backed one survives restarts.
- Closure
- A function made inside another function that remembers the outer function's variables. gated() returns a closure that remembers its approver, and orders_of(customer) returns one that remembers the customer.
- COALESCE
- An SQL function that returns its first non-empty value. COALESCE(SUM(amount), 0) gives 0 instead of nothing when an order has no refunds.
- Context editing
- A Claude API feature that clears old tool results (or thinking) by rule, keeping the history short without you summarizing it yourself.
D
- Dataclass
- A Python class that mainly holds data, created by adding the `@dataclass` decorator from the `dataclasses` module, which generates boilerplate such as the constructor. A `Run` object that holds the state of one agent conversation is a typical example.
- Dispatch table
- A dict mapping tool names to the Python functions for exactly the tools offered in one run. A tool not in the table can't run, whatever the model asks.
E
- Edge
- In a LangGraph graph, the link that says which node runs next. In the order-support graph an edge from "model" goes to "tools" or to the end.
- Effort
- A setting for how hard the model thinks: low, medium (Haiku 5.5's default), high, xhigh or max. Low gives faster, cheaper replies for simple steps.
- Escalation
- Handing a case to a person by opening a ticket, done with the escalate_to_human tool. The agent escalates refunds over the limit, requests for a person, and cases the policy doesn't cover.
F
- Framework
- A library that packages the parts you built by hand: the loop, state, approvals, memory and tracing. Examples include LangGraph, the OpenAI Agents SDK, the Claude Agent SDK and Pydantic AI.
G
- GenAI semantic conventions
- OpenTelemetry's standard names for AI spans and attributes, such as invoke_agent for a whole run, chat for model calls and execute_tool for tool calls. They are still marked Development and may change.
- Graph
- In LangGraph, an agent described as nodes (steps) and edges (what comes next) over shared state.
- Guardrail
- A check that runs on a model's input or output, or around a tool call, and can block it. Frameworks such as the OpenAI Agents SDK offer them built in.
H
- Hallucinated tool call
- A model's call to a tool that doesn't exist, or one with invalid arguments such as a number for order_id. The code should check for this before running anything.
- Handoff
- Passing a conversation to another agent. Frameworks offer handoffs, and subagents (helpers for a subtask), to split work between agents.
- Hash
- A fixed-length fingerprint of some text, always the same for the same text. llm.py hashes each whole request to name its cache file.
- Human in the loop
- A design where a person approves some of the agent's actions before they happen. At Kettle & Crane, Priya must say yes to refunds that take an order's total refunds past $20 (the AUTO_REFUND constant).
I
- Idempotent
- Doing something twice has the same effect as doing it once. issue_refund is idempotent: repeating the same refund returns "already done" rather than paying twice.
- Input schema
- The JSON schema that describes a tool's arguments: their names, types and which are required. The model sees it, never your code.
- interrupt()
- A LangGraph function that pauses the graph and hands a value to the caller. On resume, via Command(resume=...), it returns the person's answer, and the thread_id identifies which conversation continues.
- is_error
- Parts of the API's tool protocol. The model sends a tool_use block with an id, and your code must answer with a tool_result carrying the same tool_use_id, with is_error true if the tool failed.
J
- JSON Lines
- A file format with one JSON object per line, which makes it easy to append records and read them one at a time. It suits inboxes, traces and outboxes, because adding a line never erases earlier ones.
- jsonschema
- A Python library that checks data against a JSON schema. The guards use it to reject tool arguments that don't match what the model was told.
L
- Lambda
- A one-line Python function without a name. lambda note: save_note(customer, note) is used to tie a tool to one customer.
- LangGraph
- A framework that runs agents as graphs of steps over shared state, with checkpoints and pause/resume. It can be used to rebuild a hand-written agent, such as Priya's, on top of a ready-made structure.
- Latency
- How long someone waits for a result. An agent's latency is roughly the number of model calls times the time per call, so cutting steps helps most.
- Least privilege
- Giving each part of the system only the permissions its job needs. For example, a status-only agent gets just get_order, and read-only tools use a connection that can't write.
- LLM
- A large language model: an AI model that reads text and decides what to say or do next. In an agent it is the part that chooses the next step, for example `claude-haiku-5-5`.
- Long-term memory
- Facts kept between conversations, such as Bloom Café being closed on Mondays, stored in a database. Your code, not the model, decides whose notes they are.
M
- max_steps
- The loop's two safety limits: max_steps caps model calls per customer turn and max_cost caps dollars for the whole conversation. Hitting either stops the run, and the case goes to a person.
- MCP
- Model Context Protocol: an open standard for sharing tools between apps, so one tool works from any agent. A later book covers it.
- Mode
- The setting, via the AGENT_MODE environment variable, that decides where llm.ask gets replies: auto (replay saved replies, else call Claude), live (always call Claude) or fake (free rule-based stand-in).
N
- Node
- In a LangGraph graph, one step: a function that updates the state. The order-support graph has a "model" node and a "tools" node.
O
- Observability
- Being able to tell what a program did, and why, from what it recorded. It lets you answer why the bot refunded $16 and not $32.
- OpenTelemetry
- The open standard for traces, read by most monitoring tools. Its GenAI conventions name the spans of AI work.
- Outcome
- The state of the world after a run, such as which refunds exist in shop.db. It is graded regardless of what the reply says or how the agent got there.
P
- Parallel tool call
- Several tool calls in one model reply. Ben's order lookup and stock check happened together, saving a round trip.
- pass^k
- The share of test cases that pass all k repeated runs. For a support agent it is the number to watch, because a customer meets one run, not the average.
- Plan-then-execute
- A pattern where one call with no tools writes a plan as data, then the agent carries it out, treating the plan as guidance. The plan can be logged or shown to a person first.
- Prefix
- The unchanging start of a request, such as the system prompt and tool definitions, which prompt caching can reuse. Anything that changes should come after it.
- Prompt caching
- The provider keeps a request's prefix for a few minutes and charges a tenth of the price to read it again. It made Dana's three-call run 39% cheaper.
- Prompt injection
- Text in an email or tool result that tries to override an AI's instructions. The defenses are limits in code, approvals and evals, not just the prompt.
- python-dotenv
- A Python package that reads a .env file so your API key stays out of the code. Add .env to .gitignore.
R
- ReAct
- Short for reasoning and acting: the model repeats a thought, an action (tool call) and an observation (the result) until it can answer. Asking for a one-line note before each tool call gives readable reasons.
- Regular expression
- A pattern that matches text, used in Python through the `re` module. It can find things like `KC-` order numbers in an email or spot reply wording that claims an action.
S
- Sandbox
- An isolated place to run code, such as a container or virtual machine with no secrets, limited network, a time limit and a disposable file system. Agents that run code or shell commands need one.
- Server-side compaction
- A beta Claude API feature that summarizes older turns of a conversation for you.
- Short-term memory
- The current conversation, held in run.messages. The model sees all of it on every call.
- Span
- One timed step in a trace, such as a model call or a tool call.
- SQLite
- A database stored in a single file that Python's built-in sqlite3 module can read and write. shop.db is the pretend shop's SQLite file.
- State
- Everything the agent knows so far: the messages, tool results and any saved notes. In Priya's agent it is a list of messages plus a notes table.
- Stop reason
- The reason the API says a reply ended: end_turn means the model finished and the reply is the final answer; max_tokens means it hit its limit; refusal means it declined for safety. Your loop adds max_steps and budget.
- Structured output
- Asking the model for a reply that must match a JSON schema, so your code can parse it reliably. It is useful for getting data such as a plan as a list of steps instead of free text.
- Summary
- A short version of a conversation that keeps the key facts, like refund IDs and amounts, so the agent can continue with far fewer tokens.
- System prompt
- The standing instructions given to the model, like Priya's rules for her new staff. It helps the model choose well, but limits that matter must also be enforced in code.
T
- Thinking
- Claude 5.5 models can think before replying. By default the thinking comes back as an unreadable signature; setting display to "summarized" returns a readable summary.
- Thread pool
- A set of threads that run functions in the background. The guards use one to run a tool with a timeout, though Python can't stop a thread that hangs.
- To-do list tool
- A tool the agent uses to write its plan into a list and tick items off, which is plan-then-execute with the plan stored in state.
- Token
- The small chunks of text a model reads and writes, and what API costs are counted in. Every call re-sends the whole history, so input tokens usually outnumber output tokens.
- Tool
- A function your code runs when the model asks, described to the model by a name, description and input schema. Priya's agent has get_order, check_stock, issue_refund and escalate_to_human.
- Tool runner
- A beta helper in the Anthropic SDK that runs the tool loop for you. A hand-written loop is recommended instead when you need approvals and custom logging.
- ToolError
- An exception for problems the model can fix. Its message goes back to the model as a tool result with is_error true, so it should say what went wrong and what to do next.
- Trace
- A record of every step of one agent run, such as each model call and tool call, with timing and results. It can be stored as one JSON line per step, all sharing a run ID, so you can see what happened and why.
- Trajectory
- The tool calls a run made, in order, with their arguments. It is graded as the path, separately from the outcome.
- TypedDict
- A Python typing construct that declares a dict's keys and their types. LangGraph uses it to define the state's shape.
U
- Unbacked claim
- A reply that says an action happened, like "I've refunded $18", when no successful tool call did it. The check compares the reply against the run's tool calls and holds mismatches for a person.
W
- Waiting
- An exception raised to pause a run until a person decides on a risky call. The paused run is saved as JSON (in pending/ in the project) and resumed with the person's decision.
- Workflow
- A system where your code fixes the steps and the model fills in parts. The "where is my order?" function that looks up the order and only asks the model to write the reply is a workflow.
- Workflow patterns
- Anthropic's five workflow designs: prompt chaining (fixed calls in sequence), routing (sort the input, then send it down the matching path), parallelization (several calls at once), orchestrator-workers (one call splits the job) and evaluator-optimizer (one call writes, another grades, repeat).