Autonomous AI Coding Agent for Hours: Loop Engineering and Stop Conditions
Loop engineering: running an AI coding agent in an autonomous loop. Loop types, goal and metric, stop conditions, human escalation, generator and evaluator separation, costs of autonomy.
- Design an autonomous loop with explicit stopping conditions and escalation.
- Separate the generator and the evaluator so that one cannot deceive the other.
- Assess your own process against the autonomy maturity ladder.
강의 시작 부분
The agent that worked all night in the wrong direction
- A goal with no clear finish line — a loop that doesn't know when to stop
- The agent's own self-assessment as the only brake — and it fails to engage
- No one called a human, though the moment was obvious
An agent on the night shift sounds wonderful: set the task, go to bed, wake up to a finished result. In practice it often goes differently. The agent cheerfully runs the same step again, because it doesn't remember the previous run. It decides for itself that it has succeeded — and then believes its own verdict. The stop condition is written down nowhere, and there's nothing prompting it to call a human, because the loop can't recognise the moment it's stuck. The problem isn't the model. The problem is that the loop was designed like an ordinary prompt, only set running in circles.
🤔 Myth: a loop makes the harness optional
- 🤔 Myth: add a loop on top and you can relax about the harness
- ✅ In reality: the harness makes a single run reliable; the loop makes continuous runs autonomous
- 📌 Remember: a loop on top of a weak harness produces rubbish faster
Here's a trap that's easy to fall into: you stop being the person writing prompts for the agent and start designing a system that writes them for you — and it feels as though the harness you've been building since the beginning of the course now matters less. Quite the opposite. The harness makes a single run reliable. The loop makes continuous runs autonomous. If the harness is shaky, the loop simply produces rubbish faster and unsupervised — only now on an industrial scale.
The simplest possible loop
- Goal — what the end state looks like
- Verification method — machine-checkable
- Stop condition — an attempt limit and a budget
Imagine you're going away for the weekend and you leave a trusted tradesperson your keys — clear the blocked gutter while I'm away. Take away any one of the three parts, and it stops being a loop. First, the goal: 'the gutter is dry after rain', not 'the tradesperson popped round and had a look'. Second, the way of checking: when you're back, hold a bucket under the downpipe for five minutes — dry means done, rather than 'the tradesperson reckons it's all sorted'. Third, the stop condition: three attempts and an agreed budget, after which they stop and ring you, rather than taking it upon themselves to redo the roof. Without any one of the three, it isn't a loop — it's a single visit that happened to be repeated a few times.
전체 강의는 구독 후 이용 가능
전체 버전에는 22개의 슬라이드가 더 있습니다.
로그인하고 구독하면 영상, 모든 슬라이드, 노트, 테스트, AI 튜터, 면접을 이용할 수 있습니다.
로그인 또는 회원가입 구독하기강의 목차
- The agent that worked all night in the wrong direction
- 🤔 Myth: a loop makes the harness optional
- The simplest possible loop
- A plain prompt versus a loop
- Four types of loops
- Pitfall: mixing up a time-based loop with a goal-based loop
- ❓ Checkpoint: does this job have an end?
- The six primitives of a loop
- The six primitives of a loop
- Three conditions without which an autonomous loop won't start
- Three things without which the agent goes blind, flatters itself and forgets everything
- Generator–evaluator separation: the guarantee you can't opt out of
- The rules of separation: someone must not take your word for it
- 🛠 Andrej Karpathy's autoresearch
- Three files, three roles
- The mechanics of the loop: a ratchet that only moves forward
- Two design decisions worth stealing
- The full map of a loop that can't lie to itself about success
- program.md — the methodology in its real form
- Four quiet costs of autonomy
- Antidotes — and Osmani's insight about two identical loops
- The autonomy maturity ladder
- End-to-end project: program.md for a payments backend
- How to build your first loop in a single evening
- From harness to loop — and beyond
이 강의 관련 글
- AI 에이전트를 신뢰할 수 있게 만드는 방법: 측정에서 자율 작업까지 단계별 로드맵
- Harness engineering이란: AI 에이전트를 실제로 쓸 수 있는 도구로 만드는 방법
- CLAUDE.md와 AGENTS.md: 무엇이며 무엇을 써야 하고 에이전트가 규칙을 무시하는 이유
- 에이전트가 "완료"라고 했지만 기능이 작동하지 않는다: AI 에이전트 작업을 검증하는 방법
- Harness vs context engineering: 하네스 엔지니어링은 prompt 및 context engineering과 어떻게 다른가
이 강좌의 모든 강의
- What Is Harness Engineering? Why AI Coding Agents Fail Because of the Environment
- Error Accumulation in AI Agents: Why 95% Per-Step Accuracy Fails by Step 10
- AI Agent Reliability Metrics: MTBF, MTTR, Blast Radius and Little's Law
- Why AI Agents Fail in Production: Five Failure Layers and a Diagnostic Loop
- What an AI Agent Harness Is Made Of: Instructions, Tools, Environment, State, Feedback Loops
- Repository Map for AI Coding Agents: Project Structure and State Without Memory
- AGENTS.md Best Practices: Why a Giant Instructions File Fails and How to Build a Router
- AI Agent Memory Between Sessions: Session Handoff, PROGRESS.md and Bootstrap Contract
- feature_list.json for AI Agents: WIP=1, Feature Status and verify.sh Verification
- Agent Says 'Done' but the Feature Is Broken: Verification Gap and Definition of Done
- All Tests Pass, Feature Is Broken: E2E Tests and Architecture Rules for AI Agents
- AI Agent Observability: Sprint Contracts, Evaluator Rubrics and Clean Session Exit
- Autonomous AI Coding Agent for Hours: Loop Engineering and Stop Conditions
- Graph Engineering for AI Agents: When a Single Loop Is Not Enough and You Need a Task Graph
- Building an AI Agent Harness From Scratch: AGENTS.md, feature_list.json, verify.sh and an Autonomous Loop