On Friday, Claude Code creator Boris Cherny appeared at Meta’s @Scale conference. Surprisingly, the first question from the audience was about loops.
The questioner asked, “Is The Loop the next hype cycle? Or is it for real?”
Charney’s answer was an emphatic, “Yes, that’s true.”
“Two years ago, we wrote our source code by hand. We started moving to agents writing code, and now we’re moving to the point where agents are encouraging agents to write code,” he continued. “As big as the step from source code to agent was, the loop is just as important and is a big step.”
Later in the talk (around the 32:00 mark in the YouTube video posted above), Charney spoke specifically about the loops he continues to run in his work. One agent is continually looking for ways to improve the code architecture, and the other is looking for redundant abstractions that can be integrated. They submit pull requests just like any other coder, and the code changes all the time, so it never stops running.
It’s a powerful idea, especially when you have someone as important as Charney behind it. With the transition to agent AI, most users are focused on managing their agents as best as possible. This means setting clear goals, seeing individual units of progress, and making sure agents don’t deviate too much from the prompt. This loop goes one step further by allowing a swarm of agents to operate continuously in the background indefinitely. It’s tough to put a lot of trust in AI, but models are improving rapidly and could be the next step in getting AI to handle real work.
The first thing to realize is that this is nothing new. Recursive loops (functions that call themselves to repeat an action with a condition that stops the loop) are a mainstay of introductory computer science courses. These loops follow non-deterministic logic. That is, the subagent chooses when to stop the loop rather than an explicit condition, but the same basic approach is working. There’s no doubt that as soon as programmers start using AI to complete tasks, we’ll see some version of a recursive loop where AI supervises AI.
Unlike classical computing, agent loops can be very simple. One of the most popular tricks is the Ralph Loop (named after Ralph Wiggum). This basically adds up all the work the model did and asks if the model achieved its goal. This is a way to deal with the fact that AI models get lost when they run for a long time. That is, bounce the model back and forth until the task is completed.
Another way to think of loops is as part of a general push against increased computational complexity during testing. As OpenAI researcher Noam Brown observed earlier this month, modern models can solve almost any problem given enough computing power. So one way to ensure that you solve a problem is to keep putting compute into it until the problem is completed. This is especially true for hill-climbing problems like improving a code base. In this case, the model can continue to improve step by step until it reaches a certain threshold. Or, as in Cherny’s example, you can continue to make incremental improvements as long as you have compute to spend.
If that sounds expensive, it should be. Like the previous Agent AI, AI Loop will burn through your tokens much faster than a simple Q&A chatbot. Also, since the key is to keep the loop running all the time, there is no upper limit to the amount you can spend. That’s fine for Anthropic, which is ultimately in the business of selling tokens, but it may be an expensive method for others.
Still, depending on the problem your agent loop is trying to solve and the right setup that allows you to monitor token spend, drift, and other classic AI problems, the benefits can outweigh the costs.
If you buy through links in our articles, we may earn a small commission. This does not affect editorial independence.
