---
title: "What is an AI coding agent? How agentic coding works"
description: "An AI coding agent is an LLM in a loop that reads a codebase, edits files and runs commands to finish a task. How it works, what it costs and how to run one."
url: https://broadrouter.com/glossary/coding-agent/
lang: en
updated: 2026-11-16
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# AI coding agent

Updated 2026-11-16

An AI coding agent is a software tool in which a language model works on a codebase in a loop: it reads files, edits them, runs commands such as tests, reads the output and decides the next step until the task is done or a limit is reached.

Also called: coding agent, agentic coding, AI coding assistant

A coding agent is an [AI agent](https://broadrouter.com/glossary/agent/) whose tools are your editor, file system and terminal.

## How it works

The agent gets a task in plain language and works in a loop. Each turn, the model either answers or returns [tool calls](https://broadrouter.com/glossary/tool-calling/) such as “read this file”, “apply this edit” or “run the tests”. The tool host runs them, appends the output and calls the model again.

Claude Code’s docs describe it as “an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools.” Aider, Cline and similar tools follow the same loop with different interfaces and permission models.

The SWE-agent paper (Yang et al., 2024) argues that agents are a new kind of user that needs its own interface, an “agent-computer interface”, in the way people need an IDE. With their interface, the authors report a pass@1 rate of 12.5% on the SWE-bench benchmark, which they describe as state of the art at the time.

A typical run, as requests to the model:

| Step | Model output | Tokens sent as input |
| --- | --- | --- |
| 1 | `run_tests()` | system prompt + tools + task |
| 2 | `read_file("src/parse.py")` | step 1 + test output |
| 3 | `edit_file(...)` | step 2 + file contents |
| 4 | `run_tests()` | step 3 + diff |
| 5 | “Fixed; tests pass.” | step 4 + test output |

Input grows every step, because the whole history is resent.

## Why it matters

-   **Cost.** Long tasks mean many requests with large, mostly repeated inputs. The [run cost post](https://broadrouter.com/blog/ai-coding-agent-run-cost/) works through real numbers, and [cutting coding agent costs](https://broadrouter.com/blog/cut-coding-agent-llm-costs/) lists the levers.
-   **Context.** Long sessions fill the [context window](https://broadrouter.com/glossary/context-window/). Agents use [context compaction](https://broadrouter.com/glossary/context-compaction/) and [subagents](https://broadrouter.com/glossary/subagent/) to keep it in check.
-   **Model fit.** The model must follow tool schemas reliably over many turns. See [the best open model for coding agents](https://broadrouter.com/blog/best-open-model-for-coding-agents/).
-   **Safety.** An agent that runs commands can do damage. Keep approval on for destructive actions and treat repository content as untrusted input ([prompt injection](https://broadrouter.com/glossary/prompt-injection/)).

## On BroadNet Inference

Coding agents that accept an OpenAI-compatible base URL can call BroadNet at `https://inference.broadnet.ai/v1`. Setup guides exist for [Aider](https://broadrouter.com/guides/aider-unlimited-deepseek/), [Cline](https://broadrouter.com/guides/cline-openai-compatible/) and others. BroadNet’s docs list tool calling for [GLM 5.3](https://broadrouter.com/models/glm-5.3/) and [Qwen3.8 27B](https://broadrouter.com/models/qwen3.8-27b/).

On pay-as-you-go, a key allows 30 requests per minute and 4 in flight. The [flat-rate plans](https://broadrouter.com/plans/) (Full Moon, Orbit, Meteor) cover [DeepSeek V4.1 Flash](https://broadrouter.com/models/deepseek-v4.1-flash/) with no token meter. A session runs one request at a time, which fits one agent. If you run agents in parallel, or an agent that starts subagents, buy one session for each request that runs at the same time. The [sessions guide](https://broadrouter.com/guides/unlimited-llm-api-sessions/) shows the math.

## Questions

### What is the difference between a coding agent and code autocomplete?

Autocomplete suggests the next few lines while you type. A coding agent takes a whole task, such as fixing a failing test, and runs many steps on its own, reading files, editing them and running commands until it finishes.

### Why do coding agents use so many tokens?

Every step is a new request that resends the system prompt, tool definitions, file contents and the growing history. A task of 40 steps sends that prefix 40 times, which is why cached input and flat plans matter for agents.

### Can I use an open model in Claude Code, Aider or Cline?

Tools that accept an OpenAI-compatible base URL can call open models. Aider, for example, documents setting OPENAI\_API\_BASE and OPENAI\_API\_KEY and prefixing the model name with openai/.

## See also

-   [AI agent](https://broadrouter.com/glossary/agent/) (term)
-   [Tool calling](https://broadrouter.com/glossary/tool-calling/) (term)
-   [Subagent](https://broadrouter.com/glossary/subagent/) (term)
-   [Context compaction](https://broadrouter.com/glossary/context-compaction/) (term)
-   [Flat-rate LLM plan](https://broadrouter.com/glossary/flat-rate-llm-plan/) (term)
-   [Concurrency](https://broadrouter.com/glossary/concurrency/) (term)
-   [ReAct (reason and act)](https://broadrouter.com/glossary/react-agent/) (term)
-   [Run Aider on unlimited DeepSeek V4.1 Flash](https://broadrouter.com/guides/aider-unlimited-deepseek/) (guide)
-   [Use Cline with BroadNet Inference (OpenAI Compatible provider)](https://broadrouter.com/guides/cline-openai-compatible/) (guide)
-   [How the unlimited LLM API plans work for agents](https://broadrouter.com/guides/unlimited-llm-api-sessions/) (guide)
-   [Best open model for coding agents: pick by tools, context and cost](https://broadrouter.com/blog/best-open-model-for-coding-agents/) (article)
-   [10 ways to cut coding agent LLM costs, with estimated savings](https://broadrouter.com/blog/cut-coding-agent-llm-costs/) (article)
-   [What one AI coding agent run costs: steps, context growth, caching](https://broadrouter.com/blog/ai-coding-agent-run-cost/) (article)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-coding-agent&utm_content=page-cta) ·

**Sources**

-   [Yang et al., SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering, arXiv 2405.15793 (checked 2026-11-15)](https://arxiv.org/abs/2405.15793)
-   [Claude Code docs, overview (checked 2026-11-15)](https://code.claude.com/docs/en/overview)
-   [Aider docs, OpenAI-compatible APIs (checked 2026-11-15)](https://aider.chat/docs/llms/openai-compat.html)
-   [BroadNet Inference API reference, plans and limits (checked 2026-11-15)](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-coding-agent&utm_content=sources)
