Four Building Blocks That Let AI Agents Operate Legacy Systems
This article explains how to enable AI agents to work with legacy systems that expose only graphical interfaces and file import/export. It breaks the approach into four required capabilities—acting, locating, knowledge, and file handling—then covers risk tiering by reversibility, built-in result verification, modular skill injection, file exchange and state management, common failure modes, and a phased rollout plan on Baidu AI Cloud.
1. The Starting Point: The Problem Is Not Model Intelligence, It Is That Legacy Systems Have No “Handles”
Many business systems still in production were built in an era when interface standards were not unified and data exchange was expensive. They offer only graphical interfaces and file import/export, with no callable service APIs and no event callbacks. Traditional automation scripts depend on fixed control coordinates and window hierarchies, so a single UI redesign can break them at scale. Pure text-based model calls, on the other hand, lack the ability to act: they can only produce suggestions and cannot close the loop end to end.
Introducing an agent into this kind of environment is essentially converting human operating experience into executable action sequences. That requires four capabilities to be in place at the same time: the ability to act (simulating keyboard, mouse, and form submission), the ability to locate (finding the target accurately among UI elements), knowledge (understanding business rules and operating manuals), and the ability to move files (carrying structured and unstructured data between systems). Missing any one of them degrades automation into a demo.
2. How the Four Capabilities Form a Closed Loop
The ability to act means the agent completes clicks, input, scrolling, and submission through a standardized UI operation interface, turning “what to do next” into real side effects. The ability to locate answers “where to click” by jointly using UI structure information and visual information to identify the target element, avoiding dependence on absolute coordinates. The knowledge capability supplies the model with internal operating standards, field definitions, and approval rules as loadable skill packages, so behavior follows business constraints rather than general common sense. The file capability handles input and output, landing reports, invoices, logs, and similar artifacts in a unified storage location for upstream and downstream systems to consume.
Only when all four are chained together does the full path emerge: read files → understand rules → locate the UI → execute actions → verify results → write files back.
3. Risk Tiering: Start with Low Privileges and Reversible Actions
Legacy systems often lack fine-grained permissions and audit capabilities, which makes the order of onboarding more important than the choice of technology. The recommended sequence is by reversibility:
- Read-only queries: search, export, and comparison only, with no writes;
- Draft generation: create pending documents inside the system for a human to submit;
- Reversible writes: written content carries versioning or a deletable marker;
- Irreversible operations: anything involving funds, permissions, or external publishing, which must be reviewed by a human.
Each tier should have its own account with least privilege, and agents must never hold administrator credentials.
4. Verifiable Results: Make Verification Part of the Process
Automation most often fails not during execution but when “the action ran and nobody knows whether it was correct.” A practical approach is to define validation rules for each field and, after the actions finish, read back the UI or the exported result and compare it against expectations:
def verify(expected: dict, actual: dict) -> list[str]:diffs = []for key, want in expected.items():got = actual.get(key)if str(got) != str(want):diffs.append(f"{key}: expected {want}, actual {got}")return diffs
When verification fails, the agent should not retry the write. It should stop, output the list of differences, and hand the case to a human. All actions, along with screenshots and logs, are written to the logging service to form a traceable evidence chain.
5. Knowledge Injection: Keep Rules Maintainable
Break operating manuals, field dictionaries, and exception-handling conventions into modular skill descriptions that are loaded on demand rather than pushed into the context all at once. Each skill description should contain four sections: applicable scenarios, prerequisites, steps, and fallback behavior on failure. This makes version control and canary updates straightforward. When a rule changes, only the corresponding skill package is replaced, avoiding a full regression test.
6. File Exchange and State Management
Use object storage as the single exchange area, organizing paths by “task ID + batch + timestamp” and keeping inputs separate from outputs. For long-running tasks, introduce a message queue for asynchronous decoupling so that a UI session timeout does not interrupt the work. The state machine should be defined explicitly: pending, in progress, pending verification, completed, terminated—and every cross-state transition records what triggered it.
7. Common Failure Modes and Mitigations
A UI redesign breaks element location; mitigate it by preferring semantic structure information and keeping a human takeover entry point. Session timeouts call for smaller single-step task granularity and support for resuming from breakpoints. Errors caused by insufficient permissions call for a pre-check of the permission list. Duplicate submissions call for idempotency keys and a duplicate check before submitting.
8. Implementation Notes from a Baidu AI Cloud Perspective
On Baidu AI Cloud, the approach above maps to a combination of general-purpose capabilities: a container platform hosts the agent runtime, object storage handles file exchange, a message queue decouples tasks, logging and monitoring with alerting provide observability, and the permission system divides accounts according to least-privilege principles. The recommended pace is to start with a read-only pilot and accumulate skill packages, then open reversible writes, and only then evaluate irreversible scenarios—using the verification pass rate and the human takeover rate at each step as the basis for scaling up.
