Awesome Testing

Agent lesson 01 · The controlled loop

What makes an LLM response become an agent run?

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.

Prior knowledge
Basic LLM and API concepts help. You do not need experience with an agent framework.
Study time
2–3 hours guided · about 7 hours of optional deep dives
By the end
Design and review an agent loop with bounded tools, durable state, observable actions, recovery paths, and evaluation.

Start here

What it is, when it helps, and where we are going.

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.

Good use cases

  • Complete multi-step tasks whose next useful action depends on evidence gathered during the run.
  • Coordinate several bounded tools or workers while retaining one trace and accountable owner.
  • Investigate, draft, or operate in environments where safe stopping and recovery can be verified.

What it does not solve

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.

Learning path

  1. 01Controlled loop
  2. 02Delegation
  3. 03Context and memory
  4. 04Lifecycle controls
  5. 05Tools and evaluation

Video overview

The Controlled Agent Loop

Watch on YouTube

01 · Smallest useful mechanism

An agent is a controlled loop, not a more intelligent chat response.

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

Test the prediction

Deterministic browser simulation

The controlled loop experiment uses inspectable, repeatable teaching data. It does not claim to be a live agent trajectory.

Loading the experiment…

03 · Production-minded practice

Prove the mechanism under failure

Use your own stack or a contained mock environment. Do not point failure drills at real accounts, people, or irreversible services.

  1. Build

    Draw a trace with separate events for proposal, policy decision, tool start, observation, verification, and terminal state.

  2. Break it on purpose

    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.

  3. Evidence of completion

    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

Write the argument you would defend

Stored only in this browser. No account required; course reset does not delete it.

04 · Check your understanding

Who should decide whether a proposed tool call actually executes?

Optional referenceDeep dive / reference chapterOpen the complete essay, diagrams, mathematics, exercises, glossary, and sources when you want more depth.

Next: Once one loop is visible, we can safely ask when parts of the work should be delegated to bounded workers.