I had an agent pick me a new air conditioner while I ate my lunch.
I gave it my situation - a 300-square-foot bedroom on an INR 40,000 budget, and I wanted something quiet enough to sleep through. My allergies flare up every summer, so I needed a filter that actually caught pollen and fine dust, something better than the box-standard mesh most units at this price ship with. And I wanted one thing most review sites gloss over. A warranty I could actually use if the unit died in year or two. I told it to come back with three options and skip the "top 10" pages that read like SEO bait.
It searched, then it read, then it searched again. It cross-referenced warranty terms against my list. 10 minutes later I came back to three candidates on my screen, each with a short paragraph explaining why it fit my situation and what the tradeoff was. I kept asking follow-ups. Could it find the actual noise readings on low-fan mode. What were the filter replacement costs over three years. Each question sent it back through the same loop, finding what I needed and presenting it back, until I'd run out of things to ask.
I've been noticing this rhythm since I started working with agents.
Read. Decide. Act. Something comes back, you look at it, you decide again.
The same sequence every time, at whatever scale I'm looking. This loop is what makes the whole underlying system work.
A word completing itself into the next, conversation reassembling from scratch every turn, they are different scales of the same loop. What I described with my research task is a bigger version of that loop. An agent, an llm extended by tools so it can keep running while I was doing something else.
Let me back up a step, because the loop is easier to see if we start at the very bottom.
You give the model a few words, say "I am a", and it calculates the most likely next word. "Student." Append that word to the phrase, and now the model has "I am a student." Feed the whole thing back to it. It reads "I am a student" and predicts what comes next. "Who." It's the same mechanism just one word later.
A simplified way to think of it is as autocomplete. Your phone's autocomplete guesses the next word when you type a text. This thing does the same, except after each guess it feeds the whole sentence back to itself and guesses again. Do that a few hundred times and you have a paragraph. Do it a few thousand and you have a story. The loop is the whole mechanism. (What the model is actually predicting is called a token, which is a word or a piece of a word. Close enough that we can keep calling them words.)
How did the model learn to do this?
During training, it was given trillions of examples, each one a chunk of text with the next word hidden. Its only job was to guess what came next. Most of what we've put into writing, from books to forum posts, went in. Across trillions of those guesses, the model picked up patterns that nobody had to teach it explicitly.
Why a sentence can be sarcastic. How a proof moves from a premise to a conclusion.
These patterns fell out of the sheer scale of the training. AI researchers call them emergent properties, abilities that show up when a system gets big enough, even though nobody wrote rules for them.
Once training finishes, the weights freeze. The weights are the model's parameters, the billions of numbers that got tuned during training. Think of the whole thing as a giant map.
Training carves its contour lines. After that, the map is locked in, and no conversation you have with the model can redraw it. The map is dense and detailed where the training data was rich and blurry where it was thin. Every time you send a message, the model is walking a path across that map.
When you chat with ChatGPT or Claude, another loop runs the conversations. You send a message, the model responds. You send another, it responds again. What looks like a back-and-forth conversation is something different underneath.
Actually, each turn the system is building up a document. At the top of the document sits the system instructions. Those are the rules and instructions set differently for whichever app you're using, things like what kind of assistant it should be and what it's allowed to say. Below the system instructions sits every message you've sent and every response the model has given, in the order they happened.
When you send a new message, the message gets appended to the stack, and that whole stack is what gets handed to the model when you hit send. The model reads from the top and writes what it thinks comes next in the conversation. This document is what we call the model's context. The cap on how much you can fit into it is called the context window.

Every turn the model is generating fresh. If you start a new chat, the document stack disappears with it. if you ask it to "make it more casual", and it has no idea what "it" is. The new chat is a new document. The old one, with all the context you'd built up in it, is gone. No memory between conversations.
There's a second thing you start to feel the longer you talk to one of these.
The instructions you typed early on get buried as the conversation stretches. Think about how your own attention works. If I give you fifteen things to keep track of, you'll do an okay job at most and a great job at none. Give you one specific thing to focus on, and you will likely focus better. The model runs into the same limit.
As the conversation grows long, the model still has to read the document every turn, every line. Its attention across a long document isn't uniform. Recent content pulls harder than the stuff that's been sitting up there for pages, and the careful setup you wrote at the start loses its grip. Starting fresh with the same question often produces sharper output. We call this context rot. The signal is clearer with a shorter document.
An agent's loop is an extension of the conversation loop, with one small change.
Instead of waiting for me to type the next message, the agent generates its own next input through tools. So for the AC search, I asked it to find three options. It read my request, decided it needed to search, and issued a search tool call.
The system intercepted, ran the tool, and appended the results back to the document. The model read the updated document, my request plus the search results, and decided what to do next. Click into a product page, search for the return policy, read what came back, act again.
One message from me. Seven steps from it. Each step was the same mechanism. Read the document, predict the next action, run the action, fold the result back in. The difference between a conversation and an agent is who advances the document.
That's when it stopped looking like three things to me.
The prediction of a single token and a multi-step agent task are the same loop, at different sizes. A conversational turn sits in between, doing the same thing at its own scale. The mechanism underneath doesn't change. What changes is how big the next step is, and whether we're the ones typing it or the agent is.
The document is the single page it all plays out on. Everything the model can see or use lives inside the document. Whatever's outside doesn't exist to it.
If the document is the agent's entire reality, then the practical lever for us isn't the model sitting at the center. The model provides the capacity to predict. What drives behavior, whether the agent finishes what you asked for or wanders off into an unrelated subtask, is what sits in the document and what gets added to it next.
Which reframes something I'd been asking wrong for a long time.
I'd been asking how to get the model to do a task. The better question is how we close the loop around the task so the model can iterate on it.
Closing the loop means giving it a way to know when it's done. A signal at the end of each pass that tells the loop whether the latest attempt is good enough to stop, or whether it should try again.
Every loop needs two pieces to actually land somewhere. One piece that generates candidates. One piece that evaluates them.
The model is the generator. The evaluator is whatever checks the work against what you asked for.
In a conversation, I'm the evaluator. I read the response and judge it. Either it's good enough, or I ask for another pass. In an agent, we've handed the evaluation off to the generator model itself.
The agent runs a check of some kind, a test passing or a box on the list getting ticked, and the result tells the loop whether to stop or keep going.
Without that signal, the loop has no way to tell finished from unfinished. The model generates something plausible. Nobody checks. The session ends. You look at the output an hour later and find it's subtly wrong in ways you didn't specify.
A task that feels hard for AI is often a task where the evaluator is missing or unclear. You wanted the thing. You just didn't say what "got it" looks like in a form the loop could read.
The AC search worked because what I'd asked for was specific enough that the agent could check each candidate against it on its own. BTU rating against my room size. Noise rating against what I could sleep through. The filter question took more work. The agent had to dig into spec sheets to find each product's actual filter grade and cross-reference it with what holds up against pollen and fine dust. Still a check it could run without me in the room.
The moment the evaluator is real, and even a checklist counts as real, the loop can run itself.
Generate an attempt. Check it. Generate again. Check again. Keep going until enough candidates pass.
The model doesn't need to be perfect on any given try. It needs to be correct-eventually, which is a much weaker requirement than being correct-immediately, and which most interesting tasks can live with.
The trick is finding the check. Sometimes it's baked in already, in the form of a list you set up front or a test suite that runs on every change. Sometimes it's something we build on purpose.
A fixed yardstick the agent gets measured against on every iteration, same verdict for the same input, no drift from one pass to the next. That fixed-ness is what lets the loop close.
There's a pattern people are running right now called the Ralph loop. It's pretty simple. You pair an agent with a second agent whose only job is review. Writer generates and reviewer critiques. Writer revises and reviewer re-reads. The loop runs until the reviewer passes.
The writer is the generator. The reviewer is the evaluator.
I've seen variants. Sometimes it's a single agent playing both roles in separate turns. Sometimes it's a human in the reviewer slot for high-stakes work, or a predefined checklist instead of another model.
The outside can change but the structure remains same. What matters is that there's something at the end of each iteration that decides whether to run another one.
The people building what they call software factories are doing a version of this at scale. They've got multiple agents running in parallel on different pieces of a codebase, landing pull requests without a human in the moment.
Each agent sits inside its own small loop, closed against a test suite and a review pass before the merge gate.
The factory is many small loops running at once, each one closed against something deterministic. The gain comes from running them in parallel, each one self-correcting. Every agent sits inside something that can judge it.
Closing one loop is the first move. Extending it is the next one.
Every time you add to the chain, you give the loop another lip to lean against. Sometimes the addition is a deterministic check. A linter before the tests. A schema check before the linter. Each one turns a possible failure into a signal the loop can respond to.
Sometimes the extension takes a different form entirely. A new workflow built out of tools the agent already has, where you're mostly telling the loop to run the same pieces in a different order. And sometimes you plug in a whole new tool because the agent had no way to verify something it needed to verify.
The room for agent to get things wrong shrinks at every step. The catching is now done by system around the model.
This is where the current agentic models are paying off where earlier ones couldn't. They've gotten much better at reading their own tool outputs and proposing a correction when a check fails.
That capability matters inside a closed loop. An agent ten times better at self-correction is ten times more valuable when there's something real to correct against. Without that, it just generates ten times more output that nobody's reading.
The model is only half of what makes any of this work. The other half is the harness. Claude Code, Pi, OpenClaw, Hermes, the ones that ship with tools already wired in so some of the loops are closed before you arrive. You extend them by plugging in your own tools and skills. Every one of those additions is either closing another loop or telling the agent how to close one itself.
The lever is the same one either way. Close the loop first then extend it by adding pieces until the agent can't fail silently.
The model is the engine, by closing the loop is how we put it to real work.




Top comments (0)