Can AI Agents Self-Evolve? Engineering Validation Through a Batch File Task
This article examines whether AI agents can genuinely self-improve by using a batch file-download task as an engineering validation case. It separates automated execution, in-task correction, cross-task experience reuse, and continuous improvement; defines acceptance criteria for completeness, correctness, and delivery; and discusses input parsing, extension preservation, stateful downloads, directory hygiene, privacy and security controls, and a three-stage evaluation method for measuring real improvement.
1. Completing a Task Does Not Mean the Agent Can Self-Evolve
An agent can generate scripts from natural-language requests, call an execution environment, and deliver organized files. That demonstrates a certain level of task planning and tool use. But inferring from this that the agent can “self-iterate and evolve” crosses an important evidentiary boundary.
Four levels need to be distinguished:
The first level is automated execution. The system converts human requirements into executable steps and reduces repetitive operations.
The second level is in-task error correction. When the system finds problems such as failed downloads or noncompliant naming, it modifies the execution plan and tries again.
The third level is cross-task experience reuse. The system retains validated processing rules and applies them in later similar tasks instead of rediscovering them each time.
The fourth level is continuous improvement. Under explicit evaluation criteria, the system can propose improvements, confirm benefits through testing, and roll back when regressions occur.
These four levels cannot be conflated. Automatically generating a download script does not mean the system has modified its underlying model. Saving an operational experience does not guarantee that it will be used correctly in the future. The key question is not how the agent describes itself, but whether it can steadily reduce errors, lower human intervention, and maintain safety boundaries in subsequent tasks.
2. Turning a Batch Download Request into an Acceptance-Tested Task Contract
Consider a typical business scenario: the input file contains 237 user records, of which 176 contain face-recognition video URLs. Each video must be downloaded and organized as “name-ID number.ext”.
On the surface, this is a download task. From an engineering perspective, it contains at least three independent requirements:
- Completeness: all eligible videos are processed.
- Correctness: files correspond one-to-one with source records, and naming and extensions follow the rules.
- Deliverability: the target directory contains only final videos, with no scripts, data copies, or temporary files.
These three types of requirements must be validated separately. A download program exiting normally only shows that the execution process ended. The appearance of 176 files in a directory does not by itself prove success, because there may be duplicate downloads, incorrect names, or error response pages disguised as videos.
Therefore, an explicit task contract should be formed before execution:
| Acceptance item | Judgment method |
|---|---|
| Input record count | Parse and count; confirm whether it is 237 |
| Valid video record count | Filter by the agreed rule; 176 in the example |
| Download coverage | Every valid record has an explicit result |
| Naming accuracy | Name and ID number correspond to the source record |
| Extension consistency | Preserve original case from the confirmed source |
| File validity | Exclude empty files and obvious error responses |
| Directory purity | The delivery directory contains only final outputs |
The numbers 237 and 176 are scenario inputs and should not be hard-coded into program logic. During actual execution, they still need to be recalculated and compared with expectations. When counts do not match, the system should explain the difference rather than skipping checks in order to reach the target count.
3. The First Hurdle Is Input Data Understanding, Not Downloading
3.1 Treat ID numbers as text
An ID number is an identifier, not a numeric value used in calculations. If it is automatically converted to a number when reading a spreadsheet, display formats may change, precision problems may occur, or characters may be lost.
Therefore, names, ID numbers, and video URLs should be read as text. Missing fields, abnormal whitespace, and invisible characters need to be detected first and then handled according to explicit rules. In particular, the system must not fill in ID numbers on its own or guess missing names.
3.2 Clearly define “has a video URL”
Empty cells, whitespace-only fields, placeholder text, and genuinely accessible addresses should not be treated as the same category.
A recommended classification is:
- The address is empty, so the record does not enter the download queue.
- The address structure meets requirements, so the record enters the pending-download queue.
- The address is abnormal, so the record enters a manual-confirmation or exception-handling queue.
A structurally correct address does not mean the download will necessarily succeed. Links may be expired, require authorization, or return something that is not a video file. These issues should continue to be validated during the access stage.
3.3 Detect duplicates and naming conflicts early
Two records may point to the same video, or may have the same name and ID number. If they are written directly to the same path, the file downloaded later may overwrite the earlier one.
The correct approach is to generate the target filename first and then check for conflicts. After a conflict is found, business rules should determine whether to deduplicate, keep multiple versions, or pause for confirmation. Arbitrarily adding numbers just to keep the program running may violate the established naming specification.
4. Preserving Extension Case Is a Separate Rule
The scenario requires preserving the case of extensions such as “.mp4” and “.MOV”. Implementation cannot simply lowercase all suffixes, nor can it directly take the content after the last dot in the URL.
For example, a video URL may include query parameters:
/records/sample.MOV?token=...
Here, the extension comes from “.MOV” in the path, and the query parameter is not part of the filename. The implementation logic should first split the URL structure, then extract the suffix from the path, and preserve the original character form.
When the path has no suffix, the download response provides a filename, or the input data has another original filename field, the source priority must be specified in advance. If the extension cannot be determined reliably, the system should log an exception and request confirmation rather than guessing a suffix.
Also note that a correct extension does not mean the content is correct. When access fails, the server may return an error message, yet the program may save it as a video file. Basic checks should include at least the response status, file size, and available media type information. For higher-assurance workflows, the system should also verify that the file can be parsed normally.
5. Reliable Downloads Need State Management, Not a Simple Loop
5.1 Use streaming writes to control resource usage
Video files may be large. Reading the entire response into memory at once increases resource pressure. A more robust approach is to read and write in chunks while recording the number of bytes actually received.
The execution environment should also check available disk space in advance. When disk space is insufficient, the system should stop starting new downloads and preserve confirmed outputs, avoiding the creation of large numbers of incomplete files.
5.2 Separate temporary files from final files
Files being downloaded cannot be treated directly as deliverables. They can first be written to a separate working directory, validated after completion, and then published to the target directory through appropriate file operations.
An illustrative flow is:
Read records→ Check fields and naming conflicts→ Generate download plan→ Write temporary files in the work area→ Validate download results→ Publish to the delivery directory→ Update task status
If atomic rename is used, confirm that the file systems containing the source path and target path support the required semantics. Cross-filesystem moves usually cannot directly provide the same atomicity guarantee.
5.3 Distinguish retryable and non-retryable errors
Network timeouts, connection interruptions, or temporary service anomalies are usually suitable for limited retries. Authorization failures, expired links, or missing data may require human intervention.
Retry counts, wait strategies, and overall timeouts should all have upper limits. Unlimited retries not only waste time but may also place unnecessary access pressure on the source service. Concurrent downloads should also be set according to authorization scope, network conditions, and resource limits. Higher concurrency should not be misunderstood as stronger capability.
5.4 Build a recoverable task ledger
Each record should have an explicit status, such as pending, running, success, retryable failure, and manual confirmation required.
When re-executing, the system must not skip a record solely because “the file already exists.” An existing file may be a fragment left by a previous interruption. The system should combine status records, file size, and necessary integrity checks to decide whether to reuse it.
In this way, even if the agent is interrupted halfway through execution, it can resume work instead of downloading all files from the beginning.
6. Delivery Directory Purity Reflects Boundary Awareness
In the original scenario, video downloading, naming, and extension handling can all be completed. But whether scripts and data copies are left behind affects final delivery quality. This is not merely a matter of neatness.
Source data copies may expand the scope of personal information exposure. Temporary files may be mistaken for formal outputs. Execution scripts may also create misuse risks for subsequent staff.
A more reasonable directory design is:
task space/├─ input area: controlled original data├─ work area: scripts, status, and temporary files├─ audit area: desensitized execution records└─ delivery area: videos that have passed acceptance checks
This structure separates execution assets, audit assets, and delivery assets. Logs should not all be deleted just because “the directory must be clean”; they should be stored in an appropriate location. Original data should not be casually copied into the delivery directory.
Automated cleanup must be limited to an explicit task work area. Allowlists and preview mechanisms should be preferred to avoid broad deletion rules damaging user files.
7. When Face Videos and ID Numbers Are Involved, Security Is a Precondition
Face videos and ID numbers are highly sensitive. Before the agent executes the task, it should confirm that data processing has legal authorization and should limit access scope, retention time, and propagation paths.
In particular, evaluate whether using “name-ID number” as a filename is truly necessary. Filenames may enter logs, backup indexes, synchronization records, or screenshots, creating additional leakage risk. If business rules allow, an internal record ID can be used for naming, with the mapping stored in a separate controlled location. If full identity information must be used, access control and transport protection for the delivery directory should be strengthened.
Download URLs themselves may carry access credentials. Logs should avoid recording complete query parameters, and the system should certainly not indiscriminately submit complete datasets and valid access credentials to a model.
When accessing external addresses, target restrictions should also be set to prevent anomalous input from directing the execution environment to internal resources that should not be accessed. When encountering login verification, authorization failure, or access restrictions, the system should stop or request human handling rather than attempting to bypass protection mechanisms.
8. How to Verify That an Agent Is Really Improving Continuously
A batch download task can serve as a capability evaluation sample, but “single success” and “continuous improvement” must be measured separately.
Three experimental stages are recommended.
Stage 1: First execution
Provide the full requirements and record whether the task is completed, the number of human interventions, failure reasons, and delivery quality. Do not observe only the file count. Also verify mapping relationships, content validity, and directory boundaries.
Stage 2: Controlled exception handling
Add anomaly samples that do not contain real sensitive information, such as mixed-case extensions, duplicate records, invalid URLs, interrupted downloads, and filename conflicts.
Observe whether the system can detect the problems, take repair measures that comply with constraints, and avoid damaging completed results. This stage primarily validates in-task error correction capability.
Stage 3: Experience transfer and regression validation
After receiving explicit feedback, let the system summarize validated rules, such as “the delivery directory must not contain source data copies” and “extensions must not be uniformly lowercased.”
Then test with a new dataset rather than rerunning the old task unchanged. Only when these rules are correctly invoked in new tasks and no new errors are introduced can experience reuse be shown to produce actual benefits.
Evaluation metrics can include success coverage, naming error rate, number of unrelated files, human intervention count, recovery time, and number of policy violations. Costs should also combine model calls, execution resources, storage, and human review; looking only at the cost of a single call is insufficient.
If tests involve different runtime environments or models, permissions, context, resources, and tool configurations should also be controlled. Without complete experimental records, a single failure cannot be generalized to mean that a class of models universally lacks a capability.
9. Conclusion: The Value of Self-Iteration Is a Verifiable Engineering Loop
The value of an agent is not just replacing manual clicks to download files. More importantly, it organizes requirement understanding, execution, validation, recovery, and delivery into a reliable process.
For this type of task, a mature system should be able to answer five questions: which records need processing, whether results correspond to the source data, whether exceptions can be recovered safely, whether delivery meets boundaries, and whether experience can continue to take effect in new tasks.
Only when these steps are completed is “self-iteration” more than regenerating a script after an error. It becomes continuous improvement constrained by testing, permissions, audit, and rollback mechanisms. The final measure should not be whether the system claims to have become smarter, but whether it can steadily provide more complete, more accurate, safer, and easier-to-accept results under the same constraints.
