Log inStart free
LESSON 23.01 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

The agent loop

Watch an agent book a train, one tool call at a time.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 23.01 · AGENT BAY4 TOOLS · 4 DAYS · LIMIT 14 STEPS
01
Stage 1 of 6 · The parts
An agent is a model with instructions, tools and memory. The agent cannot see the environment table.
Explain it simply

The agent box holds a model, the part that decides what to do next. Its instructions ask for the cheapest train on a dry day, for 60 dollars or less. The environment is the world the agent works in, and its grey values are hidden. The agent can only learn them through the four tools.

Three panels. The agent holds instructions, a model, a state, a plan and a memory table. Four tools sit between it and the environment, a table of four days with weather, fare and seats.

instructionsmodel output: plan, actionsobservations, memoryrepeats, failed checks
agenttoolsenvironmentstepsactionobservationinstructionsbook the cheapest trainon a dry day, budget $60stop by step 14modelreads, then writesstate · step 0 of 14plan: none yetbooking: nonememory · emptydayweatherpricebookingMonTueWedThuweatherpricebookstatusdayweatherfareseatsbookingsMonTueWedThurain$353dry$522dry$440dry$7141234567891011121314agent = model + instructions + tools + memoryagenttoolsenvironmentstepsactionobservationinstructionsbook the cheapest trainon a dry day, budget $60stop by step 14modelreads, then writesstate · step 0 of 14plan: none yetbooking: nonememory · emptydayweatherpricebookingMonTueWedThuweatherpricebookstatusdayweatherfareseatsbookingsMonTueWedThurain$353dry$522dry$440dry$7141234567891011121314agent = model + instructions + tools + memory
Toy: 4 days, 4 tools, a rule-based model (not a trained LLM)
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
agent=model+I+tools+M\text{agent} = \text{model} + \sy{I}{param}{I} + \text{tools} + \sy{M}{data}{M}
I=cheapest dry day, ≤$60, ≤14 stepsI = \text{cheapest dry day},\ \le \$60,\ \le 14 \text{ steps}

An agent joins a model, instructions, tools and memory.

Common mix-ups

MYTHIf the tool says the request was sent, the task is done.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With check status and 0 Wed seats, does a last-8 memory still book a train?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.