Can AI Agents Really Self-Iterate? Lessons from a Batch File Processing Test

    This article examines whether AI agents can truly self-iterate by comparing two mainstream agent approaches on a real batch task: downloading and renaming 237 user verification records into 176 video files. It breaks down where each approach succeeds or fails across planning, execution reliability, delivery cleanliness, and self-correction, and explains why locally deployed models struggle with tool calls and long context. It also provides a reference Python skeleton and practical enterprise adoption recommendations.

    Can AI Agents Really Self-Iterate? Lessons from a Batch File Processing Test

    1. The Question: From “Chatting” to “Delivering”

    Over the past two years, AI agents have attracted enormous expectations. One of the most appealing claims is “self-iteration and evolution”—the idea that an agent can autonomously discover problems, adjust its strategy, optimize its output, and keep getting better without human intervention. It sounds great, but how far does it actually hold up? Is it marketing language, or a capability that can be verified through engineering?

    Answering this in the abstract is pointless. It has to be grounded in a concrete, reproducible task with objective acceptance criteria. Batch file processing is exactly such a litmus test: the rules are clear, the results are countable, and errors are visible. It tests both an agent’s planning ability and the rigor of its execution and delivery.

    This article uses a single unified task—“process a user verification spreadsheet, then batch download and rename video files with a standard naming scheme”—to observe two mainstream agent technical approaches side by side, and to abstract a methodology for evaluating an agent’s real capabilities.

    2. Task Definition: Simple on the Surface, Full of Pitfalls

    2.1 Background

    Suppose there is a CSV file of user verification data with fields for name, phone number, ID number, and a video URL generated during the face recognition step. The dataset contains 237 records, of which 176 have valid video links. The video formats are inconsistent, with both .mp4 and .MOV in mixed case.

    2.2 Hard Requirements

    1. Process only records with a valid video URL; skip the rest.
    2. Download all videos, with none missing.
    3. Preserve the original case of each extension; do not normalize it.
    4. Rename uniformly to name-IDnumber.extension.

    2.3 Why This Task Is Not Simple

    Anyone who has done data engineering knows the difficulty of batch tasks never lies in the “main flow” but in the boundary conditions:

    • Missed processing: Some records have empty or malformed fields and can be silently skipped.
    • Extension pollution: A single lower() or upper() call in a script can destroy the original case.
    • Naming conflicts: Edge cases with identical names and ID numbers, special characters, and whitespace handling.
    • Interrupted recovery: If a download fails halfway due to network jitter, can it resume and retry?
    • Directory cleanliness: Do intermediate artifacts (scripts, logs, data copies) pollute the delivery directory?

    In other words, what this task really tests is not “whether it can run” but “whether the deliverable is professional once it runs.”

    3. Observed Results from Two Technical Approaches

    3.1 Approach A: Script Generation + Automatic Execution

    The first type of agent, after receiving the task, independently wrote a Python download script and then invoked an execution environment to complete the batch download. The final result: all 176 videos downloaded successfully, with naming strictly following the name-IDnumber convention and the case of .MOV and .mp4 fully preserved. More importantly, the download directory contained only the 176 video files, with no leftover scripts, logs, or data copies—the delivery directory was the finished product.

    The engineering discipline this approach demonstrates is: separating “deliverables” from “process artifacts.” The script was generated and run in a temporary workspace, the outputs landed in the target directory, and everything was cleaned up when the task ended. The user receives a directory that can move straight into the next stage.

    3.2 Approach B: Also Runs, but Leaves “Tails”

    The second type of agent also took the code execution route. All 176 videos were again downloaded successfully, with correct naming and extension handling. But on inspecting the target directory, two extra files were found: the download script itself and a copy of the source data.

    This does not affect the correctness of the video files, but it exposes a gap in delivery awareness: process artifacts were neither isolated nor cleaned up. In a formal delivery scenario, this means an extra manual cleanup step is still required, so the automation chain is not truly closed-loop.

    3.3 A Notable Phenomenon: Local Models Collectively Stalled

    Under the same task, the locally deployed models tested generally failed to complete end-to-end delivery. The main sticking points clustered in three areas: first, insufficient stability in multi-step tool calls, easily losing context midway; second, error-prone parsing and record-by-record processing of long file lists; third, difficulty in autonomously completing exception retry and resume-from-breakpoint logic. This shows that current “agent capability” is tightly bound to the underlying model’s tool-calling and long-context retention abilities, and small locally deployed models still show a clear gap here.

    4. After Abstraction: What Does Agent “Self-Iteration” Actually Iterate?

    Abstracting the above observations, so-called “self-iteration and evolution” can, in engineering terms, be broken into four verifiable dimensions:

    1. Task planning ability: Can it break a vague requirement into executable steps and identify boundary conditions?
    2. Execution reliability: Can it converge stably to the correct result under exceptions, retries, and resume scenarios?
    3. Delivery compliance: Are the artifacts clean, is the naming compliant, and can it move directly downstream?
    4. Self-correction ability: After finding an error, can it locate and fix it autonomously rather than repeating the same mistake?

    Approach A performs completely across all four dimensions, Approach B loses points on “delivery compliance,” and local models fall behind overall on “execution reliability.” So-called “evolution” currently manifests more as less manual backstopping on the same task, rather than rewriting its own goals free from human-defined acceptance criteria.

    5. Illustrative Implementation: A Clean Batch Processing Skeleton

    The code below is illustrative, showing the basic pattern of “separating process artifacts from deliverables + preserving extension case + resume from breakpoint”:

    1. import csv, os, pathlib, requests
    2. SRC = "user_verifi_videos.csv"
    3. OUT = pathlib.Path("/data/deliver/videos")
    4. TMP = pathlib.Path("/tmp/agent_work") # Isolated area for process artifacts
    5. OUT.mkdir(parents=True, exist_ok=True)
    6. def safe_name(row):
    7. return f"{row['姓名'].strip()}-{row['身份证号'].strip()}"
    8. with open(SRC, newline="", encoding="utf-8") as f:
    9. for row in csv.DictReader(f):
    10. url = (row.get("人脸视频地址") or "").strip()
    11. if not url:
    12. continue
    13. ext = os.path.splitext(url.split("?")[0])[1] # Preserve original case
    14. dst = OUT / f"{safe_name(row)}{ext}"
    15. if dst.exists(): # Resume: skip if already exists
    16. continue
    17. with requests.get(url, stream=True, timeout=30) as r:
    18. r.raise_for_status()
    19. with open(TMP / dst.name, "wb") as w:
    20. for chunk in r.iter_content(1 << 20):
    21. w.write(chunk)
    22. (TMP / dst.name).replace(dst) # Atomic landing, avoid partial files

    The code has three key points: the TMP directory isolates process artifacts, ext does not normalize case, and dst.exists() provides idempotency and resume. In real engineering, concurrency control, a failure retry queue, and log service reporting should also be added.

    6. Recommendations for Enterprise Adoption

    1. Accept against delivery standards, not “it ran”: Include directory cleanliness, naming compliance, and failure rate in the acceptance checklist.
    2. Enforce process artifact isolation: Require the agent to complete scripts and intermediate files in a temporary workspace, and write artifacts atomically to the target location.
    3. Layer model selection: For complex tool calls and long-list processing, prefer more capable cloud models; local models suit subtasks with clear boundaries and fixed steps.
    4. Complete observability: Integrate log services and monitoring alerts, and continuously track download failure rate, retry counts, and artifact counts.
    5. Keep manual spot checks: Sample-check key fields (such as ID numbers and extension case) to prevent silent errors from flowing downstream.

    7. Conclusion

    Back to the original question: can AI agents really self-iterate and evolve? The answer is—yes, in the sense of “reducing manual backstopping”; not yet, in the sense of “autonomously defining and rewriting goals.” In this test, both approaches completed the main task, with differences concentrated in delivery compliance and process isolation, while local models were overall limited by tool-calling and long-context abilities. For enterprises, the rational approach is not to chase the concept of “self-evolution” but to engineer the acceptance criteria, isolate process artifacts, and complete observability, so that agents keep approaching “deliverable” within clear guardrails.