Skip to content

Agents ​

Two chapters that make the word less mysterious. An agent is a loop: the model picks a tool, the tool runs, the result goes back into the window, and the model picks again until it stops. To a backend engineer it is a state machine whose transition function is a language model.

The common thread is that the tool surface is the product. Whether an agent works depends less on the model than on how its tools are named and described, and on what their errors say. That is taught in Tool Calling and the Tool Surface. This section builds on it.

Chapters ​

#ChapterWhat it answers
01What an Agent Is, and When to Use More Than OneWhat is the loop, where does it stop, and when is one agent simply better?
02Memory, State and Long-Running WorkWhat survives a turn, a session and a deploy — and at what token cost?

The Running Project ​

The documentation assistant answers well now. This section asks whether it should also do things. For most of the product the honest answer is no.

ChapterWhat it adds to the assistant
01The scope decision: Q&A stays a two-step workflow, and only doc triage gets a loop. The multi-agent version is deliberately not built
02Session memory — recent turns verbatim, older ones summarised — and the nightly re-embed as a durable job

At the end of this section the assistant has one bounded agent, with a step cap, a token budget and read-only tools. Everything else is a workflow. It still cannot say what any of it costs or how often it is right. That is Production/.

What Interviewers Probe For ​

  • "Your agent is looping. Debug it." Read the trace before changing the prompt. The usual causes are an empty tool result that looks like failure, two overlapping tools, and no stop condition the model can meet.
  • "How do you stop it deleting production data?" Approval gates on destructive tools, least privilege, and a tool surface that cannot express the dangerous operation. "We told it not to" is not a control.
  • "When is a single agent better than three?" Almost always, at first. Multi-agent buys parallel context. It costs coordination, and debugging gets much harder. Measure the single agent first.

Reading Order ​

Read the tool-calling chapter in Integration/ first, then 01 → 02.

Interview sprint: 01. The loop and its stop condition answer most agent questions at senior level.

The whole book, free to read. Generated from the manuscript on every change.

Your progress

Tick each chapter in the sidebar once you have read and understood it. Your name and email keep the ticks on any device.

Your name and email are stored to save your progress. Nothing else is done with them.