Can AI Agents Self-Iterate? A Hands-On Test with Batch File Processing
This article tests whether AI agents can truly self-iterate by using a real batch file-processing task: downloading 176 face-recognition videos and renaming them to a strict "Name-IDNumber.Extension" format. It compares two technical approaches—code-generation execution and local small-parameter models—under the same acceptance criteria covering completeness, format fidelity, naming rules, and delivery directory cleanliness. The results show that code-generation agents can self-correct within defined acceptance standards, while local small models often fail on multi-step consistency. The article also breaks down what "self-iteration" really means, and provides a reusable engineering checklist for reliable agent delivery.
1. The Starting Point: Why “Self-Iteration” Deserves a Real Test
Batch file processing sounds like a beginner-level requirement, but in practice it is full of pitfalls. Imagine you have 237 user authentication records, 176 of which contain video URLs generated after liveness face recognition. Each video needs to be downloaded and renamed to “Name-IDNumber.Extension.” Doing this manually means hundreds of clicks and hundreds of checks—likely an entire afternoon with no guarantee of completion, and a high risk of missed items, altered extensions, or failed downloads that cannot resume.
This kind of task sits right at the center of an AI agent’s capability circle: the goal is clear, the steps are decomposable, and the results can be verified automatically. That is exactly why it makes a suitable touchstone for testing whether agents can genuinely self-iterate and evolve. Note that this article does not recommend or review any specific product. Instead, it abstracts the phenomenon into two general technical routes—code-generation execution and local small-parameter models—and compares them under the same task and the same acceptance criteria, focusing on the engineering factors that truly determine success or failure.
2. Task Card and Acceptance Criteria: Defining “Done” First
A rigorous comparison must fix the input and the acceptance standard first. The input for this task is a spreadsheet containing names, phone numbers, ID numbers, and face video URLs. The video container formats are mixed, and file extensions are inconsistent in case.
There are only three core requirements, but each one maps to a common failure point:
- Complete coverage: every record with a video URL must be downloaded successfully, with no omissions;
- Format fidelity: the case of the original extension must be preserved exactly, not “helpfully unified” by a script;
- Naming convention: the filename must strictly follow “Name-IDNumber.Extension.”
On top of these, I added one more engineering delivery standard: delivery directory cleanliness—the delivery directory should contain only finished files, with no leftover scripts, logs, or data copies. This standard is often overlooked, yet it directly determines whether downstream steps can proceed without manual intervention.
3. Hands-On Performance of the Two Technical Routes
3.1 Code-Generation Execution: Clean Delivery
The first route behaves as follows: it first analyzes the spreadsheet structure, then automatically writes and executes a download script, and finally checks the results. In testing, all 176 videos were downloaded successfully, the naming strictly followed the convention, and the mixed-case extensions were fully preserved—there was no “unify to lowercase” behavior that looks tidy but actually breaks fidelity.
More importantly, the directory state: the target directory contained only the 176 finished videos, with no scripts, logs, or temporary files. This means the delivery is ready as-is and can move directly to the next step. From an engineering perspective, this behavior usually implies a hidden capability—self-cleanup and result verification before the task ends, rather than merely “running the commands to completion.”
3.2 Also Code Execution, But Leaving a “Tail”
The second route also uses a code-execution strategy. The download count, naming, and format handling were all correct, but during the directory check, two extra files were found: the download script and a copy of the data source were left in the target directory. They do not affect the videos themselves, but they break delivery cleanliness. In a formal delivery scenario, this would require an extra round of manual cleanup—which itself shows that the “task loop” was not truly closed.
The difference between the two routes is not “whether it can do it,” but whether it understands the delivery boundary. This is also an important dividing line for judging agent maturity: a junior implementation ends at “the command executed successfully,” while a mature implementation ends at “all acceptance criteria are met.”
3.3 A Notable Phenomenon: Local Small Models Fail Overall
The test also produced a counterintuitive finding: small-parameter models running locally generally could not complete the same task. They showed incomplete script generation, missing exception handling, format fidelity failures, or mid-way interruptions. The reason is not mysterious: this kind of task requires long chains of tool calls, sensitivity to file-system and encoding details, and the ability to self-correct after failures—capabilities that depend heavily on the model’s reasoning and instruction-following level. Under resource constraints, local small models often can only complete single-step operations and struggle to maintain multi-step consistency.
4. Breaking Down “Self-Iteration”: What Does It Actually Mean
“Self-iteration and evolution” is often used loosely. In engineering terms, it should be distinguished into at least three layers:
- In-execution self-correction: after a script errors, it can read the error, locate the cause, and rewrite the approach, instead of repeating the same failure;
- Cross-task experience reuse: turning the directory conventions and naming rules from the last task into reusable constraints, and applying them automatically next time;
- Strategy-level optimization: automatically trading off cost, duration, and success rate—for example, prioritizing concurrency for large files, and automatically backing off and retrying when rate-limited.
In this test, the first route mainly demonstrated the first layer of capability. The latter two layers require external mechanisms, such as writing acceptance criteria into an executable checklist and solidifying historical conventions into templates. In other words, the current “evolution” is more self-correction under clear acceptance criteria than autonomous evolution free of constraints.
5. A Reusable Engineering Practice Checklist
To make agents reliably pass this kind of task, I recommend doing four things in the workflow:
- Write acceptance criteria before running the task: turn coverage count, naming regex, extension fidelity, and directory cleanliness into scripted checks;
- Enforce workspace isolation: write intermediate artifacts to a temporary directory, and let the delivery directory accept only finished files;
- Make failures resumable: record a completed-items list, and support checkpoint resume and idempotent retries;
- Make cost observable: track call counts and elapsed time, making it easier to trade off between success rate and cost.
The illustrative verification logic can be very concise:
import os, redef verify(dir_path, expected_count):files = [f for f in os.listdir(dir_path) if os.path.isfile(os.path.join(dir_path, f))]assert len(files) == expected_count, f"Count mismatch: {len(files)}"pattern = re.compile(r"^[\u4e00-\u9fa5]+-\d{17}[\dXx]\.(mp4|MOV)$")bad = [f for f in files if not pattern.match(f)]assert not bad, f"Naming or format anomaly: {bad[:3]}"return True
Combined with general cloud capabilities such as object storage, logging services, and monitoring alerts, you can chain download, verification, and alerting into a closed loop, avoiding the black-box state of “finished running but not knowing whether it is correct.”
6. Conclusion: Evolution Is Real, but So Are the Boundaries
Back to the original question: agents can indeed complete batch work that used to take hours of manual effort, under clear goals and acceptance criteria, and they show considerable self-correction ability. But they do not automatically acquire delivery awareness, convention awareness, or cost awareness—these still need to be explicitly designed into the workflow. For developers and enterprise users, the pragmatic approach is not to wait for “fully autonomous evolution,” but to fill in acceptance criteria, workspace isolation, and observability—this is the key to making agents reliably produce trustworthy results.
