AI Agents That Write Code and Operate Computers: A Technical Breakdown of Multi-Model Co-Evolution
This article examines how large language models move beyond fixed automation scripts to write code and autonomously operate a computer through pure GUI interaction. It breaks down the capability shift into three layers—deterministic actions, conditional execution, and self-verification—and explains how multiple models improve together through a unified task environment, shared failure samples, and reusable strategy patterns. A layered architecture for safely running these agents in the cloud is also outlined, covering sandboxing, UI perception, code generation, validation and rollback, and observability, along with common engineering pitfalls to avoid.
1. The Starting Point: The Default Assumption of UI Interaction Is Being Rewritten
In early desktop and web automation practice, the mainstream approach was to have a model output a fixed sequence of instructions in one shot—for example, “click a position, type text into an input field, then click the submit button.” This approach is known as batch action mode, and its defining characteristic is that the entire instruction sequence is determined at the moment it is generated, with no ability to adjust based on intermediate results during execution.
This mode is highly efficient in scenarios with stable workflows and fixed interface layouts. However, it fails frequently once it encounters unknown list lengths, field positions that shift with the data, or pop-ups that appear intermittently. A more realistic approach is for the model to first write a general-purpose function, validate it against a small set of samples provided by the official documentation, and then dynamically identify every qualifying row in the worksheet before completing all entries in a batch. This way of interacting that relies only on the graphical interface and does not read internal data structures is commonly referred to in the industry as pure GUI interaction.
This article centers on that technical topic, discussing how large models evolve from “executing fixed scripts” to “writing code and autonomously operating a computer,” and how multiple models working within the same task framework drive one another forward and improve collectively.
2. From Batch Actions to Dynamic Decision-Making: Three Levels of Capability
Level 1: Action Determinism
The strength of batch actions is that they are predictable and easy to replay; the weakness is the lack of fault tolerance. Once the actual interface at an intermediate step differs from expectations, all subsequent instructions become misaligned.
Level 2: Conditional Execution
Once conditional logic and loops are introduced, the model can read the interface state after each step and decide whether to continue, retry, or roll back. Illustrative pseudocode:
def solve_sheet(rows, is_target, solve):for row in rows:if not is_target(row):continuevalue = solve(read_cell(row))write_cell(row, value)
The significance of this code is that the model no longer “memorizes steps” but “writes logic,” delegating repetitive work to loops and judgment to functions.
Level 3: Self-Verification
Validating against a small set of samples before formal execution is a key engineering practice for improving success rates. Sample validation is equivalent to unit testing: it exposes logic flaws at low cost and avoids large numbers of irreversible, incorrect writes on real data.
3. Multi-Model Collaboration: How Collective Progress Happens
The phenomenon of “eight models improving collectively” can be broken down, from an engineering standpoint, into three mechanisms.
- Unified task environment: All models face the same interface, the same set of samples, and the same evaluation criteria, so capability differences are measured against a single standard.
- Shared failure samples: Pitfalls encountered by one model are converted into training signals or prompt constraints for other models, reducing repeated mistakes.
- Mutual borrowing of strategies: The practice of writing a general-purpose function first and then dynamically identifying targets gets distilled into a reusable problem-solving pattern, turning an occasional behavior of individual models into a default group strategy.
It is worth emphasizing that this kind of collaboration does not depend on any proprietary interface of a single product. Its essence is a general engineering practice of “unified evaluation environment + failure feedback loop + accumulated strategy library.”
4. Implementation Architecture: Letting Agents Operate Computers Safely
To reproduce similar capabilities in your own environment, a layered architecture is recommended:
- Execution sandbox layer: Use a container platform to host an isolated desktop environment, restricting the scope of file system and network access.
- UI perception layer: Combine screenshots with structured control information to locate interactive elements.
- Code generation layer: Have the large model produce executable scripts with parameter validation and exception handling.
- Validation and rollback layer: Validate on samples first, then roll out gradually, while retaining operation logs for traceability.
- Observability layer: Use logging services and monitoring alerts to track success rate, average step count, and the distribution of failure types.
On the data and model side, object storage can hold samples and snapshots, and a message queue can decouple task scheduling from execution, supporting stable operation of large-batch workloads.
5. Common Pitfalls and Engineering Recommendations
- Do not pursue “zero-validation execution”: The cost of sample validation is far lower than the cost of fixing incorrect writes.
- Do not hardcode interface coordinates: Prefer semantic location to reduce fragility caused by resolution and theme changes.
- Do not ignore idempotency design: Repeated execution should produce no side effects, making failure retries easier.
- Do not track only success rate: Step count, elapsed time, and rollback rate also reflect the quality of the approach.
6. Conclusion
The core competitiveness of a large model operating a computer lies not in how many operation sequences it has memorized, but in whether it can act like an engineer: first abstract a general logic, then validate it with samples, and finally adapt dynamically in a real environment. When the evaluation environment is unified, failure experience can flow back, and problem-solving patterns can be accumulated, the collective progress of multiple models is a natural outcome. For enterprises, putting this capability onto a cloud-based runtime foundation that is sandboxed, observable, and rollback-capable is the key step from demonstration to production.
