Last updated: July 2026
An AI coding agent is an LLM-powered tool that autonomously reads, writes, and runs code in a loop to complete a task. You give it a goal; it plans, uses tools — read a file, edit, run a command, search — observes the results, and iterates until the work is done. That loop is what separates it from plain autocomplete.
"AI coding agent" gets used for everything from a smarter autocomplete to a fully autonomous engineer. They are not the same thing. This guide explains what an agent actually is, how the agentic loop works step by step, the three form factors you will run into, and why all of them consume so many tokens.
An AI coding agent is a tool built on a large language model that can autonomously read, write, and run code in a loop to finish a task you describe in plain language. The key word is autonomously: you hand it a goal, and it decides what steps to take, executes them using real tools, checks whether they worked, and keeps going until it believes the job is done — or it hits a limit and hands back to you.
That is a meaningful jump from earlier AI coding tools. A code completion model predicts text. An agent takes actions in your project: opening files, editing them, running your test suite, reading the failures, and trying again. It is the difference between an assistant that suggests and one that does.
The clearest way to understand an agent is to contrast it with the thing it is often confused for. Autocomplete — the grey ghost text that finishes your line as you type — is reactive and bounded. It looks at your cursor, predicts the next few lines, and stops. You are still the one driving; it just saves keystrokes. It never runs anything, never reads across your codebase on its own, and never decides what to do next.
An agent inverts that relationship. You describe an outcome — "add pagination to the users endpoint and update the tests" — and the agent takes it from there. It figures out which files are involved, edits several of them, runs the tests, reads what broke, and fixes it, looping until the outcome is achieved. Autocomplete assists your keystrokes; an agent completes whole tasks. Both are useful, but they solve different problems and cost wildly different amounts of tokens.
Everything an agent does happens inside a single repeating cycle. Understanding this loop is the fastest way to understand agents — and to understand their cost. It goes like this:
A real session might run this loop dozens of times. Read the file, edit it, run the tests, see three failures, read the relevant module, fix the edit, re-run, pass, done. Each pass is a full round trip to the model. This is the engine under every agent, whether it lives in your terminal, your IDE, or the cloud — and it is also, as we will see, exactly why they are expensive.
Agents ship in three broad shapes. They run the same loop; they differ in where they live and how much of the driving they take over.
These run in your command line and work directly against your repository. Claude Code, Codex CLI, Aider, opencode, and Gemini CLI are the common ones. They tend to be fast, scriptable, and transparent — you watch each tool call scroll past — which appeals to developers who want to stay close to the metal. If you are choosing among them, our Claude Code alternatives guide compares the main options head to head.
These live inside your editor as an "agent mode" alongside inline suggestions. Cursor, Windsurf, and GitHub Copilot agent mode are the leading examples. The pitch is convenience: the agent has your open files and editor context right there, and edits show up as diffs you can review in place. They blur the line between autocomplete and agent because they offer both in one window.
These run remotely and aim for maximum autonomy — you assign a task and come back to a result, often a pull request. Devin is the best-known example. You give up the most step-by-step control here in exchange for the agent handling long, multi-step work unattended. It is the far end of the spectrum: least supervision, most independence.
Here is the part that surprises people the first time they see an agent's bill. Agents consume tokens far out of proportion to how much you type, and the reason is baked into the loop from the previous section: context accumulates every step.
On each pass of the loop, the model needs to see what has happened so far — the original goal, the files it has read, the edits it has made, and the output of every tool call. So all of that gets re-sent on every turn. A 4,000-token file the agent read on step 3 rides along again on steps 4, 5, 6, and every step after. Over a 30-step session, that single early read can be billed dozens of times. Multiply that by every file, every test log, and every search result, and the token count balloons well past what the conversation "looks like."
This is why a session that felt short can cost a surprising amount, and why longer, more autonomous runs cost disproportionately more — more steps means more context carried forward on each one. If you want the numbers behind this, our breakdown of AI coding agent costs walks through where the tokens actually go, how many tokens AI coding agents use per session quantifies typical volumes, and our AI coding tools pricing comparison shows how that translates into dollars across the popular tools.
Every choice about agents comes back to one trade-off: more autonomy means more capability, but also more cost and less control. A terminal agent you supervise turn by turn is cheaper and easier to steer, but you are in the loop. A cloud agent that runs unattended handles bigger jobs, but it spends more tokens getting there and gives you fewer chances to course-correct before it goes down the wrong path.
There is no single right answer — the best form factor depends on the task and how much you want to watch it. What helps in every case is visibility into what each turn is actually costing. That is the light-touch layer Terse adds: it tracks per-turn token cost across agents so you can see, in real time, how a session is compounding — without changing how the agent works. When the agentic loop is doing its job invisibly, a quiet running total of the tokens is how you keep the trade-off honest.
Terse tracks per-turn token cost across Claude Code, Cursor, and other agents — on-device, zero latency, no API calls. Watch context compound turn by turn before it shows up on a bill.
Terse for Claude CodeAn AI coding agent is an LLM-powered tool that autonomously reads, writes, and runs code in a loop to complete a task. You give it a goal, it plans, uses tools like reading files, editing, running commands, and searching, observes the results, and iterates until the task is done — unlike autocomplete, which only suggests the next few lines.
Autocomplete suggests the next line or few lines as you type and stops there. An agent works in an agentic loop — it plans a task, calls tools to read files, edit code, and run commands, checks the results, and keeps going on its own until the goal is met. Autocomplete assists your keystrokes; an agent completes whole tasks.
There are three form factors: terminal-first agents like Claude Code, Codex CLI, Aider, opencode, and Gemini CLI; IDE-embedded agents like Cursor, Windsurf, and GitHub Copilot agent mode; and cloud or fully autonomous agents like Devin. They differ in where they run and how much control you keep over each step.
Because context accumulates every step of the loop. Each turn re-sends the files, tool outputs, and conversation history gathered so far, so a file read early in a session gets billed again on every later turn. More autonomy means more steps, more context carried forward, and more tokens — which is why costs climb with long agent runs.