Skip to the text
Build an agent
Contents
Glossary
Sources
Search the book
Search
Switch theme
Build an agent
A textbook on building an AI agent.
Part I: Foundations
01
Use the least autonomy that works: a call, a workflow, then a loop
02
Talking to a model: messages, streams, tokens, instructions and model choice
03
Tools: schemas, validation, errors the model can read, and identity it cannot fake
04
Stopping: caps, stop conditions and structured output
05
Memory within a task: sessions, threads and resuming
06
Asking before acting: approvals, guardrails and prompt injection
07
Testing offline, and a first complete agent
Part II: In depth
08
Choosing the shape: buy, adopt or build, how to plan, and when subagents pay
09
The model gateway: one streaming method, retries, prompt caching, reasoning replay and cost
10
Events and hooks: one event union, interceptors and observers
11
The session log and context policy
12
Retrieval and long-term memory
13
Tools at scale: the registry, deferred tools, MCP and skills
14
Permissions, sandboxes and credentials, and the lethal trifecta
15
Agents people can watch: UIs, browsers and taking over
16
Side effects that can fail: outcomes, idempotency and plan approvals
17
Durable and portable agents, and how work reaches them
18
Evals, observability and release