AI Agents & Orchestration

Agent Loops and Code

Last updated 2026-08-01

What's new

2026-08-01
  • **Claude Code (Anthropic's AI coding assistant)** helps teams edit code, run commands, and follow project rules, making it easier to work together safely and efficiently.
  • **Agent SDK (a toolkit for custom agents)** and **Claude API (a tool for custom apps)** let teams build their own automation and apps, choosing the right tool for the job.
  • **Shared settings, hooks (automatic checks), and permissions** help teams work faster and safer, like giving a new hire a handbook, clear rules, and the right tools for the job.
  • **Project memory (like a team handbook in Claude.md)** keeps everyone on the same page, while **skills and sub-agents (specialist tools)** help with specific tasks, making teamwork smoother.
2026-07-28
  • AI tools like Open Claw (a software development tool) are using "loops" (automated processes that repeat and improve) to write, review, and fix code, but this can lead to unmanageable amounts of code.
  • Control theory (a way to manage and adjust systems) can help manage codebases by measuring current state, setting desired state, and making incremental changes.
  • Real-world software development with AI tools requires careful design of loops and control systems to ensure code quality and manageability.
  • While AI tools can speed up development, they also require significant resources and careful engineering to avoid costly mistakes.
2026-07-25
  • "Loop engineering" (using AI to automate repetitive tasks) is a hot new trend, with people creating "loops" (automated processes) to handle most of their work.
  • A new tool called the "fin loop" (a specific type of automated process) can automate 95% of coding tasks, freeing up your time and letting the AI work even when you're not around.
  • The fin loop uses three main skills: "spec" (planning), "build" (creating), and "review" (testing) to continuously improve and test code without constant human input.
  • Additional free tools and the Claude Code Playbook (a guide to making AI more reliable) can help you set up and manage these loops, making your AI assistant even more effective.
2026-07-22
  • AI tools are getting better at coding tasks, but they still make mistakes, especially with security and complexity, which can lead to problems later on.
  • AI can make coding much faster at first, but after a few months, the extra speed goes away because of the extra work needed to fix mistakes and manage the more complicated code.
  • AI tools can generate code that seems correct but isn't, which can cause big problems for businesses that rely on it, like law firms and accounting companies.
  • AI is improving quickly, but it's not perfect yet, and it's important to find ways to make sure the code it generates is accurate and safe to use.
2026-07-19
  • Loops (automated processes that use AI to perform tasks) are becoming a key part of software development, with some experts arguing they're inevitable and already transforming how engineers work.
  • Pro-loop advocates, like Jeff Huntley (creator of the Ralph loop, a type of AI automation), believe loops can automate tasks like coding and research, making them faster and more efficient.
  • Critics, however, argue that loops aren't a perfect solution and that the hype around them might be outpacing their real-world effectiveness.
  • The debate highlights that while loops show promise, there are still challenges and unknowns in their practical application.
2026-07-16
  • GPT-5.6 (a new AI model) offers different sizes (Soul, Terra, Luna) and thinking effort levels, with Soul being the largest and most capable, Luna being the smallest and most cost-effective for simpler tasks.
  • Codex (a tool that helps write and manage code) allows you to create and manage multiple threads (separate tasks or projects), enabling better control and delegation of work.
  • Plugins, like Zapier (a tool that connects different apps and automates tasks), can add extra features to Codex, integrating it with over 9,000 applications like Gmail, Trello, and Google Docs.
  • Regularly review and update your agents.md file (a set of rules for Codex) to ensure it's up-to-date with the latest model releases and remove any outdated rules.
2026-07-13
  • AI tools can now write code faster than humans, with some companies like Anthropic reporting 80% of their code is AI-generated, changing how engineers work (AI tools that create computer code).
  • GitHub saw a 14x increase in code commits in 2025, mostly due to AI assistance, indicating a significant shift in software development (GitHub is a website where software developers store and manage their code).
  • There's debate among AI engineers about whether to trust AI-generated code completely or to still review it carefully, with experts like Ryan LeFebvre arguing that the quality of AI tools is now high enough to produce reliable code (AI-generated code is computer code written by artificial intelligence tools).
  • Some engineers warn against relying too heavily on AI, as errors can compound and cause problems later, especially in critical systems (critical systems are parts of software that are very important and must work correctly).
2026-07-10
  • AI engineers are advancing quickly, with new models released every 6 weeks, improving how we build and test software (AI engineers (people who build AI systems) are creating new AI models frequently, making software development faster and more efficient).
  • AI tools like Codex (a tool that helps write and test code) can now handle entire tasks on your computer, from planning to reviewing and deploying code (deploying means putting code into use).
  • These AI tools help make better decisions about what to build by allowing more prototyping (testing ideas quickly) and user engagement (working directly with users to improve products).
  • AI models are now proficient enough to outperform humans in many average computer tasks, raising questions about how to best use and shape these powerful tools.
2026-07-07
  • **AI loops** (self-running tasks where AI checks and fixes its own work until a goal is met) are a big leap in AI use, endorsed by experts like Peter Steinberger (creator of Open Claw, a popular open-source AI tool) and Andre Karpathy (former OpenAI and Tesla expert).
  • **Claude Code** (a coding assistant by Anthropic, a leading AI company) now has built-in commands for loops, making it easier to set up and run these self-managed AI tasks.
  • **Loops can save time and effort** by automating tasks like building a sales analytics dashboard (a tool to visualize sales data) without constant user input, but they need clear goals and checks to work properly.
  • **Setting up loops requires giving AI access to necessary tools**, like a browser (a program to view websites), which can be done with a simple command in Claude Code.
2026-07-04
  • A new tool called Fable (an AI assistant) can turn YouTube videos into a connected "second brain" by linking ideas and tools mentioned in the videos, making it easier to understand how they relate.
  • Fable can create simple, beginner-friendly resources from complex data, like turning messy YouTube transcripts into an easy-to-navigate HTML page with clickable ideas and connections.
  • By feeding Fable data from meetings and other sources, it can generate insights like visual stories about business progress, pulling stats and even choosing relevant images to illustrate the journey.
  • The more data you give Fable, the smarter it becomes, helping with tasks like writing emails or scripting posts by understanding your business and personal context.
2026-07-01
  • **Agentic AI engineer** (AI tools that help create and improve other AI tools, called agents) speeds up the process of building and refining AI agents, reducing the time spent on manual tasks like testing and debugging.
  • The process involves creating a detailed plan (spec) for the agent, building it, testing it, deploying it, monitoring its performance, diagnosing issues, and making improvements in a continuous loop.
  • For new agents, the process starts from scratch with a detailed plan, while for existing agents, the focus is on optimization and improvement.
  • This approach increases the number of agents that can be developed and deployed in a given time, making it a scalable solution for organizations looking to implement AI agents.

Key points

What it is

  • An agent loop is an AI that keeps reasoning, acting, and checking results until it reaches a goal, like a worker who repeats tasks until the job is done.
  • It has three parts: a trigger (what starts it), an action (the work the AI does), and a stop condition (how it knows it's finished).
  • Instead of manually prompting an AI each time, you design a loop that automatically prompts the AI, removing the need for constant human input.
  • The key to a good agent loop is clear instructions and the right information for the AI to work with.

How to use it

  • Start with a clear, simple goal for the AI, like "build a library website of agentic loop ideas."
  • Use a main agent (like a chief of staff) to reason, act, and observe results, iterating until the goal is met.
  • You can also use multiple agents, like one to do the work and another to grade and give feedback.
  • Design loops that "pull until done" or "retry with back off" for reliability, and consider having the agent create scripts for repeatable tasks.

Watch out for

  • Code bloat: when the AI's generated code exceeds about 1,000 lines, the loop can break due to the AI's inability to fully review and understand that much context.
  • Unchecked assumptions: when the AI is given too much freedom to guess, it usually gets it wrong and wastes resources.
  • Always provide clear instructions and limit the scope per iteration to ensure the AI understands its tasks.

Tools named

  • Claude Code (a framework that runs the agent loop).

Lesson 1: What is Agent Loops and Code and why it matters

An agent loop is an AI that repeatedly reasons, acts, and observes results until it meets a goal. Think of it like a worker who figures out what to do, does it, checks what happened, then repeats until the job is done. The loop itself has three parts: a trigger (what starts the process), an action (the work the AI does), and a stop condition (how the AI knows it’s finished). The stop condition is often a clear, objective goal and a verification step to confirm the goal is met.

This matters because the best AI developers no longer write prompts—they design loops that automatically prompt the agent. Instead of you telling the agent what to do step-by-step, you build a meta agent that infers what loops you would want and runs them for you. This removes the human from the loop, allowing the AI to work faster and more autonomously. The key difference between a good and bad agent isn't the AI model itself—it’s what information the agent can read and how clearly the job is described. For example, a loop might keep checking, screenshotting, and reviewing until documentation is fully updated. By designing these recursive systems, you get your time back because the AI does both the thinking and the work.

Sources

Lesson 2: How to use Agent Loops and Code: step-by-step

An agent loop is an AI that reasons on what to do, acts on it, observes the result, and repeats until a goal is met. Think of it as a cycle with three parts: a trigger, an action, and a stop condition. Instead of manually prompting a coding agent each time, you design loops that prompt your agents for you. This shift—from human-in-the-loop to human-on-the-loop—turns Claude from a simple tool into infrastructure.

Here is a concrete example. Use Claude Code as your harness (the framework that runs the loop). Start with one main agent—your chief of staff. Give it a single sentence like "build a library website of agentic loop ideas." Claude reasons about the task, acts by writing code, observes the result, and iterates. If the first attempt isn't right, it doesn't start over; it continues the loop until done. One sentence can become 12 files because Claude understands the full scope.

Another pattern: have one agent that does the work and a second agent that grades the output and gives feedback. The main agent loops until the grader is satisfied. You can also set up a manager agent with helper sub-agents, all looping and calling each other. The key is to stop writing prompts for each step. Instead, define the loop—the trigger, the action, and the stop condition—and let the agent run until the documentation is fully up to date or the code passes review. You guide the conversation; you don't write the code yourself.

Sources

Lesson 3: Best practices and pitfalls

An agent loop is an AI that reasons, acts, observes the result, and repeats until a goal is met. The core pattern is "reason and act" (often called ReAct). Instead of you manually prompting an AI repeatedly, you design a loop—a system of three parts: a trigger (what starts it), an action (what the AI does), and a stop condition (when it finishes). Leading engineers like Boris Cherny and Peter Steinberg now say they never prompt coding agents directly; they write loops that prompt the agents for them.

A common pitfall is code bloat. When an agent's generated code exceeds about 1,000 lines, the loop often breaks because the AI cannot fully review and understand that much context. This leads to incorrect assumptions and wasted money on failed attempts. Another mistake is letting the agent make unchecked assumptions—when given freedom to guess, it usually gets it wrong and burns credits.

Best practices include designing loops that "pull until done" or "retry with back off" for reliability. For repeatable tasks, tell the agent to make a Python script and inject a description of that script back into the loop. The quality of an agent depends less on the AI model itself and more on what information the loop can read and how clearly the job is described—treat it like onboarding a new teammate with clear instructions and limited scope per iteration.

Sources