The Subtractive Design of Coding Agents: How a Simple Loop Unlocks Model Capability
Autonomous coding agents become more effective when the system gives models a reliable tool-use loop instead of hard-coding every decision. This article traces the evolution from copy-and-paste coding to autonomous execution, explains why current models make this approach practical, and presents a minimal architecture based on tool calls and result feedback. It also covers tool design, permissions, context management, observability, validation, and a practical implementation path.
1. Four Stages in the Evolution of Coding Agents
To understand the value of autonomous coding agents, it helps to examine how they have evolved. Each stage addresses a different problem, and the human’s role in the loop changes accordingly.
1. Copy-and-Paste Coding
Developers describe a requirement to a conversational model, copy the generated code into an editor, run it, and then bring any error messages back into the conversation. The human is responsible for everything: transferring code, running the program, and evaluating the result.
The main limitation is that the model is completely disconnected from the development environment. It cannot inspect the project structure or verify whether its output works.
2. Inline Generation
Editors begin to offer built-in code generation. Developers can use a shortcut to generate code directly at the cursor, eliminating the friction of copying and pasting.
However, each interaction is still a one-time generation step. The model does not read other files or run tests, so the quality of the changes depends heavily on how the prompt is written.
3. Interactive Conversation
The system supports multiple rounds of communication and gradually accumulates context. The model can ask clarifying questions, explain design trade-offs, and develop a better understanding of the task.
File reads and command execution, however, are often still confirmed or triggered manually by the developer. Automation remains limited.
4. Autonomous Execution
The model decides which files to read, which commands to run, and how to interpret the results. It repeatedly modifies the code based on feedback until the task is complete or human intervention is required.
The human changes from a step-by-step operator into a reviewer of the outcome. The key shift is that the model now controls the complete action loop.
2. Why Autonomous Execution Is Practical Now
The idea of autonomous coding agents is not new. Several teams explored it years ago, but the results were often disappointing. The difference today comes mainly from two areas.
1. A Significant Improvement in Model Capability
Earlier models were more likely to lose track of the goal during multi-step reasoning. Once an early step went wrong, later steps often continued in the wrong direction, causing errors to accumulate.
In recent years, models have improved in several important ways:
- They are better at maintaining the task objective across long contexts.
- They are more accurate at interpreting tool output and determining whether an operation succeeded or failed.
- They have a deeper understanding of code structure and common error patterns.
- They are more consistent at following format constraints and producing parameters according to specification.
2. A Shift in Engineering Approach
Earlier systems often tried to reason through every step on the model’s behalf and encode the entire process in application logic. Once the model moved outside the predefined path, the system could not respond effectively.
When model capabilities become strong enough, rigidly constraining the model can limit its performance. The engineering focus therefore shifts from “specifying how the model must work” to “providing the right tools and allowing the model to decide how to use them.”
3. Subtractive Architecture: A Single Main Loop
The core architecture can be summarized with a simple loop:
while the model output contains a tool call:execute the corresponding toolappend the execution result to the conversation historyrequest the model againwhen the model output contains no tool call:return the current result to the user and wait for the next instruction
This loop has three important characteristics.
First, the model controls the decisions. The model decides whether to call a tool, which tool to call, and which parameters to use. The system does not prescribe a fixed sequence of steps.
Second, result feedback completes the loop. Every tool result is added to the context, allowing the model to decide what to do next. Reading a file, running tests, and inspecting an error are all the same type of operation; only the tools differ.
Third, the termination condition is simple and explicit. When the model no longer requests a tool, it is considered to have completed the current stage, and control returns to the user. The system does not need to solve the more complex question of whether the entire task is finished.
Why a Simpler Structure Can Be More Reliable
Complex flowcharts, directed acyclic graph workflows, hundreds of classification prompts, and explicit state machines may appear controllable. In practice, they introduce three major costs:
- High maintenance overhead. Every new situation requires another branch, and branches can affect one another.
- Poor compatibility with model upgrades. As model capabilities change, predefined classifications and states may no longer match actual requirements.
- Difficult debugging. Errors can occur at the boundary between any two branches, making their source difficult to identify.
A single loop concentrates decision-making in the model. The system only needs to execute tools reliably and pass their results back. As a result, system behavior becomes easier to observe and reason about.
4. Practical Principles for Tool Design
The effectiveness of the loop depends heavily on tool quality. The following principles are especially important.
1. Keep Responsibilities Narrow and Descriptions Clear
Each tool should do one thing, such as reading a file, searching code, executing a command, or writing a file.
The tool description should explain its purpose, parameter meanings, and return values. The model relies on this information to decide when and how to call the tool.
2. Return Readable Results with Clear Boundaries
Command output can be extremely long. Injecting tens of thousands of log lines into the context wastes space and can bury the important information.
A better approach is to truncate oversized output, preserve the beginning and end, and indicate where truncation occurred. When necessary, the system should allow the model to request additional output.
3. Structure Error Information
Errors should include the reason for failure, the relevant location, and possible directions for remediation. Clear error messages allow the model to correct its own work and reduce the need for human intervention.
4. Apply Different Permission Levels to Read and Write Operations
Read-only operations are generally low risk and can be executed automatically. Writing files, deleting data, and modifying configuration are higher-risk operations and should require confirmation or be restricted to a defined scope.
An example tool registration might look like this:
tool: read_filedescription: Read the contents of a file at the specified path. Truncate and label output above the limit.parameters:path: File path (must be within the project directory)max_lines: Maximum number of lines to returnpermission: Read-only, automatic executiontool: run_commanddescription: Execute a command within the project directory and return its output.parameters:command: Command to executetimeout: Timeout in secondspermission: User confirmation required
5. Safeguards for Production Systems
A single loop is simple enough to implement, but a real system still needs boundary protections.
- Iteration limits. Set a maximum number of loop iterations to prevent the model from entering an ineffective retry cycle and consuming excessive resources.
- Permission controls. Distinguish between automatic execution and human confirmation based on the tool and operation type, following the principle of least privilege.
- Context management. As the conversation grows, summarize or compress earlier tool output while preserving key decisions and the current state.
- Observability. Record every tool call, its parameters, and its result so the process can be reviewed and debugged.
- Result validation. Have the agent run tests or inspection scripts and use objective results to determine whether a change is effective, rather than relying only on the model’s self-assessment.
These measures constrain the environment around the loop without changing the loop’s core structure. The central logic remains simple.
6. Design Lessons
The software industry often relies on concise design principles such as “complex is better than complicated” and “flat is better than nested.” These ideas also apply to coding agent design.
- A flat structure makes every step directly traceable.
- Moving complexity into the model can be more sustainable than enumerating every possible situation in application code.
- Constraints should be placed at the boundaries—such as permissions, budgets, and security controls—rather than in every individual decision.
7. Practical Implementation Advice
If you are building a similar coding agent, consider the following progression:
- Implement the smallest viable loop with only two tools: file reading and command execution. First verify that the feedback loop works end to end.
- Add clear descriptions and structured error messages for each tool, then observe the quality of the model’s tool calls.
- Introduce permission levels, iteration limits, and logging before gradually enabling write operations.
- Evaluate the system with a fixed set of test tasks. After every change to the tools or prompts, run regression comparisons.
- Add new structures or constraints only when you observe a specific problem. Avoid overengineering the system in advance.
The progress of coding agents comes from the combination of stronger models and simpler architecture. The fewer steps the system dictates, the more room the model has to apply its own judgment. The engineer’s primary responsibilities shift toward designing effective tools, defining safe boundaries, and using reliable feedback to verify results.
