beginnercorecore-conceptintroductionai-agentautonomous

What is Loop Engineering

Designing the system that prompts, verifies, and iterates AI agents autonomously — the successor to Prompt Engineering.

Loop Engineering is the practice of designing the system that prompts, verifies, and iterates an AI agent — instead of prompting it by hand. As Addy Osmani defined it in his foundational June 2026 essay (addyosmani.com/blog/loop-engineering): "Loop engineering is replacing yourself as the person who prompts the agent. You design the system that does it instead."

The core idea is simple. Instead of typing a prompt, reading the output, typing another prompt, and repeating manually, you build a small system that defines a goal, executes actions, checks results against real feedback, and loops until the job is done. The unit of work is no longer a single prompt — it is the loop itself.

The Definition

Loop Engineering designs and implements systems where AI agents autonomously follow a repeating cycle:

Define Goal → Act → Observe Feedback → Verify → Iterate or Terminate

Each iteration represents one complete pass through this cycle. The agent inspects its environment (reads files, checks test results, queries APIs), takes an action (writes code, sends a message, modifies state), receives real feedback from that action (did the tests pass? did the API return 200?), and decides what to do next — all without human intervention.

The term draws from control systems theory, where a "loop" describes a feedback cycle: a system measures its output, compares it against a target, and adjusts its inputs accordingly. Applied to AI agents, the same logic applies — the agent measures its actions against a goal and self-corrects until the target is met.

The Evolution: From Prompts to Loops

Loop Engineering did not emerge from nowhere. It is the latest layer in a steady progression outward — from the words you type, to the information the model sees, to the environment it runs in, to the cycle that drives it. Each layer wraps the previous one without replacing it.

EraParadigmUnit of WorkKey Focus
2022–2023Prompt EngineeringThe promptWording, chain-of-thought, few-shot examples
2024Agentic WorkflowsThe chainChaining tools and models into multi-step flows
2025Agent EngineeringThe harnessCoding agents with tool-use, verification, state
2026Loop EngineeringThe loopIterative feedback cycles, autonomous operation

Prompt Engineering (2022–2023)

The first skill was wording. Give the model a role, break the task into steps, add examples, ask it to think step by step. Prompt Engineering optimized expression. Its ceiling was real: a perfectly phrased prompt still cannot supply facts the model never received, nor can it verify that the output it produced is actually correct. Traditional prompt stuffing routinely sends 20,000+ tokens per request, but enterprise reports have shown that as much as 95% of that context is irrelevant to the actual task.

Agentic Workflows (2024)

The focus moved from single prompts to chaining multiple steps together. Frameworks like LangChain (released in late 2022, gained major traction through 2024) and its graph-based orchestration layer LangGraph let developers wire up tool calls, memory, and planning into pipelines. AutoGen from Microsoft Research and CrewAI introduced team-based multi-agent patterns where specialized agents collaborate on tasks. HuggingFace released smolagents as a lightweight alternative for developers who needed agent tool-use without framework overhead. The agent could take multiple actions in sequence — but it still needed a human to trigger each step and evaluate each result.

Agent Engineering (2025)

As coding agents matured, the harness — the full environment of scaffolding, tools, constraints, and feedback mechanisms — became the focal point. Claude Code (official docs at code.claude.com/docs) and OpenAI's Codex CLI (github.com/openai/codex) gave agents direct access to terminals, file systems, and git repositories. Aider (30K+ GitHub stars) pioneered the git-first approach where every LLM edit is immediately committed and verified. Cline brought agent capabilities into VS Code with MCP protocol support for tool integration. Agents could now run autonomously for extended periods, but the design of the cycle that drove them was still ad-hoc.

Loop Engineering (2026)

The newest framing zooms in on what actually produces autonomy: the iterative cycle. Boris Cherny, who leads Claude Code at Anthropic, described the shift in a widely cited interview (towardsai.net): "I don't prompt Claude anymore. I have loops running that prompt Claude and figuring out what to do. My job is to write loops." When the people building the most-used coding agents stop prompting by hand, the practice has clearly moved from fringe to mainstream.

Real Examples in Production

Loop Engineering is not theoretical — it is shipping in production tools right now.

Claude Code

Anthropic's Claude Code (github.com/anthropics/claude-code, docs at code.claude.com/docs) implements loop primitives directly. The /goal command (available since v2.1.139) keeps the agent working until a verifiable condition is met — for example, "all tests pass and lint is clean." After each turn, a separate evaluation layer checks whether the condition holds, so the model that wrote the code is not the one grading it (VentureBeat coverage). Claude Code also supports sub-agents for parallel isolation, skills packaged as SKILL.md files, and external tool connections via MCP (Model Context Protocol). You can run it headlessly in CI:

# Run Claude Code unattended until tests pass
claude --dangerously-skip-permissions "Fix all failing tests. Run npm test after each change."

Claude Code's scheduled automations let you run recurring tasks on a cadence — for example, triaging new GitHub issues every morning without human involvement.

Cursor Agent Mode

# Cursor Agent best practice: understand first, then modify
# 1. Use Chat mode to explore the codebase structure
# 2. Decompose the task into smaller sub-tasks
# 3. Use Agent mode for each sub-task with verification after each

Windsurf (Codeium)

Windsurf (windsurf.ai) from Codeium offers the Cascade agent, which executes multi-step workflows with built-in verification. Cascade reads the project context, identifies what needs to change, makes the edits, runs tests, and iterates — mirroring the same goal-act-verify pattern that defines loop engineering. This shows the loop pattern is not vendor-specific; it is emerging independently across every major AI coding tool.

Aider and Continue.dev

Beyond the major IDEs, open-source tools embrace loop patterns too. Aider (30K+ GitHub stars) connects directly to your git repository and lets an LLM edit files in a commit-by-commit loop — each change is verified by running git diff and optional test commands:

# Aider: commit-by-commit loop with Claude 3.5 Sonnet
aider --model claude-3.5-sonnet

# Aider with auto-commit and test verification
aider --auto-commit --test-cmd "pytest"

Continue.dev provides an open-source VS Code and JetBrains extension (continue.dev) where agents can iteratively read, edit, and verify code through a configurable chat loop with tool use. Both tools prove that loop engineering is not exclusive to hosted platforms — the same iterative verification pattern works in any environment where the agent can observe real feedback.

The Cost Case for Loops

The Five Building Blocks of a Loop

Addy Osmani's anatomy identifies five components that every well-engineered loop needs, plus one for memory:

BlockPurposeWhat It Does
AutomationsThe heartbeatScheduled tasks that find work and run on a cadence
WorktreesIsolationSeparate working directories so parallel agents do not collide
SkillsKnowledgePackaged project context so the agent does not re-derive everything each cycle
ConnectorsIntegrationMCP-based connections to external tools (issue trackers, APIs, Slack)
Sub-agentsVerificationSeparate agents for ideation and review — the maker/checker split
MemoryPersistenceExternal state (markdown files, Linear boards) that survives across runs

The sixth element — external memory — is critical because the model forgets everything between runs. The agent forgets, but the repository does not. As Osmani puts it: "A markdown file or a Linear board, anything that lives outside the single conversation and holds what is done and what is next."

A Concrete Loop in Practice

Here is what a minimal loop looks like using Claude Code's primitives. Imagine you want an agent that continuously fixes lint issues on your main branch:

  1. Automation — A scheduled task runs every 30 minutes.
  2. Worktree — Each run creates an isolated git worktree so multiple runs never collide.
  3. Skill — A SKILL.md file tells the agent your lint config, preferred style fixes, and which files to ignore.
  4. Connector — An MCP server connects to GitHub, letting the agent read open issues and create PRs.
  5. Sub-agent — A separate review agent validates each proposed fix before it is committed.
  6. Memory — A CLAUDE.md file in the repo root persists context about previously fixed issues and patterns.
# Example CLAUDE.md for a lint-fixing loop
repo-root/CLAUDE.md

## Project
This is a TypeScript project using ESLint + Prettier.

## Patterns Fixed Previously
- Removed unused imports in src/api/
- Fixed no-explicit-any in src/utils/format.ts (2026-06-20)

## Do Not Touch
- src/legacy/ directory is deprecated — do not modify

The agent runs the loop: check lint, find violations, fix them, verify the fix, create a PR. No human prompts each step — the system design drives the cycle.

Why Loop Engineering Matters

The significance is not the buzzword — it is where the leverage moves. Three structural shifts make Loop Engineering the defining paradigm of 2026:

1. The bottleneck moved from authorship to orchestration. When the model can write the code, the scarce skill is designing the cycle that keeps it correct and pointed at the goal. That is a systems-engineering skill, not a copywriting one.

What Loop Engineering Is Not

A balanced view matters. Loop Engineering does not mean every developer should build autonomous agent fleets tomorrow. For many tasks, an interactive session with a capable agent is faster and safer than engineering a full loop. And a loop does not remove the human — you still own the goal, the definition of "done," and the judgment about whether the output is actually correct. As Osmani warns: "Two people can build the exact same loop and get completely opposite results. One uses it to move faster on work they understand deeply. The other uses it to avoid understanding the work at all. The loop doesn't know the difference. You do."

Next Steps