Can AI Agents Improve Themselves? Lessons from Batch File Processing
A batch video download task reveals the difference between reliable automation, short-term adaptation, and sustained improvement in AI agents. This article explains how to define verifiable task requirements, separate agent decisions from deterministic execution, build recoverable workflows, protect sensitive data, and evaluate whether improvements carry over to new tasks. It also clarifies why reusable scripts and stored experience do not, by themselves, demonstrate model-level learning.
1. Batch Downloads Look Simple but Test System Reliability
Consider a spreadsheet containing 237 user records, 176 of which include links to facial recognition videos. The requirement is to download those videos into a designated directory and name each file using the pattern name-ID number.extension.
At first glance, this seems like a repetitive sequence: open a link, download a file, and rename it. In an engineering implementation, however, the challenge goes well beyond running a loop 176 times.
The input may not be clean. Link fields may be empty, names may contain leading or trailing whitespace, and spreadsheet software may have converted identity document numbers into numeric values, losing leading characters or precision.
Downloads can fail because links have expired, access permissions are insufficient, connections are interrupted, or servers impose rate limits. A response may also contain something other than the expected video.
Saving files introduces further risks: duplicate filenames, invalid path characters, insufficient disk space, and leftover temporary files.
These problems show that batch file processing is not primarily about whether a system can invoke a download function. It is about maintaining correct results, traceable execution, and recoverable failures in an uncertain environment.
An AI agent adds value by translating a business objective into executable, verifiable steps. Completing the task, however, does not establish that the agent can improve itself.
2. What Does “Self-Improvement” Actually Mean?
To assess whether an AI agent can improve over time, we need to distinguish several levels of capability.
Automatic Retries: An Execution Mechanism, Not Learning
Retrying a failed download is a standard fault-tolerance measure. If the system keeps applying the same rules, it has not acquired new knowledge.
A retry may resolve a temporary connection failure. It will generally not resolve expired access credentials. An agent that cannot distinguish these cases may simply generate more requests and take longer to finish.
Retries are a foundation of reliable execution, but they are not sufficient evidence of self-improvement.
Within-Task Adjustment: Short-Term Adaptation, Not Lasting Learning
An agent may reduce concurrency after observing widespread rate limiting. It may also clean link fields after discovering unwanted whitespace.
These actions go beyond mechanical retries because they use feedback to adjust the current strategy. But if the adjustments disappear when the task ends and do not affect later runs, they remain adaptations within the current context.
Cross-Task Reuse: Key Evidence of Sustained Improvement
A more complete improvement loop emerges when an agent saves validated experience, applies it to similar tasks, and tests whether it remains useful:
Observe a problem → propose a change → validate the result → save the experience → reuse it → continue evaluating.
Such improvements may reside in task templates, external memory, scripts, or policy settings. They do not necessarily involve changes to the underlying model’s parameters.
Model Updates: A Separate Capability Requiring Separate Evidence
Learning that changes model parameters requires an explicit process for data handling, training, evaluation, and deployment.
Generating a new script or saving operating instructions does not mean an agent has autonomously trained its underlying model.
The more accurate claim is that the system improved an execution strategy or added reusable task experience. Model-level learning should be discussed only when a model update has actually occurred and has been validated.
3. Turn Natural-Language Requirements into Verifiable Specifications
For the video download task, the first priority is not choosing a tool. It is defining success.
At a minimum, the specification should establish:
- Which fields the input file contains and how their types should be interpreted.
- Which records qualify for downloading.
- Whether the video links require authentication and whether access authorization is valid.
- Whether filenames may contain full identity document numbers.
- How duplicate records should be handled and whether existing files may be overwritten.
- What conditions constitute a successful download.
- Which failures require automatic retries or human review.
- Which reports and summary statistics must be produced.
The 176 records with video links provide an initial business count. They should not be assumed to represent 176 unique files that can all be downloaded successfully. Duplicate links, malformed fields, and expired URLs may change the actual workload.
Input reconciliation should follow a defined relationship:
Total records = records without links + records ready for processing + anomalous records requiring human review.
Once execution begins, task reconciliation should use another relationship:
Tasks to process = successful tasks + failed tasks + unfinished tasks.
The task count depends on the agreed deduplication rules and may differ from the original record count. These definitions must be established before execution; otherwise, “all tasks completed” may simply mean failed records were silently skipped.
4. Let the Agent Decide and Controlled Code Execute
Not every step should be handled directly by a language model.
AI agents are well suited to clarifying requirements, decomposing tasks, classifying exceptions, and adjusting plans. Deterministic operations—such as parsing fields, writing bytes, calculating checksums, and recording state—are better handled by controlled software.
A clear workflow is:
Requirements analysis → input validation → task manifest → download execution → file validation → result reconciliation → experience evaluation.
The agent does not need to repeatedly read the full contents of every video. Nor should it decide whether a download succeeded based on a narrative description. It should invoke an execution module and make decisions from structured results.
For example, the module might return explicit statuses such as “access denied,” “connection timeout,” or “unexpected content type.” The agent can then choose to stop, retry, adjust the strategy, or request human intervention.
This separation reduces unnecessary model calls and makes critical operations easier to test and audit.
5. Build a Recoverable Download Workflow
Create a Task Manifest Before Downloading
Each task should record at least a stable internal identifier, the source row number, the destination path, its current status, the number of attempts, and an error category.
Names and identity document numbers should not serve directly as internal identifiers. Use an independent business record ID or a controlled identifier derived from authorized fields to avoid exposing sensitive information in operational logs.
The manifest acts as the workflow’s state ledger. If execution stops, it should still be possible to determine which files are complete and which tasks need to resume.
Use Temporary Files to Keep Partial Downloads Out of Final Results
Write downloads to temporary paths first. Move them to their final locations only after content validation succeeds.
Where the filesystem supports the relevant semantics, an atomic rename within the same filesystem helps prevent observers from seeing an intermediate state. A move across filesystems should not be assumed to provide the same guarantee.
Regardless of the storage method, a task should be marked successful only after the file has been fully written and has passed validation.
Classify Errors Before Retrying
Connection timeouts and temporary service outages can often be handled with bounded retries, backoff, and randomized delays. This reduces the risk of synchronized requests placing renewed pressure on a server.
Expired credentials, missing resources, and insufficient permissions should not trigger unlimited retries. Preserve the failure reason and, where necessary, ask a human to update authorization or verify the source data.
Concurrency must also be constrained. More parallel requests do not necessarily produce better throughput. Excessive request pressure can increase failures and prolong recovery.
Keep Repeated Runs Predictable
Rerunning the same task should not blindly download everything again or overwrite existing files without notice.
The program should check previous task states and destination files, revalidating file integrity when needed. File existence alone is not a reliable reason to skip a download: the file may be an incomplete artifact from an interrupted run.
Repeatable execution without unintended side effects is a basic requirement for dependable batch processing.
6. Do Not Guess Filenames or File Validity
The naming pattern name-ID number.extension appears precise, but it leaves several edge cases unresolved.
Names may contain characters that are unsuitable for paths. Different records may generate identical filenames. Identity document numbers must be treated as text. Filesystems can also differ in filename length limits and case-comparison rules.
The naming module should consistently normalize characters, check length limits, and detect collisions. Duplicate filenames should follow an agreed suffix rule or enter a human review queue—not silently overwrite one another.
File extensions should not be derived solely from the end of a URL. Some links have no extension, while others return an error page rather than a video. A more reliable approach combines response metadata, file content signatures, and available media parsing results.
Two types of checks must remain distinct:
- Checksums help detect changes to a file or determine whether two files are identical.
- Content validation determines whether a file matches the expected format and shows signs of corruption.
Without a trusted checksum for the source file, calculating a digest after downloading does not prove that the downloaded file exactly matches the source content.
7. Make Sensitive-Data Protection a Default Constraint
This scenario involves identity document numbers and facial videos, making it a high-risk data-processing task. Greater automation should come with stronger safeguards against accidental exposure.
Putting full identity document numbers in filenames can expose them through directory listings, backups, synchronization records, or logs. A safer default is to name files with business record IDs and keep the mapping between names, identity numbers, and files in a controlled table.
If the business genuinely requires the original naming convention, first confirm the basis for processing and the authorized access scope. Necessary safeguards include:
- Applying least-privilege access controls to the download directory.
- Using appropriate encryption for data in transit and at rest.
- Excluding full identity document numbers and credential-bearing URLs from logs.
- Removing temporary files and expired data according to retention policies.
- Restricting unnecessary network access from the execution environment.
- Preventing instructions embedded in external pages or files from changing established task permissions.
In particular, an agent must not treat text inside downloaded content as operational instructions. External data is an object to process, not authority to upload sensitive files, expand directory access, or modify security policies.
8. How to Verify That an Agent Is Improving
The source scenario provides no complete execution logs, failure records, or results from repeated tests. It therefore cannot establish that any particular system has achieved self-improvement.
Verifying sustained improvement requires an independent evaluation process.
Establish a Stable Baseline
Record the initial strategy’s performance using the same input, authorization scope, and comparable resource conditions.
Network fluctuations and changes in the source service should be documented separately rather than attributed entirely to the agent’s capabilities.
Use Verifiable Outcome Metrics
Useful measures include:
- The completion rate for valid tasks.
- The proportion of files passing content validation.
- The number of filename conflicts.
- The number of human interventions.
- Redundant operations caused by repeated execution.
- Resource consumption per successful task.
These metrics should come from execution logs and acceptance results, not from the agent’s own summary.
Test Reusable Experience on New Tasks
Optimizing only for the original 176 records may amount to patching one dataset. Stronger evidence comes from testing structurally similar tasks with different data.
For example, cleaning rules should handle new whitespace cases. Concurrency strategies should remain controlled under different network conditions. Filename collision handling should not depend on accidental characteristics of one batch.
Preserve Versions and Support Rollback
Every change to a task template, script, or policy should retain its rationale, validation results, and intended scope.
Unvalidated experience should remain a candidate recommendation rather than become a default rule. If a new strategy lowers the success rate or introduces additional security risk, the system should be able to restore the previous version.
9. Conclusion: Self-Improvement Must Be Verifiable and Bounded
An AI agent’s value does not depend on whether it claims to have “learned.” It depends on whether it handles input correctly, executes reliably, recognizes exceptions, validates results, and reuses experience within defined boundaries.
For tasks such as batch video organization, the practical goal is not unrestricted autonomy. It is a coordinated workflow in which the agent makes decisions, controlled code executes operations, state is recorded, results are verified, and experience is updated under governance.
A system can reasonably be described as capable of sustained improvement when its changes persist across tasks, work on new data, are supported by objective metrics, and remain auditable and reversible.
Without that evidence, even flexible behavior is better described as automation or within-task adaptation—not demonstrated self-evolution.
