Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 05 · AI · The loop and its harness · about 23 min to read

Play it as a journeyTutor comes with a plan

Graphs and State Machines (when the shape of the task is known, draw it)

Graphs and State Machines
Graphs and State Machines · Open board

Building with LLMs. A returns desk drawn as six boxes and the arrows between them, with a seventh box, ESCALATE, that most of the arrows can end in. The board answers a question the last two lessons left open: if a loop can call any tool on any turn, what happens when the task itself only ever moves one way?

Before you start. The example running through this lesson is a support assistant for an online shop’s returns desk: a program a customer types at, which can look up an order and start a return. It runs on a model, the AI that reads text and writes text back, which is what LLMs, large language models, are. The Loop (an agent is a while loop around one model call) gave that assistant a loop: on every turn it could reach for any tool it had, a tool call being the model asking a program to run something for it, and it decided for itself when the conversation was done. This lesson keeps the same model and the same tools, and takes that freedom away.

Lesson 50 of 83 in AI

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • The desk that took eleven seconds to say “someone will get back to you”
  • December 2024: the people who build agents for a living said stop looping
  • The napkin: six boxes, and one arrow out of each
  • Nine lines of code, and where the model still gets a vote
  • Which boxes need the model at all?
  • What does each box have to read?
  • How do you read the board’s code as the desk?
  • Did it pay off, and when is a graph the wrong tool?
  • All of it in code

Terms it explains: tool call, state machine, node, code node, edge, enum, session record, window, loop guard.

Review AI