Start here ยท no jargon

The Basics

If you've never heard the words "agent," "subagent," or "loop" before, this page is for you. We'll use everyday analogies and simple pictures. By the end you'll understand what loop engineering is and why it matters.

Idea 1

What is an AI agent?

A normal chatbot just talks. You ask, it answers. An agent can also do things โ€” it has hands. It can read your files, run commands, edit code, and search the web.

Think of it like the difference between:

  • ๐Ÿ’ฌA chatbot = someone who can only tell you how to fix your bike.
  • ๐Ÿ”งAn agent = a mechanic who picks up the tools and actually fixes it, checking their work as they go.

In Claude Code, that mechanic is Claude โ€” working right inside your project in VS Code.

๐Ÿง  The model (reasoning) decides what to do + ๐Ÿ“– Read files โœ๏ธ Edit code โŒจ๏ธ Run commands Tools (hands) ๐Ÿง  brain + ๐Ÿ”ง tools = an agent
Idea 2

The loop: try, look, adjust

An agent almost never gets a real task done in one move. Instead it goes around a small circle again and again โ€” just like a human working through a problem.

๐Ÿ› ๏ธ 1 ยท Act ๐Ÿ‘€ 2 ยท Observe ๐Ÿ”€ 3 ยท Decide not done yet? go around again โœ“ done!
๐Ÿ› ๏ธ

1. Act

The agent takes one step โ€” reads a file, runs a test, edits a line. A single, concrete action.

๐Ÿ‘€

2. Observe

It looks at what happened. Did the test pass? Was there an error message? What did the file contain?

๐Ÿ”€

3. Decide

Based on what it saw, it decides the next move โ€” or stops because the goal is reached.

๐Ÿ’ก

So what is "loop engineering"?

It's the craft of designing this circle well: giving the agent the right goal, the right way to check its own work, a clear signal for when to stop, and a plan for what to do when a step fails. A good loop turns a clever model into a dependable helper.

See it in action

A tiny example: "fix the failing test"

Watch the same three steps repeat until the job is truly done.

Act โ€” run the tests

The agent runs your test suite to see the current state.

Observe โ€” read the failure

One test failed: expected 5, got 4. It reads the error and the related code.

Decide โ€” form a fix

It spots an off-by-one bug and edits the line.

Act again โ€” re-run the tests

Back around the loop: it runs the suite once more to verify the fix.

Observe โ€” all green

Every test passes. The stopping condition is met, so the loop ends and the agent reports back.

โœ…

The key move

Notice step 4 โ€” the agent didn't just make the change and walk away. It looped back to check. That verification step is loop engineering in miniature.

Main agent the manager ๐Ÿ” Researcherown desk ๐Ÿงช Testerown desk ๐Ÿ‘“ Reviewerown desk each hands back a short summary
Idea 3

What is a subagent?

Sometimes a task has a big, messy side-quest โ€” like reading 40 files to find one function, or double-checking work. If the main agent did all that itself, its "memory" would fill up with clutter.

So it delegates. A subagent is a helper the main agent hires for one job. The helper works at its own desk (its own memory), finishes, and hands back only the answer โ€” not the mess.

  • ๐ŸงนKeeps the manager's desk clean. The main agent only sees the final summary, so it stays focused.
  • โšกMany at once. The manager can send several helpers off in parallel and collect all their answers.
  • ๐ŸŽฏSpecialists. Each helper can be tuned for one job โ€” a researcher, a tester, a reviewer.
The one analogy to remember

The clean-desk rule ๐Ÿงน

Imagine a manager (the main agent) with a small desk. Every note they read stays on the desk. Read too much and there's no room left to think.

A subagent is like sending an intern to the archive room. The intern reads 200 pages at their desk, then walks back with a single sticky note: "the answer is on line 88 of auth.js." The manager's desk stays clear โ€” that's context isolation, and it's the superpower behind subagents.

Quick recap

๐Ÿค– Agent

A model that can use tools to actually do work, not just chat.

๐Ÿ” The loop

Act โ†’ observe โ†’ decide, repeated until the goal is met.

๐Ÿง‘โ€๐Ÿ”ง Subagent

A helper hired for one job that returns just the answer.

๐Ÿ› ๏ธ Loop engineering

Designing that loop so the agent is reliable, not just clever.