AI Agent Batch File Processing: Benchmark Results and Pitfalls to Avoid
This article reports a hands-on benchmark of AI agents performing a batch file processing task: downloading 176 face verification videos from a 237-row table and renaming them to a strict convention. It explains why script-first execution is currently the most reliable approach, compares two agent implementations on completion and delivery cleanliness, documents the failure modes of smaller local models, and offers a reusable acceptance checklist and prompt template for enforcing naming, extension, integrity, and idempotency requirements.
1. Why Batch Download and Rename Is a Litmus Test for Agents
There is a lot of discussion lately about whether the new generation of AI agents can truly “self-iterate and evolve,” and whether they are meaningfully smarter than the previous generation of tools. Answering that question with abstract arguments is pointless. It has to be grounded in a task that is verifiable, reproducible, and clearly bounded.
Batch file processing is exactly such a litmus test. On the surface it looks like repetitive labor, but it actually exercises four capabilities at once: structured data parsing, exception branch handling, fetching external resources, and normalizing deliverables. If any one of these is missing, the output looks finished but is not usable.
The task card for this benchmark was as follows:
- Input: a table of user verification records, 237 rows in total, with fields for name, phone number, ID number, and the face video URL generated after face verification.
- Valid samples: 176 of those rows contain a video URL, and all of them needed to be downloaded.
- Naming convention:
name-IDnumber.extension. - Format constraint: the source file extensions mix uppercase and lowercase (for example
.mp4and.MOV) and must be preserved exactly as-is. - Delivery constraint: the target directory may contain only the 176 video files. No scripts, logs, intermediate tables, or temporary files may remain.
One point deserves emphasis: the difficulty here is not the downloading, it is the normalized delivery. In engineering practice, most failures are not network problems. They are naming collisions, extensions silently lowercased, failed entries never retried, and a polluted output directory.
2. Two Execution Paths: Scripting Is the Most Reliable Option Today
Two categories of agents were tested, and both ultimately chose the same route: generate a script, execute the script, then self-check. That is not a coincidence. It is the most dependable engineering pattern at the current stage, for three reasons:
- Determinism. Batch tasks need to be repeatable, and a script is a naturally repeatable unit.
- Auditability. A script leaves a clear execution trail, which makes problems easy to locate.
- Repairability. When something breaks, editing a script costs far less than editing a natural-language instruction.
A minimal working skeleton looks like this (it only illustrates the approach and is not tied to any specific product API):
import csv, os, re, urllib.requestdef safe_name(name, id_no):# Strip path separators and illegal characters to prevent directory traversalname = re.sub(r'[\\/:*?"<>|\r\n]', '', name).strip()id_no = re.sub(r'\s', '', id_no)return f"{name}-{id_no}"def keep_ext(url, default='.mp4'):# Parse the original extension from the path and preserve its casem = re.search(r'(\.[A-Za-z0-9]{2,5})(?:\?|$)', url)return m.group(1) if m else defaultdef download(row, out_dir):url = row['video_url'].strip()if not url:return 'skip'ext = keep_ext(url)target = os.path.join(out_dir, safe_name(row['name'], row['id_no']) + ext)if os.path.exists(target) and os.path.getsize(target) > 0:return 'exists' # Idempotent: supports resuming an interrupted runtmp = target + '.part'urllib.request.urlretrieve(url, tmp)os.replace(tmp, target) # Atomic write, avoids leaving partial filesreturn 'ok'
Three easily overlooked but critical engineering details are embedded in this code: filename sanitization (blocking illegal characters and directory traversal), extension fidelity (never normalizing case on your own), and a temporary file plus atomic replace (so an interruption cannot leave a corrupted file). These three points set the ceiling on delivery quality.
3. Benchmark Comparison: Similar Completion, Different Delivery Cleanliness
Under the same model conditions, the two categories of agents produced nearly identical core metrics: all 176 videos downloaded successfully, naming and extension casing fully met the requirements, and time and cost were in the same range (single-digit RMB in both cases, with the exact figure varying by the platform’s billing policy).
The difference showed up in delivery cleanliness:
- One implementation left the script and a copy of the data source in the output directory, so the directory ended up with 178 files. Functionally fine, but it did not meet the “delivery is the finished product” standard.
- The other implementation wrote intermediate artifacts to a separate working directory, leaving only the 176 videos in the output directory, ready for the next stage.
The gap looks small, but it exposes a key dimension of agent evaluation: not “can it finish,” but “can it finish to spec without a human cleaning up afterward.”
4. The Overlooked Variable: Smaller Local Models Fall Short Systematically
One phenomenon worth recording: smaller local models performed poorly overall on this task, with failures concentrated in three patterns:
- Instruction decay. With three or more constraints, one constraint tends to get dropped, most often “preserve extension casing.”
- Long-loop derailment. After a few dozen rows, fields start getting misaligned, and phone numbers end up written into filenames.
- Silent failure. When a download fails, there is no retry and no report, so the run ends up “missing a few files but claiming completion.”
The conclusion is clear: batch file processing is a long-chain, constraint-heavy task that demands strong instruction following and long-context stability. Smaller local models are better suited to single-step, short-chain scenarios with human review.
5. A Rational Take on “Self-Iteration and Evolution”
Back to the original question. In an engineering context, so-called self-evolution should be broken into three distinct levels of capability:
- Runtime error correction: automatically retrying, switching paths, or adjusting parameters after a failure. This is controllable and is essentially an exception handling strategy.
- Cross-task experience accumulation: writing the current task’s scripts, validation rules, and failure cases into a reusable asset library, then calling them directly for the next similar task. This is engineered memory, which requires external storage and retrieval mechanisms rather than the model “growing up” on its own.
- Weight-level autonomous evolution: the model updating its own parameters without human intervention and improving reliably. This is not yet dependable or verifiable in production and should not be assumed in a solution design.
So the more pragmatic approach is to put “evolution” on the process side. Use object storage to keep historical scripts and validation checklists, use a logging service to record the failure distribution of each run, and use monitoring and alerting to set thresholds on success rate and cleanliness. The system then gets stronger as tasks accumulate, while every step remains auditable and rollback-able.
6. A Reusable Acceptance Checklist
It is better to hard-code delivery standards as automated checks than to rely on visual inspection:
- Count check: does the number of output files equal the number of valid records?
- Naming check: does every file match
^[^\\/:*?"<>|]+-\d{17,18}\.[A-Za-z0-9]+? - Extension check: compare each file against the extension parsed from its source URL; casing must match exactly.
- Integrity check: file size above a threshold, and decodable (spot-probe a sample).
- Cleanliness check: a whitelist of file types in the directory; the presence of a script, table, or log counts as a failure.
- Idempotency check: repeated runs produce no duplicate files and no incorrect overwrites.
A matching prompt template can significantly reduce instruction decay:
You are a batch file processing executor. Follow these rules strictly:1) Process only rows where video_url is non-empty;2) Output name = name-IDnumber + original extension (preserve casing exactly);3) Write all intermediate artifacts to ./work; only video files may exist in the output directory;4) Retry a failed item 3 times; if it still fails, record it in ./work/failed.csv and report it at the end;5) After completion, run the validation script and output pass/fail details; never claim an unfinished task is complete.
7. Conclusion
For constraint-heavy batch tasks like this one, the “completion rate” of different agents has converged. The real dividing line is delivery compliance and failure visibility. Whether an agent is worth adopting should be judged on three metrics: first-pass success rate, the cost of human fallback, and whether failures are surfaced explicitly.
As for self-iteration, the more reliable path today is “the model handles generation and execution, the engineering system handles memory and validation.” Turn experience into searchable assets and turn standards into automated checks, and system capability will grow steadily with task volume. That is more controllable than waiting for the model to evolve on its own, and far easier to replicate across a team.
