AI Agent Batch File Processing: Evaluating Delivery Quality and Self-Improvement

    Batch file processing provides a practical test of AI agents: success requires more than downloading files. Using a task involving 176 identity-verification videos, this article compares two code-based execution approaches, examines completeness, naming accuracy, output cleanliness, and recoverability, and outlines an auditable workflow. It also distinguishes automatic retries and feedback-driven fixes from persistent, controlled agent improvement.

    1. Why Batch File Processing Is a Useful Test for AI Agents

    Many business tasks are not technically difficult, but they are tedious: extract valid links from a spreadsheet containing hundreds of records, download each video, rename it as name-ID_number.extension, and preserve the original capitalization of the file extension.

    In one representative task, a source table contained 237 identity-verification records, of which 176 included links to facial verification videos. The videos used both .mp4 and .MOV extensions, with inconsistent capitalization. Processing 176 files manually could take half a day and introduce errors such as missed downloads, duplicate filenames, extensions incorrectly converted to lowercase, or temporary files left in the delivery directory.

    This is a typical use case for an AI agent: read structured data, invoke tools, execute scripts, validate results, and produce a directory ready for delivery. But a workflow that runs successfully is not necessarily ready for handoff—and it does not demonstrate that the agent can improve itself over time.

    Rather than reproduce a specific product workflow, this article examines two common implementation approaches:

    • Script-orchestration agents, which tend to generate and execute a complete script while isolating or cleaning up intermediate artifacts.
    • Code-execution agents, which also complete tasks through code but may leave scripts, source-data copies, or other intermediate files in the output directory.

    Comparing these approaches on the same task helps identify the boundaries between task completion, delivery quality, and self-improvement.

    2. Task Definition and Evaluation Criteria

    The task can be summarized as follows:

    • Input: A CSV file containing fields such as name, phone number, identity document number, and facial verification video URL.
    • Filtering: Process only records that contain a video URL.
    • Downloading: Download all valid videos to the target directory.
    • Naming: Use the format name-ID_number.extension.
    • Extension preservation: Retain the original extension capitalization; for example, .MOV must not become .mov.
    • Delivery: The target directory must contain only finished videos, without scripts, logs, or copies of the source data.

    Evaluation should go beyond the number of successful downloads. At minimum, it should cover four dimensions:

    1. Task completeness: Were all eligible records processed? Are there missing downloads, duplicates, or zero-byte files?
    2. Naming accuracy: Do names, identity document numbers, and extensions match the required format exactly? Is extension capitalization preserved?
    3. Output cleanliness: Does the delivery directory contain only finished files? Are intermediate artifacts isolated or removed?
    4. Recoverability and auditability: Are failures listed? Can the task be rerun? Are logs traceable, and are costs manageable?

    Under these criteria, “all 176 videos downloaded successfully” indicates good task completeness. It does not, by itself, establish self-improvement capability.

    3. Observations from Two Implementation Approaches

    In this controlled experiment, both generic agent approaches generated and executed code. The reported model-call cost per task was approximately CNY 1.

    Approach A: Script-Orchestration Agent

    The agent first parsed the table structure and confirmed the number of eligible records. It then generated a download-and-renaming script, kept intermediate scripts and logs in a working directory, and wrote 176 videos to the delivery directory.

    Inspection found that:

    • All 176 files were present.
    • Filenames followed the name-ID_number rule.
    • The capitalization of .MOV and .mp4 was preserved exactly.
    • The delivery directory contained only videos, with no scripts, logs, or source-table copies.

    For this task, the approach came closer to a production handoff standard in both completeness and output cleanliness.

    Approach B: Code-Execution Agent

    This agent also used code to download and rename the videos. All 176 downloads succeeded, and both filenames and extensions were correct.

    However, inspection found that the download script and a copy of the source data remained in the target directory. These files did not affect the videos themselves, but they violated the delivery requirement. An additional cleanup step would be necessary before a formal handoff.

    The result illustrates the difference between completing a task and completing it according to delivery specifications.

    Limits Observed with a Smaller Local Model

    In this test, a local model with a small parameter count did not consistently complete the long, multistep workflow. The issue was generally not an inability to write an individual step. Instead, deviations could accumulate across tool-call reliability, error recovery, context retention, and filesystem validation.

    Batch workflows are particularly vulnerable to cases where nearly every step succeeds but one item is missed at the end. Agent evaluation therefore needs to examine recovery and verification, not just a successful demonstration.

    4. Engineering a Workflow That Is Ready for Delivery

    Regardless of the agent approach, batch file processing should separate the workspace from the delivery directory. The following pseudocode illustrates an auditable workflow:

    1. def process(csv_path, work_dir, out_dir):
    2. records = load_csv(csv_path)
    3. todo = [r for r in records if r.face_video_url]
    4. failed = []
    5. for r in todo:
    6. ext = get_ext_keep_case(r.face_video_url) # Preserve original .MOV/.mp4 capitalization
    7. filename = r.name + "-" + r.id_card + ext
    8. target = out_dir / filename
    9. if target.exists() and size(target) > 0:
    10. continue # Idempotency: avoid downloading again on reruns
    11. ok = download_with_retry(r.face_video_url, target, retries=3)
    12. if not ok:
    13. failed.append(r)
    14. assert count_valid_files(out_dir) == len(todo) - len(failed)
    15. write_failure_list(work_dir / "failed.csv", failed)
    16. verify_names_and_extensions(out_dir)

    Key engineering practices include:

    • Isolate intermediate artifacts. Store scripts, logs, failure lists, and source-data copies in the working directory. Write only finished files to the delivery directory.
    • Support idempotency and resumable execution. Skip existing files that pass size checks and record failures separately to avoid unnecessary repeat downloads.
    • Preserve extensions exactly. Do not normalize extensions to lowercase. Extract and retain the original suffix when constructing filenames.
    • Validate the results. Check file counts, filename patterns, extension capitalization, and file sizes, and sample files to verify that they can be decoded.
    • Address privacy and compliance. When filenames contain identity document numbers or other sensitive information, assess masking, access controls, encrypted storage, and least-privilege permissions.
    • Make execution observable. Record the download status, retry count, elapsed time, and failure reason for each record to support audits and post-task analysis.

    For cloud deployment, general service categories such as object storage, logging, function compute, and key management can help create an observable execution environment with rollback support and controlled permissions. Baidu AI Cloud is one platform mentioned in this context; applicable services and regional availability should be checked in the official documentation.

    The essential principle is not reliance on a particular tool. It is breaking the task into verifiable steps and allowing the agent to operate within controlled boundaries.

    5. Self-Improvement: Automatic Retries Are Not Autonomous Evolution

    Claims about agent self-improvement need to distinguish several levels:

    • L0 — Automatic retries: Retrying failures, adjusting timeouts, or changing concurrency. These are forms of runtime fault tolerance.
    • L1 — Feedback-driven correction: Modifying a script in response to an error—for example, fixing naming logic after discovering that extensions were converted to lowercase.
    • L2 — Persistent strategy updates: Saving lessons to long-term memory or a rule base so that future tasks of the same type default to separating the workspace from the delivery directory.
    • L3 — Controlled evolution: Continuously improving strategies and tool use within an evaluation framework that includes version control, rollback mechanisms, and safety boundaries.

    This experiment shows that agents can download files, apply naming rules, and perform some validation when given a clear task. Some approaches can also keep the delivery directory clean.

    Those capabilities are closer to L0–L1 feedback loops than to autonomous evolution. Genuine self-improvement requires, at minimum:

    • Stable evaluation benchmarks.
    • Versioned changes that can be rolled back.
    • Persistent memory.
    • Failure analysis.
    • Permission and safety constraints.
    • Human spot checks.

    Without these mechanisms, an agent may simply get the current task right after a correction, only to encounter the same problems when the table structure changes or an unusual link appears.

    6. Conclusion: Evaluate Agents by Delivery Standards, Not Demonstrations

    Batch file processing is a useful agent benchmark because its goals are clear, its outputs are verifiable, and its failure modes are concrete.

    The experiment supports three main conclusions:

    1. Downloading all 176 videos and naming them correctly is a baseline capability.
    2. Clean delivery directories, recoverable failures, and auditable execution distinguish task completion from engineering readiness.
    3. Automatic retries and error correction are valuable, but they remain distinct from persistent self-improvement.

    A practical evaluation checklist should cover completeness, naming accuracy, output cleanliness, idempotency, cost, security, and compliance. Use repeatable tasks to assess these criteria over time rather than relying on a single demonstration.

    Only within a verifiable, observable engineering feedback loop—with rollback available—can agent improvement become a measurable capability rather than a slogan.