Peanut learns to agent · Free sample

Six concepts.
One peanut.

Read complete entries from the illustrated handbook. Peanut’s role changes between scenes; the note beside each image explains who or what it represents.

Chapter 01 · Models and agents

Language model (LLM)

A large language model is a machine-learning model trained on large amounts of data to process and generate language.

A builder peanut reads a repair suggestion from a language-model machine; the chair and repair tools remain untouched beside it.
The machine has suggested a repair. The chair is waiting.

Peanut is the builder here. The machine represents the language model; the tools beside the chair would turn its suggestion into action.

A generative language model produces a response from the input it receives, using patterns learned during training. That response may be prose, code, or a structured tool request. To turn a proposed repair into an action, an application needs tools and software to run them. This distinction becomes useful as soon as we start building agents.

Source & further reading

Technical reference: Language models

Chapter 01 · Models and agents

AI agent

A system that uses an AI model to choose and carry out actions toward a goal.

Peanut inspects a wobbling chair, pushes an orange shim under one leg, and presses the seat again to check the repair.
You asked for a steady chair. Peanut worked out the steps.

Peanut represents the whole agent system here, choosing a repair, using a tool, and checking the result.

In an agent system, the model chooses an action and the surrounding software executes it through a tool. The result returns to the model, which can choose another action, ask for help, or finish. You supply the goal and constraints. How much the agent can do along the way depends on its available tools, permissions, and stopping rules.

Source & further reading

Technical reference: Building effective agents

Chapter 04 · Tools, connections, and computer use

Tool use

An AI system invoking an external capability to obtain information or perform an action.

Peanut writes 2 kg on a job card while parcel 7 rests on a scale showing the same weight.
The scale supplies the weight.

Peanut is the agent. The scale performs the measurement; the job card carries its returned result into the next decision.

Tools connect an AI system to capabilities beyond generating a response. A model can request a calculation, search, or record update, and an application or hosted service performs the operation. Its result then becomes available for the next decision. Good tool design makes the purpose, inputs, and returned information easy to interpret.

Chapter 06 · Retrieval and grounding

RAG

Retrieval-augmented generation: retrieving relevant information and supplying it to a model to help generate a response.

Peanut writes beside an open kettle manual while the broken kettle sits unplugged on the workbench.
The relevant manual page earns a place beside the answer.

The open manual is retrieved context supplied for the answer. Its relevance and the answer's use of it both need checking.

RAG adds retrieved material to the context used for generation. The application searches an external collection, selects results, and supplies them to the model. Retrieval might use keywords, vectors, or another method. The quality of the answer depends both on finding useful evidence and on using it accurately, so evaluate those steps separately.

Chapter 07 · Reliability, permissions, and safety

Guardrails

Checks and constraints that aim to keep an AI system's inputs, actions, or outputs within defined bounds.

Peanut pushes a loaded cart along a guarded ramp toward a cargo inspection point.
The ramp has rails. The cargo gets checked too.

The rails and inspection stand for constraints and checks around execution. They reduce particular risks under their actual design.

Guardrails can act at several points: incoming requests, proposed tool calls, and generated outputs. Some apply explicit rules; others use models to assess content and can make classification errors. Decide what each check covers and how the application responds to its result. A rule that only produces an ignored warning provides little control over execution.

Chapter 08 · Evaluation, tracing, and cost

Agent evals

Systematic tests that assess an agent's behavior and results against defined criteria.

Peanut pushes a cart through a test yard with ramp, rocks, and gap obstacles while an evaluator records the specified checks.
The cart gets the agreed obstacles, not the convenient ones.

The yard represents a defined set of evaluation tasks and grading criteria, rather than an ordinary successful demonstration.

An evaluation suite pairs representative tasks with criteria for judging behavior and results. Graders may be code, people, or models. Include failures that matter in the intended use, and repeat trials where run-to-run variation is significant. The suite becomes useful engineering feedback when its results point to something the team can investigate or improve.

Source & further reading

Technical reference: Agent evaluations