Lesson 40 of 1570
The Four Ingredients: Goal, Tools, Loop, Stop
Every agent — fancy or simple, local or cloud — boils down to four parts. Learn the recipe and you can read any agent system like a menu.
Lesson map
What this lesson covers
Learning path
The main moves in order
- 1The recipe
- 2agent architecture
- 3goal
- 4tools
Concept cluster
Terms to connect while reading
Section 1
The recipe
Strip away the marketing and every AI agent has exactly four parts. If any one of them is missing, it's not really an agent — it's something else wearing an agent costume.
Compare the options
| Ingredient | What it is | Example |
|---|---|---|
| Goal | What the agent is trying to accomplish. | 'Book a dentist appointment for next Tuesday.' |
| Tools | The things it can do in the world. | Browser, filesystem, shell, API calls. |
| Loop | Think → act → observe → think again. | Check calendar, open booking site, click a date. |
| Stop | A rule that says 'done' or 'give up'. | Goal achieved, or 10 attempts, or human says stop. |
Why each one matters
A goal without tools is a daydream — the AI knows what you want but can't act. Tools without a goal is chaos — the AI clicks things for no reason. A loop without a stop is an agent that never quits, and that is how you get a robot that books 40 dentist appointments because the first one worked and it never stopped trying.
A tiny walk-through
A minimal agent trace. Think, act, observe. Stop when the goal is met.
GOAL: Find out what time my 3pm meeting actually is (it moved).
TOOLS: Read calendar, read email.
LOOP:
Step 1 — Think: 'The calendar should be authoritative. Check it first.'
Step 1 — Act: open_calendar('today')
Step 1 — See: 'Meeting with Sam, 3:30pm.'
Step 2 — Think: 'Got it. No need to check email.'
Step 2 — Act: report('3:30pm')
STOP: Answer produced. Done.When the loop goes wrong
- The goal is vague ('make things better') — the agent can't tell when it's done.
- A tool is broken — the agent keeps retrying the same failing step.
- The stop rule is missing — the agent runs until someone kills it.
- The think step is skipped — the agent just spams actions without reasoning.
Next lesson, we walk through a real agent run, step by step, so you can see the loop breathe.
Key terms in this lesson
End-of-lesson quiz
Check what stuck
15 questions · Score saves to your progress.
Tutor
Curious about “The Four Ingredients: Goal, Tools, Loop, Stop”?
Ask anything about this lesson. I’ll answer using just what you’re reading — short, friendly, grounded.
Progress saved locally in this browser. Sign in to sync across devices.
Related lessons
Keep going
Builders · 28 min
Chat AI vs. Agent AI: The Real Difference
A chatbot answers. An agent does. Learn the line between a model that talks and a model that acts — and why crossing it changes everything about how you work with AI.
Builders · 32 min
Your First Agent: A Walkthrough of What It Does
Follow a real agent run step by step — from prompt to result — and see exactly what happens inside. No code yet, just the anatomy of a successful task.
Builders · 32 min
Tools an Agent Might Have: Filesystem, Browser, Code
Agents are only as useful as their tools. Tour the big three — filesystem, browser, code execution — plus the emerging MCP ecosystem, with examples of what each unlocks.
