Can AI Agents Self-Iterate and Evolve? Evidence from a Batch File Processing Test
This article examines whether AI agents can self-iterate by testing them on a realistic batch file processing task with three hard constraints: no missing files, no altered extensions, and no interruptions. It proposes a four-layer evaluation framework covering task parsing, execution strategy, output cleanliness, and cost stability; compares the observed behavior of two agent types and the consistent failure of small local models; and explains why self-iteration still depends on external feedback loops. Practical engineering recommendations are included to move agents from demo-ready to production-ready.
1. The Problem: “Able to Do It” Is Not “Able to Deliver”
Batch file processing looks like the lowest-barrier job imaginable: read a spreadsheet, download files according to rules, rename them to a specification. In real engineering, however, the failure rate of such tasks is far higher than expected. The reason is not whether the agent can do it, but whether the output is deliverable.
The original scenario: a spreadsheet of user authentication records, about 237 entries, 176 of which contain addresses of liveness detection videos. The video container formats were inconsistent, and file extensions mixed uppercase and lowercase. The requirement was to download all valid videos and rename them as “name-IDnumber.extension” while preserving the original case of each extension.
Three hard constraints—no omissions, no changed extensions, no interruptions—happen to cover the three points where batch jobs most often break. That makes this task a good measuring stick for an agent’s real level of engineering completeness.
2. Evaluation Dimensions: Look Beyond “Done / Not Done”
Assessing agents like human employees tends to focus only on results. A more rigorous approach breaks the evaluation into four layers:
- Task parsing: Does it correctly identify the criteria for a “valid record,” instead of processing all 237 entries indiscriminately?
- Execution strategy: Does it choose a programmable, reproducible path rather than “clicking” through entries one by one?
- Output cleanliness: Does the delivery directory contain only finished products, with no scripts, logs, or data copies left behind?
- Cost and stability: Is the per-task overhead controlled, and can it self-recover from exceptions?
The first two layers determine whether the job got done. The latter two determine whether it can enter a pipeline.
3. Observed Performance of Two Agent Types
Both chose the same correct path: generate and execute a script to handle the download and renaming. The underlying models and cost magnitudes were also close, both around 1 RMB. The difference appeared at the third layer.
The first type delivered cleanly: all 176 videos were in place, naming strictly followed the specification, the case of extensions was preserved exactly, and the directory contained no extra files—ready for the next stage immediately.
The second type produced equally correct results, but the directory retained two leftover files: the download script and a copy of the data source. Functionally harmless, but it added a cleanup step from an engineering standpoint. In scenarios such as formal delivery, audit trails, and downstream automated scanning, that step is a hidden cost.
The conclusion is not “which one is stronger,” but this: the gap between agents is shifting from “can it get it right” to “can it wrap up according to specification.”
4. A Counterintuitive Finding: Why Small Local Models Failed Collectively
On the same task, locally deployed small-parameter models failed almost across the board, and their failure modes were highly consistent: not miscalculation, but “not finishing.”
There are three root causes:
- Weak long-range instruction retention. The task chain includes reading the spreadsheet, filtering, concurrent downloading, verification, renaming, and cleanup. As the chain grows longer, constraints get dropped—most typically the “preserve case” requirement.
- Insufficient stability in tool calling and code execution. Batch tasks depend on a stable execution environment; even a slight deviation on the model side can cause an interruption or leave a half-finished product.
- Absence of self-verification. There are no closed-loop checks such as “does the download count equal the expected count” or “does the directory contain only target files.”
The illustrative self-check logic can be very simple:
expected = 176files = [f for f in os.listdir(out_dir) if f.lower().endswith(('.mp4', '.mov'))]assert len(files) == expected, f"Count mismatch: {len(files)}"assert all(is_temp(f) is False for f in os.listdir(out_dir)), "Intermediate artifacts found"
The value of these assertions lies not in the code itself, but in the fact that they turn “done” into a verifiable proposition.
5. Back to the Title: How Far from Self-Iteration
Judging “self-iteration and evolution” requires three signals: after a failure, can it locate the root cause; can it consolidate the fix into a reusable rule; and can it stop repeating the same mistake on similar tasks.
In the tests above, both agent types remained at the “single-task execution” level: they could finish the job, but they would not proactively write “clean up intermediate artifacts” into their own working specification. True self-iteration requires an external feedback loop—execution result verification, failure sample archiving, rule base updates, and automatic application in the next round. This mechanism currently relies more on engineering effort than on spontaneous emergence from the model.
6. Engineering Implementation Recommendations
- Write acceptance criteria into the task description up front: state explicitly that only target files may appear in the directory.
- Enforce a self-check step: four assertions covering count, naming, extension case, and leftover files.
- Isolate intermediate artifacts: write scripts and data copies to a separate working directory; keep only finished products in the delivery directory.
- Make cost observable: record per-task call volume and elapsed time to enable side-by-side comparison.
- Make failures replayable: retain input snapshots and execution logs to provide a basis for consolidating rules.
7. Conclusion
Batch file processing is a mirror that reflects the real distance an agent must cover to go from “usable in a demo” to “usable in production.” Whoever first makes acceptance criteria, the self-check loop, and output specifications solid will first possess engineering value. As for self-iteration, that is a capability that naturally grows once the loop runs through—not a slogan.
