Chapter 4
The Loop That Never Stops
Ava was supposed to be doing homework. Instead, she was watching her dad.
He was sitting at the kitchen table, sipping coffee, and not typing. His laptop, on the other hand, was very busy. A little side panel kept lighting up with sentences as his AI assistant worked through his inbox.
Ava leaned over to read along.
Reading message from Marcus… Drafting reply: “Happy to meet Thursday at 2…” Checking calendar… conflict found: dentist appointment 2:00–2:45. Rewriting reply: “How about Thursday at 3:30 instead?” Sending…
Five things. One after another. Her dad hadn’t touched the trackpad once.
“Wait,” Ava said. “It read the email, started writing back, changed its mind, and then sent it? By itself?”
Her dad nodded without looking up. “Yep.”
“But — it didn’t just do one thing. It kept going.”
“Yep.”
“It kept going by itself?”
Her dad finally smiled. “That’s the whole trick, kiddo. That’s how agents work.”
In Chapter 2, we learned that agents don’t just talk — they do. But “doing” usually isn’t a single action. It’s a chain of actions, each one shaped by what just happened. The agent doesn’t stop after step one. It loops. And the loop is what makes everything else possible.
The Video Game You Don’t Quit
Think about the last hard level you played in a video game.
You don’t usually beat a tough boss on the first try. You charge in, you get knocked out, and you respawn. The second time, you remember where the boss’s attack came from, so you dodge left instead of right. You get a little further. You die again. The third time, you know exactly when to jump. By the fourth or fifth try, you’ve figured out the pattern, and the boss goes down.
What happened? You weren’t just trying. You were learning. Each attempt fed information into the next one. Try, observe, adjust, try again.
That’s the cognitive loop. And it’s exactly how an AI agent thinks.
An agent doesn’t take one action and walk away. It takes an action, looks at the result, decides what to do next, and goes around again. Five times. Twenty times. A hundred times — as many times as it takes — until the goal is reached or it’s clear the goal can’t be reached without help.
The fancy name for this is the perceive–plan–act–remember loop. Let’s break it down.
The Five Steps of the Loop
Every time an agent does anything, it cycles through the same five steps. You can picture it as a wheel spinning, with each step flowing into the next.
-
Perceive. The agent takes in new information from the world. A new email arrived. A calendar got updated. A user typed a question. A sensor reported a temperature. Whatever it is, the agent notices it — the way you’d notice a notification buzz on your phone.
-
Think / Plan. The agent’s “brain” — a large language model, the same kind of AI that powers ChatGPT — looks at what it just perceived and decides what to do next. Should it write a reply? Check a file? Ask the user a question? Plans aren’t always one step long. The agent might map out three or four moves ahead, like a chess player.
-
Act. The agent does the thing. It uses a tool — sends an email, opens a calendar, runs a search, edits a document. This is the step where the agent actually changes something in the world. (We’ll spend the entire next chapter on these tools, because they’re a huge deal.)
-
Remember. After acting, the agent stores what just happened: what it tried, what worked, what didn’t. This memory might last for a few seconds (just long enough to inform the next step) or for weeks (so it can recognize the same problem if it shows up again).
-
Repeat. Back to step one. Perceive the new situation — including the results of the action it just took — and start the loop over. The agent keeps spinning the wheel until the goal is achieved.
Here’s what that looked like for Ava’s dad:
| Step | What the agent did |
|---|---|
| Perceive | Read the new email from Marcus asking for a meeting |
| Plan | Decided to accept and propose Thursday 2pm |
| Act | Started drafting the reply |
| Perceive (again) | Noticed a calendar conflict at that time |
| Plan (again) | Picked a new time: 3:30pm |
| Act (again) | Rewrote and sent the email |
| Remember | Saved the meeting on the calendar |
Seven steps, about two trips around the loop. One email handled. Zero clicks from her dad.
One-Shot AI vs. The Looping Agent
This is the moment a lot of people’s mental picture of AI needs to update.
If you’ve used ChatGPT or another chatbot, you’ve probably noticed: you type something, it answers, and that’s the end. One question, one answer. Done. That’s what we’ll call one-shot AI. It’s powerful, but it’s a single thought.
A looping agent is different. It doesn’t stop after one thought. It checks its work, notices what’s missing, and keeps going.
| One-Shot AI | Looping Agent | |
|---|---|---|
| How many steps? | One | As many as it takes |
| Reacts to its own results? | No | Yes |
| Recovers from mistakes? | No — it just answers wrong | Often yes — it tries again differently |
| Good for | Quick answers and ideas | Multi-step jobs in the real world |
| Example | “Write me a poem about cats” | “Plan my whole birthday party” |
This is why agents can handle things that simple chatbots can’t. A chatbot can tell you what should go into a great email. An agent can write the email, check the calendar, fix the conflict, and send it. The difference is the loop.
Why The Loop Matters in the Real World
This isn’t just a clever idea. Companies are using it right now to do enormous amounts of work that humans used to do by hand.
ServiceNow — a company that makes software for IT help desks at huge corporations — built AI agents that handle the boring questions employees ask their tech-support teams all day. (Things like “My password expired” or “I can’t log in to email.”) In 2026, ServiceNow said that inside its own company, AI agents are now resolving about 90% of those routine IT tickets without a human involved, and handling them roughly 99% faster than a human agent would. The agents perceive the ticket, plan a fix, act on the system (reset the password, unlock the account, grant access), remember the outcome, and move to the next one. Loop, loop, loop, all day.
Klarna, a global online payments company, set up an AI customer service agent in 2024. In its first month, it handled two-thirds of all customer service chats — about 2.3 million conversations — doing the work of an estimated 700 full-time human agents. It also cut the average resolution time from 11 minutes to under 2. Same loop: read the customer’s message, plan a response, take an action (issue a refund, update an order), check that it worked, move on.
(Worth noting: Klarna later decided to bring some human agents back for the trickiest cases. Loops are powerful, but they aren’t magic. We’ll talk about where agents still struggle in a later chapter.)
GitHub Copilot, the coding assistant used by millions of software developers, now has an autonomous mode where you can hand it a bug and walk away. It opens a draft fix, runs the tests, sees which ones still fail, edits the code, runs the tests again, and keeps looping until everything passes — or it gives up and asks for help. The same five steps, just applied to code instead of email.
In every one of these examples, the magic isn’t really the AI’s intelligence on any single step. It’s the loop. It’s the willingness to try, check, adjust, and try again.
Key Takeaways
- AI agents work in a loop: Perceive → Plan → Act → Remember → Repeat. They keep cycling until the job is done.
- The loop is what separates agents from chatbots. A chatbot gives one answer. An agent keeps going until the goal is reached.
- The “brain” of the loop is a large language model, but the loop is what lets that brain handle multi-step real-world jobs.
- Loops handle mistakes naturally. When an action doesn’t work, the agent perceives the failure and tries something different — like you respawning in a video game.
- Real companies are running this loop at huge scale right now. ServiceNow says its agents resolve about 90% of routine IT tickets on their own. Klarna’s AI handles two-thirds of customer chats. GitHub Copilot fixes bugs on its own.
Step three of the loop says “Act — use a tool.” But what does that actually mean? A language model is just a very clever pattern of numbers in a computer. It can’t pick up a phone. It can’t open a calendar. It can’t send a refund. So how, exactly, does an idea inside a chip turn into a real action in the real world? In the next chapter, we’ll meet the secret ingredient that lets agents reach out and change things: tools.