Tech Blog · AI Agents
[AI Agent Basics 10] How do coding agents work?
The final part of the basics series. We show how the pieces covered so far — language models, tool calling, loops, memory, permissions and evaluation — fit together inside a coding agent, and why this structure does not carry over as-is to factory equipment.
Sep 29, 2026 · OPTI-X
Basics series “How AI Agents Are Built” · Part 10 — Wrap-up
One of the most widely used agents today is the coding agent. When a developer says "fix this bug," it reads the code, fixes it, runs the tests and reports the result. Every component covered in this series is in there.
What a single task looks like
The workflow of a coding agent
The agent loop in action
- 1Understand the repositorySearches for and reads the relevant files (tool calling + memory)Next
- 2PlanLays out what to fix and how, step by step (reasoning)Next
- 3Edit and testEdits the code and runs the tests; if they fail, edits again (loop)Tests pass → nextRepeated failure → report to a person
- 4Request reviewSummarizes the changes and asks a person to review them (permissions and approval)Applied after a person approves
SWE-agent, published in 2024, is a research implementation of this workflow. The agent uses commands for file search, a file viewer that shows 100 lines at a time, line-based editing and running tests. All of this runs inside an isolated container. The authors state that they designed it this way to prevent accidents such as commands generated by the language model deleting files on a personal computer.
What each component from the series does
Basic concepts inside a coding agent
Bars = part number in the series
| Component | Series part | Role in a coding agent |
|---|---|---|
| Next-token prediction | 1 | Generates code line by line |
| Instruction tuning | 2 | Understands requests and answers in the right format |
| Reasoning | 3 | Makes a plan for the fix |
| Tool calling | 4 | Reads and writes files, runs commands |
| Agent loop | 5 | Repeats until the tests pass |
| Memory | 6 | Learns the repository structure and conventions |
| Permissions | 7 | Runs in an isolated environment; changes applied after approval |
| Evaluation | 8 | Tests serve as an objective check |
Each component is just as covered in the earlier parts. What is different in coding is that the environment connecting the components is already in place. The isolated environment from Part 7 comes as a container, and the evaluation from Part 8 comes as the tests already in the repository. To bring an agent into other kinds of work, these two have to be built separately.
How much does it solve in real repositories?
SWE-bench, released in 2023, tests coding agents on 2,294 real issues from 12 open-source Python repositories. Even excluding tests, the repositories average 3,010 files and 438,000 lines. The reference fixes change 1.7 files and 32.8 lines on average. The task is to find the few lines to fix in all that code.
At release, the method was to retrieve relevant files and feed them to the model in one go, and even the best model, Claude 2, solved only 1.96%. The following year, SWE-agent solved 12.47% (286 issues) of the same test with GPT-4 Turbo. On the 300-issue Lite subset, the same model scored 11.0% with plain shell commands only and 18.0% with agent-specific commands.
The performance came at a cost. On the Lite subset, SWE-agent's resolve rate was 6.7 times that of the one-go method, but it cost 8–13 times as much. The authors capped spending at $4 per task; when a run exceeded it, the edits made so far were submitted.
Tool design changes performance
The SWE-agent authors changed the tools one at a time and compared the results. Adding a syntax check to the edit command, so that edits introducing errors were not applied and the agent was told immediately, gave the highest resolve rate. Showing files 30 lines at a time or all at once scored lower than showing 100 lines at a time.
Resolve rate by editing tool design
SWE-bench Lite, 300 issues, GPT-4 Turbo · one safeguard against bad edits makes a difference
Failures dragged on. Successful tasks finished in a median of 12 steps and $1.21, while failed tasks used an average of 21 steps and $2.52. After a single failed edit, the chance of eventually succeeding dropped from 90.5% to 57.2%. Of the unsolved tasks, 52.0% were fixes that did not properly solve the problem or only fit specific cases, and 23.4% were failed edits piling up one after another. As we saw in Part 5, wrong actions accumulate, so step limits and checks are needed.
Why coding agents work well
Coding is a field that favors agents. There is an objective way to check: tests; thanks to version control, every change can be rolled back; and there is already a culture of having a person review before the final merge. Alongside the tests that check whether the issue was fixed, SWE-bench runs a median of 51 more tests to check that existing functionality has not broken.
Code vs. factory equipment
The conditions for bringing in an agent are different
Factory equipment lacks these conditions. Change heat-treatment cooling conditions and the result shows up only in the inspection of the next product; chemicals added to a neutralization tank cannot be taken back. With no isolated test environment, trying out a change is itself real production. So instead of tests, a model validated on process data and allowed limits do the checking, and instead of rollback, approval before execution is needed.
The formula behind coding agents' success is not just "a strong model" but "a structure that can be checked, can be rolled back, and is approved by people." How to bring this structure to the factory is the next challenge for manufacturing AI. This concludes the basics series “How AI Agents Are Built.”
References
Could this work for your process?
Talk to us