Skip to content

Building with agents, lesson 1.1

What an LLM is, and the agent loop under the hood

An agent is a model, a list of tools and a loop. Build one for your own business, break it on purpose, fix it, and leave with the first block of your AI system.

What do you run?

Every example and exercise below changes to fit what you pick. The businesses are made up for teaching.

Build the loop, one piece at a time

The picture stays put and adds a piece as you scroll. Watch what it does with a missing parcel.

Step 1 of 6

A model on its own

You type, it writes back: text in, text out. It cannot open your orders, so all it can do is guess: "Sorry! It should arrive soon." A guess.

Step 2 of 6

Give it tools

A tool is a job your own code can do, with a name and one line on what it does: get_order, track_parcel, issue_refund. You hand the model that list with every message.

Step 3 of 6

It asks, your code does

The model never runs anything. It writes a request, get_order(4412), and stops. Your code reads the request and runs it.

The model has just written get_order(4412). What happens next?

Step 4 of 6

The result goes back in

The answer, "Paid £48 on 2 Nov, shipped 4 Nov", is added to the conversation. The model reads it and decides what to do next: answer, or ask for another tool.

Step 5 of 6

Round and round: the loop

Ask for a tool, read the result, decide again. It keeps going until it has what it needs. That is the whole of an agent: a model, a list of tools and a loop.

Halfway through, a tool breaks and sends back an error. What does the loop do?

Step 6 of 6

A check before it answers

Two things stop it running wild: a stop rule (after 3 tries, hand it to a person) and a last look at the answer against what good looks like. Then it answers: A reply saying the parcel went to number 14 on 6 Nov, with the courier’s photo.

Break it, then fix it

Each run below went wrong. Read what happened, then tap the part of the loop you think broke.

It told the customer to ask the neighbours

You
Order 4412 never arrived.
Model
get_order(4412): shipped 4 Nov.
Answer
"It probably went to a neighbour."

Which part broke?

Turn the dials

Change one thing at a time and watch cost, speed and how often it gets the job right.

The model
How much it reads each turn

Rough numbers to show the shape, not quotes. Prices sit near what the big providers charged per million tokens read in 2026; how often each is right is our estimate for a job like this.

Cost a month$270
Time per task11 s
Done right, out of 10082

For a shop handling 1,000 customer emails a month, that is about $270, and roughly 180 of them would need a person to fix.

Now build yours

Write the instruction, give it the tools it needs and nothing else, set a stop rule, then run it. The checklist marks what a good set-up has.

Say what the job is and what done looks like.

Its tools

Stop rule

What a good set-up has

0/5
  • Says what the job is: not yet
  • Says what done looks like: not yet
  • Has the tool it needs (track_parcel): not yet
  • Has no tool it doesn’t need: not yet
  • Has a stop rule: not yet

The run

Waiting
Press Run it to watch it work.

This run is played in your browser from the set-up you chose. It calls no model.

Your system, so far

Each lesson you finish adds a block. By the last one you have the blueprint of your business's AI system, ready to copy into a doc or hand to whoever builds it.

Your shop’s AI system

  1. The loopLesson 1.1
  2. Its toolsLesson 1.2
  3. Its instructionsLesson 1.3
  4. A plan firstLesson 2.2
  5. Connections (MCP)Lesson 3.1
  6. SkillsLesson 4.1
  7. House rulesLesson 5.1
  8. Checks and hooksLesson 5.2
  9. A team of agentsLesson 5.3

Finish this lesson

Adds The loop to your map, written for your business.

Your map stays in this browser.