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 বনাম context engineering: harness 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