A coding agent is an artificial intelligence system that completes software engineering tasks autonomously by reading a codebase, planning changes, editing files, running commands and tests, and iterating on the results until the task is done or it needs human input. Among AI agents, it is the specialized type whose environment is a repository, a terminal and a toolchain.
An AI coding agent differs from an autocomplete assistant in one decisive way: it acts and observes. Instead of proposing a single snippet for a developer to paste, it executes a loop of actions, reads the compiler output or test failures, and adjusts its next step. That feedback loop is what allows it to fix bugs, implement features or migrate code across many files.
How a coding agent works
A coding agent runs an agent loop around a large language model. On each turn, the model receives the task, the conversation so far and the results of earlier actions, then chooses either a tool call or a final answer. The surrounding software, called the agent harness, executes the tool call and returns the output to the model.
The quality of a coding agent depends as much on its tools and harness as on the model. The table below shows the typical tool set and what each tool gives the agent.
| Tool | Purpose | Typical risk |
|---|---|---|
| File read and search | Locate definitions, usages and configuration | Reading secrets into context |
| File edit | Apply targeted changes or create files | Breaking unrelated code |
| Shell command execution | Build, lint, install, run scripts | Destructive or networked commands |
| Test runner | Verify behavior after each change | Tests that pass for wrong reasons |
| Version control | Diff, branch, commit, open pull requests | Unreviewed changes reaching main |
| Web or documentation lookup | Check library APIs and error messages | Prompt injection from pages |
Because a real repository rarely fits in the context window, the agent explores selectively: it searches for symbols, opens only relevant files and summarizes what it learned. Long sessions rely on context compaction, which condenses earlier turns so that the agent keeps its plan without exceeding the token limit.
Levels of autonomy in coding agents
Coding agents operate at different levels of autonomy, and the level determines both productivity and risk. The same underlying model can run as an interactive pair programmer or as a background worker that opens pull requests on its own.
| Mode | Human role | Typical task | Main safeguard |
|---|---|---|---|
| Interactive in the editor | Approves each action | Refactor a module | Per-step confirmation |
| Terminal agent with permissions | Approves risky actions only | Fix a failing test suite | Permission rules and allowlists |
| Background agent | Reviews the finished pull request | Implement a ticket | Isolated sandbox and code review |
| Orchestrated subagents | Sets goals and reviews output | Large migration across services | Task decomposition and checkpoints |
Higher autonomy shifts the human from human-in-the-loop to human-on-the-loop: the developer stops approving individual edits and instead reviews outcomes. This only works when the agent runs in an agent sandbox with limited credentials, so that a mistaken command cannot damage production systems.
Coding agent compared with related tools
The term coding agent is often used loosely, so it helps to separate it from neighboring categories. The distinguishing feature is closed-loop execution with tools, not the presence of a language model.
| Tool category | Acts on files | Runs code | Iterates on feedback |
|---|---|---|---|
| Code completion | No, suggests inline text | No | No |
| AI coding assistant chat | Sometimes, with user approval | Rarely | Only through the user |
| Coding agent | Yes | Yes | Yes, autonomously |
| Computer-use agent | Through a graphical interface | Indirectly | Yes, from screenshots |
| Static analysis tool | No | No, analyzes source | No |
A coding agent may itself use a code execution tool, call servers through MCP, the Model Context Protocol, or delegate subtasks to subagents. These are building blocks; the coding agent is the complete system that turns a task description into verified code changes.
Getting reliable results from a coding agent
Reliable results come from giving the agent a way to check its own work. An agent that can run tests, type checkers and linters corrects many of its mistakes before a human sees them; an agent without feedback produces plausible code that may not even compile.
- State the goal and the acceptance criteria, for example which tests must pass and which files must not change.
- Provide project conventions in a repository instruction file, including build commands and code style.
- Keep tasks scoped: one feature or one bug per session yields smaller, reviewable diffs.
- Grant least-privilege permissions, with network access and deployment credentials disabled by default.
- Review every diff as you would a colleague’s pull request, focusing on logic and security rather than style.
Agent evaluation benchmarks measure the share of real repository issues an agent resolves with passing tests. Scores have risen quickly, but they depend heavily on the harness, the time budget and the benchmark’s composition, so benchmark results transfer poorly to a specific codebase. A short internal trial on representative tickets is the more useful signal.
Risks and limitations of coding agents
Coding agents fail in ways that differ from human developers, and knowing those patterns makes review faster. The most serious risks involve security and silent incorrectness rather than obvious crashes.
| Failure | Why it happens | Mitigation |
|---|---|---|
| Tests edited to pass | Agent optimizes for the visible signal | Protect test files, review test diffs |
| Invented API or package | Model recalls a nonexistent interface | Run the build, pin dependencies |
| Destructive shell command | Overly broad cleanup step | Sandbox, deny lists, approvals |
| Prompt injection from repository content | Instructions hidden in files or issues | Treat content as data, limit tools |
| Drift on long tasks | Lost context after compaction | Checkpoints and written plans |
Ownership remains with people. The developer who merges the change is accountable for it, and licensing, security review and architectural decisions still require human judgment that an agent cannot supply.
The simple explanation
A coding agent is software that can do programming work on its own, not just give advice. You describe a task, and it opens the project, makes changes, runs the program to see whether it works, and fixes what breaks.
Compare it with a helpful colleague who has access to your computer: you give the instructions, and they try, test and retry until the job is done. You still check the result before it goes live, because the agent can be confidently wrong.
How it is used in practice
A platform team at a logistics company must upgrade a web framework across 40 internal services before the old version loses security support. Doing it by hand would take weeks of repetitive edits, so the team runs a coding agent in an isolated sandbox for each service, with instructions to update dependencies, fix breaking changes and keep the full test suite green.
For each service, the agent reads the migration notes, edits imports and configuration, runs the tests, and repeats until they pass, then opens a pull request with a summary. Engineers review the diffs, reject a few that changed test assertions, and fix two services by hand. Most of the migration ships within a few days, and engineers spend their time on review and the difficult cases rather than on mechanical edits.