Agentic Coding
Agentic Coding: when the AI writes, tests, and discards code while you get coffee.
In vibecoding, you type a prompt and the AI suggests code. In context engineering, you learned to feed the AI structured information so its suggestions become accurate. Now take the final step: you describe a goal, and the AI handles the rest — reading the codebase, writing files, running tests, fixing its own mistakes, and committing the result. This is agentic coding: an AI that does not wait for your next instruction but pursues a goal autonomously. This article teaches you how the agent loop works, why tests are the agent's most reliable supervisor, and how to choose the right level of human oversight for every situation.
The Agent Loop — How Autonomous Coding Works
What fundamentally separates a coding agent from the autocomplete you know from your editor? An autocomplete system predicts the most likely next token — it reacts to your input, line by line, without a goal of its own. A coding agent, on the other hand, receives a task and works toward its solution independently. The mechanism behind this is the Agent Loop, a self-correcting cycle of five phases.
Definition
Agent Loop
Analogy
Example
Definition
Waits for your input and suggests the next lines. You steer, the AI assists. Effort: high (you write and review every suggestion).
Receives a goal and works toward it independently. Reads the codebase, plans changes, writes code, runs tests, and self-corrects. Effort: low (you specify the task and review the result).
- 1. ObserveRead codebase, understand task, identify relevant files
- 2. PlanDesign changes, plan files and tests
- 3. ActWrite code, create files, execute terminal commands
- 4. EvaluateRun tests, check compiler output and linter results
- 5. IterateOn failure: analyze error, fix code, start a new pass from Observe
A concrete example: you give your terminal agent the instruction:
"Add a login lockout: after three wrong passwords, the user should be locked out for 15 minutes."
The agent reads the project structure and finds the login file. It plans a failed-attempt counter and a timer. It writes the lockout code and creates three test cases (one wrong password, three wrong passwords, retry after 15 minutes). The third test fails — the lockout is not lifted. The agent finds the bug (the timer does not reset the counter), fixes it, and reruns the tests. All three tests pass. It commits the changes. Your effort: one sentence of specification plus a five-minute review.
Note
Key Difference
The fundamental difference is intentionality: an autocomplete system predicts the most likely next token, while an agent works backward from a defined goal. This goal-directed behavior makes the Agent Loop the decisive mechanism behind autonomous coding.
Interactive: The Agent Loop Animated
The Agent Loop is a self-correcting cycle: Observe → Plan → Act → Evaluate → Iterate. Click Play and watch how the agent works from phase to phase — and returns to the beginning when errors occur.
The 5-phase cycle as an animated diagram. Each phase activates in sequence — including the feedback loop from Iterate back to Observe.
Click "Play" to see the process step by step.
The Agent Loop is not a linear process. It repeats until all tests pass or the agent determines it cannot proceed. This iterative self-correction is the core of autonomous coding.
Tests as Supervision — Why the Red-Green Loop Matters
Why are tests even more important for a coding agent than for a human developer? A human developer has intuition and domain knowledge — they often notice when something is wrong even without a formal test. An agent has only the feedback loop: if no test fails, the agent assumes everything works. Tests are therefore not just quality assurance but the primary supervision mechanism.
Definition
Test-Driven Generation
Analogy
Example
Definition
The process follows a Spec-to-Code pipeline: the agent reads a specification and generates code and tests from it. The tests then enter the Red-Green Loop — on failure, the agent analyzes the output, adjusts the code, and retests. Crucially: when you give the agent test cases first and then instruct it to write code that passes those tests, you get measurably better results than with vague natural-language descriptions. Tests provide unambiguous, machine-verifiable acceptance criteria.
The SWE-bench benchmark demonstrates this principle at scale. It contains 2,294 real GitHub issues from production repositories, each with associated test cases. An agent receives only the issue text — no hints, no solution path. It must read the repository, understand the bug, implement a fix, and make the associated tests pass.
On this full set, the best entry on the official leaderboard reached 52.6% at the end of 2025. More common is SWE-bench Verified, a human-checked selection of 500 tasks. There, vendors now report more than 90%, but the benchmark is considered saturated: since February 2026 OpenAI no longer reports Verified results, because models already know tasks and their solutions from training and some tests reject correct solutions. The harder SWE-bench Pro is recommended instead. On its independent leaderboard, the best system solves about 60% of the tasks (as of November 2026). For the rest, the agent cannot locate the root cause, introduces regressions, or produces a fix that does not actually resolve the issue. My reading: on familiar, well-scoped tasks agents have become strong; on new and hard ones a large share still fails. That is why human oversight remains essential.
Devin: The First Autonomous AI Software Engineer
The ambition: handing software development over to an AI entirely. On March 12, 2024, Cognition Labs introduced Devin — marketed by the company as “the first AI software engineer”. The system can independently plan, clone repositories, write code, debug, test, and even deploy. On the demanding SWE-Bench, Devin achieved a 13.86% success rate on real-world GitHub issues (measured on a random sample of 570 of the 2,294 tasks) — a massive leap over the previous best unassisted result of 1.96%. The startup was valued at around $350 million in an early funding round; in April 2024 a $175 million round followed at a valuation of around $2 billion. A month-long field test by Answer.AI (published in January 2025) revealed the limits: only 3 out of 20 tasks were completed successfully, often with unpredictable failures.
Caution
Specification Determines Quality
An agent without a clear specification is like a factory without a production order — it will produce something, but probably not what you wanted. Vague instructions produce vague results. A combination of precise task description and explicit tests is the most reliable path to useful output.
Human in the Loop — Choosing Your Supervision Level
Even the most capable agent requires human oversight — the question is how much. Modern agentic coding tools implement a spectrum of three supervision levels. The right choice depends on the risk of the task.
Fully Autonomous Mode
The agent handles everything independently — from reading the codebase to committing changes. Appropriate for low-risk work: prototypes, throwaway scripts, internal tools where a mistake costs minutes to fix.
Semi-Autonomous Mode
The agent executes freely for most operations but pauses at defined review points: writing files, running system commands, pushing to git. The developer reviews diffs and architectural decisions. Default for production code.
Assistant Mode
The developer retains full control. The agent helps on demand: generate a function, explain a stack trace, suggest a refactor. Every line is reviewed manually. Required for security-critical code and regulated environments.
Think of a crane operator on a construction site. In fully autonomous mode, the crane has autopilot: it reads the blueprint, picks up the right beams, and places them. This works for routine lifts on a familiar site. In semi-autonomous mode, the operator follows the autopilot's suggested moves but confirms each lift: "Beam 7 to position C-4 — confirm?" They check wind, ground stability, and worker proximity. In assistant mode, the operator flies the crane manually and only asks the system for weight calculations. When a crane operates near a hospital or over a public road, you always use manual mode — the consequences of a mistake are too severe for any autopilot.
Modern tools implement this spectrum through permission systems: read operations happen silently, write operations require confirmation, and risky actions (git push, database migrations, npm install) require explicit approval. Newer tools offer a middle path: in auto mode, now the starting mode of Claude Code in the terminal, a second AI model checks the actions on your behalf. That saves clicks, but then an AI is supervising the AI.
A development team works on a web application. Task 1: "Generate a placeholder loading screen for the internal admin panel." Risk: minimal — three employees use it, a broken loading screen is fixed in minutes. Decision: fully autonomous mode. Task 2: "Refactor the payment module for a new currency." Risk: significant — affects all customers and their payments. Decision: semi-autonomous mode with review of every modified file. Task 3: "Update the auth middleware for FIDO2 security keys." Risk: critical — auth flaws compromise all user accounts. Decision: assistant mode, every line of auth logic reviewed manually.
The industry already uses multi-agent systems where one agent plans, another implements, a third reviews, and a fourth tests — but the supervision principle remains the same.
Claude Code (Anthropic): agent for terminal, IDE, desktop app and browser, works directly in your project with a permission system for controlled autonomy. Codex CLI (OpenAI): comparable terminal agent with sandboxed execution. Gemini CLI (Google): open-source terminal agent. GitHub Copilot: besides autocomplete, since 2025 also a coding agent that works through tasks on its own in the background. Devin (Cognition): marketed as the first "AI software engineer," operates in an isolated cloud environment with its own browser and terminal. Additionally, open-source alternatives like Aider, OpenHands, and SWE-agent are available. Important: tools change quarterly — the principles (Agent Loop, tests, supervision) remain stable.
On the hard SWE-bench Pro, even the best system on the independent leaderboard still fails about 40% of the tasks, and older benchmarks overrate agents because their tasks, solutions included, have ended up in training data. Particularly problematic are unfamiliar codebases with unconventional architectures and undocumented patterns. Hallucination risk exists when agents generate plausible-looking code that uses non-existent APIs or invents function signatures. Compound tasks with dependencies between steps have success rates that drop exponentially with each step. The honest assessment: agentic coding is a productivity multiplier for well-specified tasks, not a replacement for developer judgment.
Note
Takeaways
- A coding agent is not a smarter autocomplete — it pursues a goal through a self-correcting cycle of observing, planning, acting, evaluating, and iterating. Your job shifts from typing code to specifying and reviewing.
- Tests are the agent's supervisor: a comprehensive test suite makes the agent more reliable than any amount of prompt engineering alone, because tests provide objective, repeatable validation. Without tests, the agent is blind to its own mistakes.
- The right supervision level depends on risk: fully autonomous for prototypes, semi-autonomous with review for production code, strict assistant mode for security-critical systems. Even the best agents still fail a large share of hard, real-world tasks — human oversight remains essential.
Check
Checkpoint: Agentic Coding
Can you explain this in your own words? Tick what you've got.
0 of 3 done
Check
Quiz: Agentic Coding
What happens in the "Evaluate" phase of the Agent Loop?
Select one answer
1. What happens in the "Evaluate" phase of the Agent Loop?
2. Why does giving an agent explicit test cases produce better results than a vague natural-language description?
3. A team needs to refactor a payment processing module that handles real customer transactions in multiple currencies. Which supervision level is most appropriate?
4. An agentic coding tool reports "all tests passed" after implementing a new feature. A developer discovers that the agent wrote no test for a critical edge case (empty input). What does this reveal about the relationship between test coverage and code correctness?
5. Your startup is building an internal dashboard for five employees. The agent should add a new statistics page. How do you configure supervision?
6. An agent implemented a bug fix and reports success. Upon analysis, you discover that the agent deleted the failing test instead of fixing the code. What does this behavior reveal about the limits of test-based supervision?