Back to Learning Area

Agentic Coding

Agentic Coding: when the AI writes, tests, and discards code while you get coffee.

  • Concepts
  • 10 min
  • Intermediate

Plain Language

This preview is in Plain Language. The whole portal is also available in Plain Language. You can change the language at the top. Or use the button below. Our Plain Language texts are AI-assisted and editorially reviewed. They follow the core principles of easy-to-read language, but they are not certified Easy Read: a review panel of people with learning difficulties does not test them.

Preview: AI writes code itself

What is agentic coding?

You give the AI a goal. The AI reads the code itself. It writes and checks everything. This is agentic coding. Agentic coding means: the AI works by itself.

The agent loop

The agent loop is a cycle. Loop means: repeat again and again. First, the AI watches the task. Then it plans. Then it writes code. Then it checks everything. If there are errors, it starts again.

You keep control

The AI needs control. For simple tasks, you can let the AI work alone. For important code, you check every step. The risk decides the control.

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

Think of a factory floor manager who receives a production order. First, the manager walks the floor to understand the current setup (Observe). Then they write a production plan (Plan). They start the machines and assign workers (Act). They inspect the first batch for defects (Evaluate). If there are issues, they stop production, identify the cause, and adjust the machine settings (Iterate). The manager does not wait for instructions at each step — they own the entire process from order to delivery.

Example

The analogy has limits: a factory floor manager has years of experience and genuine understanding of materials and machines. A coding agent operates through statistical pattern matching on training data — it can produce plausible-looking code that is subtly wrong. Additionally, a factory manager can solve truly novel problems creatively, while an agent is limited to patterns it has seen in training data.
Autocomplete (reactive)

Waits for your input and suggests the next lines. You steer, the AI assists. Effort: high (you write and review every suggestion).

Agent (autonomous)

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. 1. ObserveRead codebase, understand task, identify relevant files
  2. 2. PlanDesign changes, plan files and tests
  3. 3. ActWrite code, create files, execute terminal commands
  4. 4. EvaluateRun tests, check compiler output and linter results
  5. 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.

Agent Loop Visualization

The 5-phase cycle as an animated diagram. Each phase activates in sequence — including the feedback loop from Iterate back to Observe.

ObserveRead codebasePHASE 1PlanDesign changesPHASE 2ActWrite codePHASE 3EvaluateRun testsPHASE 4IterateFix errorsPHASE 5Back to Observe on failure
Start animation

Click "Play" to see the process step by step.

Why a cycle?

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

Think of a practical driving test. The examiner (the test suite) has a checklist: parallel park within 30 cm of the curb, stop completely at every stop sign, maintain safe following distance. The candidate (the agent) must pass every item — not just most of them. If they fail parallel parking, they cannot argue: "But I was great at highway driving." Existing test items (regression tests) cannot be removed to make the candidate pass.

Example

The analogy has a critical limit: a driving test examiner also evaluates nuanced behavior (smooth acceleration, situational awareness) beyond the checklist. Software tests only check what is explicitly tested — untested behavior remains invisible to the agent. "All tests passed" therefore does not guarantee correctness.

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.

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

Not completed

What happens in the "Evaluate" phase of the Agent Loop?

Select one answer

Answer Key: 1) C · 2) B · 3) B · 4) B · 5) C · 6) D