The Improviser · Lesson 11 — The Jam Session ← Course

The jam session — agents.

So far, one question has bought you one answer. An agent is the whole band working a tune with no chart: set a direction, play, listen back, adjust — and loop until it lands.

Everything so far has been a single exchange: you ask, the model answers, done. But most real work isn't one move — it's a goal you have to feel your way toward. An agent is a model put in a loop, working a task step by step instead of settling it in one pass.

The loop has three beats. Think — size up where things stand and pick the next move. Play — make that move, usually by calling a tool (Lessons 9 and 10). Listen back — take in what actually happened. Then round again, choosing the next move from what it just heard rather than from a fixed script.

That listening-back is what separates an agent from a lone answer. Because every step reacts to the last result, it can chase an open-ended goal — breaking it into moves, reaching for tools, catching when something misses, and correcting course. A plain chat reply is fixed the moment it's written; an agent gets to see the outcome and try again.

The power comes with a catch: a loop needs a goal and a way to know it's done. Without that it either quits too early or jams forever. Knowing when to walk off stage is part of the craft.

Give the band a goal — land this hanging phrase home on C — and let it work. Play one pass at a time: watch it think, hear it play, read what it heard, and see it adjust on the next pass until it resolves.

Goal: resolve the phrase home to C. Run one pass of the loop and watch it work toward it.
think play listen back until it lands
how resolved the phrase is0%

A model, in a loop.

The magic isn't a new kind of model — it's an ordinary model wrapped in a loop that feeds it back what happened, and keeps going until the goal is met.

goal  = "land the phrase home on C"
state = current_phrase()

while not resolved(state, goal):     # loop toward the goal
    plan   = model.think(state, goal)   # decide the next move
    result = play(plan)                # act — often via a tool
    state  = listen_back(result)       # observe what happened

# the loop ends when the goal is met — or a step limit stops it

Play, listen, adjust, repeat.

An agent is a model set loose in a loop toward a goal: think, act, listen back, and go again — each move chosen from what the last one produced. That feedback is what lets it handle tasks too open-ended for a single answer, using tools and correcting itself along the way, exactly like a band feeling out an ending.

One prediction is a note. An agent is the whole jam — and its skill is as much in listening back and knowing when to stop as in any single move it plays.

Next: The Big Band →
Go deeper — how agents actually run optional

Think–act–observe

The loop you just watched is the standard shape of an agent, often called a reason-and-act pattern: the model reasons about the next step, takes an action, reads the result, and folds it back in. Nothing about the model changed — it's the same next-token predictor from Lesson 1. The agent is the harness around it that keeps feeding it what happened.

Tools are its hands

Between thoughts, an agent acts on the world through tools (Lesson 9) reached over a standard like MCP (Lesson 10) — searching, running code, editing a file, calling an API. A capable agent is really a good reasoner plus a good set of tools; take away the tools and it can only talk about the task, not do it.

Knowing when to stop

A loop needs a brake. Agents stop when the goal check passes, but also on guardrails: a maximum number of passes, a cost or time budget, or a human sign-off. Without those, a confused agent will happily loop forever or wander off task — so “when do we stop?” is a first-class design question, not an afterthought.

Why errors compound

The loop is the strength and the risk. A wrong turn early becomes the state the next step builds on, so small mistakes can snowball over many passes. That's why real agents lean on the listening-back step — checking results, catching a bad move, and adjusting — and why more steps is not automatically better.