Agent lesson 01 · The controlled loop
Shared teaching scenario · fictional product data
Research three laptops under €900, verify current evidence, and write laptop-comparison.md. Do not purchase anything or contact a vendor.
Start here
An AI agent is an application-controlled loop in which a model proposes the next step, a runtime validates and executes bounded actions, and new observations shape the following decision.
A single model response or a fixed deterministic workflow does not need an agent loop. Avoid autonomous execution when effects cannot be bounded, observed, reversed, or meaningfully approved.
Video overview
01 · Smallest useful mechanism
A useful agent alternates between model calls and an application-controlled runtime. The runtime packages the goal and current evidence, asks the model for a response, validates any requested tool call, executes only allowed effects, and appends the result to the next turn. Critical gates can be deterministic even though tools, networks, policy services, and scheduling may not be. The loop stops on a verified answer, an explicit failure, a budget boundary, or a human decision.
The model proposes the next move; the harness owns state, mediates permitted actions, records observations, and applies continuation and stopping rules.
02 · Experiment
Deterministic browser simulation
The controlled loop experiment uses inspectable, repeatable teaching data. It does not claim to be a live agent trajectory.
03 · Production-minded practice
Use your own stack or a contained mock environment. Do not point failure drills at real accounts, people, or irreversible services.
Draw a trace with separate events for proposal, policy decision, tool start, observation, verification, and terminal state.
Make one product read time out after the request is sent. Mark the outcome unknown, apply the retry policy, and choose a safe next step.
A reviewer can tell what happened, whether an effect may have occurred, why the loop continued, and which check allowed it to stop.
Your learning artifact
Stored only in this browser. No account required; course reset does not delete it.
04 · Check your understanding
Next: Once one loop is visible, we can safely ask when parts of the work should be delegated to bounded workers.
Guided run
Current boundary
Step 1 of 10
Research three laptops under €900, verify current evidence, and write laptop-comparison.md. Do not purchase or contact a vendor.
user
Goal enters the harness
Pending · harness
Context is assembled
Pending · model
Model proposes a tool call
Pending · tool
Harness validates and executes
Pending · harness
Tool result becomes an observation
Pending · model
Model requests current evidence
Pending · tool
Environment returns evidence
Pending · model
Model proposes the approved deliverable
Pending · tool
Harness verifies the effect
Pending · final
Model returns a final answer
Research basis: Claude Code Unpacked agent loop and OpenAI’s practical guide to building agents.