AI Agent Batch File Processing: Why Download and Naming Details Decide Success
A real CSV-to-video workflow with 176 downloads shows how AI agents succeed or fail on completeness, extension case, naming, and a clean output directory—plus why lightweight cloud models outperformed local small models.
Batch file work sounds simple and is full of traps. This article uses a real case: a CSV of more than 200 user records, 176 of which had video URLs. Each video had to be downloaded and archived as name-id.extension. Manual work would take an afternoon. This is the kind of job AI agents should handle well—and a practical test of engineering quality.
Why this task is a useful test
The job hits the failure modes that show up in agent-driven batch work.
The task card had three hard requirements:
- Download every record that has a video URL; miss none.
- Keep the original extension casing:
.mp4and.MOVmust stay as-is. - Name files strictly as
name-id.extension.
Anyone who has run batch jobs knows the first two fail often: missed items, scripts that force lowercase extensions, or a network stall with no retry. Acceptance is not “done or not,” but quality of the result.
Path 1: Script-generation automation
The first agent wrote a Python downloader. Logic was transparent and auditable. Results were strong:
- All 176 videos downloaded; none missing.
- Names followed the spec; extension case was preserved (no blanket lowercase).
- The output folder contained only the 176 videos—no leftover scripts, logs, or temp files—ready to hand off.
It used a lightweight cloud LLM at about 1 yuan. Completeness and a professional handoff were solid. Treating the directory as the deliverable is the difference between “it ran” and “it is usable.”
Path 2: Same downloads, leftover files
The second agent also executed code. All 176 videos downloaded; naming and suffixes were correct. The output directory still contained extras: the download script and a copy of the source CSV.
The videos were fine; the folder was not a clean deliverable. A production handoff would need an extra cleanup step. That is a difference in task-boundary awareness: one agent planned “the directory is the product”; the other only did the literal downloads.
For builders: state a clean output directory in the task card, or add a cleanup and check at the end of the pipeline. Example:
import shutil, pathlibdef clean_workspace(target_dir: pathlib.Path, keep_exts: {".mp4", ".MOV"}):for f in target_dir.iterdir():if f.suffix not in keep_exts:f.unlink() if f.is_file() else shutil.rmtree(f)
Local small models failed as a group
Under the same task card, several locally deployed small models failed: they could not plan multi-step downloads, or they dropped constraints and produced messy names.
Agent quality is not only the model. It also depends on following long instructions, multi-step planning, and reliable code generation. For detail-heavy batch work, a capable lightweight cloud model was more successful at modest cost. Local small models fit privacy-sensitive work that can be split into simple single steps.
Takeaways and practices
- Write the full task card: naming, extension case, and a clean directory must be explicit; do not expect the agent to infer them.
- Accept on details: count, names, formats, and folder purity all matter.
- Match the model to complexity: multi-step orchestration needs a stronger model; the cost gap is often small.
- Plan for failure: retries and resume-on-interrupt for network errors, so delivery is not half-finished.
Most batch “pits” are not in the code but in how delivery is defined. Put the standard first and automate checks, and the agent becomes a reliable productivity tool.
